ESLint Plugin Oro
raw JSON → 0.0.3 verified Sat Apr 25 auth: no javascript
ESLint plugin providing custom linting rules for OroPlatform, OroCRM, and OroCommerce projects. Current stable version is 0.0.3 (released 2021). It adds a single rule, 'named-constructor', that enforces naming conventions for Backbone.js constructor functions (View, Model, Collection). Requires ESLint >=7.23.0 and has no active development since 0.0.2. Differentiators: specifically targets Oro ecosystem conventions, but otherwise limited in scope and community adoption compared to general Backbone linting tools.
Common errors
error Error: Failed to load plugin 'oro': Cannot find module 'eslint-plugin-oro' ↓
cause plugin not installed or missing from node_modules
fix
run 'npm install eslint-plugin-oro --save-dev'
error Configuration for rule "oro/named-constructor" is invalid: Value "1" is not a valid severity. ↓
cause using numeric severity 1 instead of string 'warn' or 'error'
fix
use string severity: 'off', 'warn', or 'error'
Warnings
breaking requires eslint >=7.23.0, incompatible with older versions ↓
fix upgrade eslint to >=7.23.0
gotcha plugin contains only one rule: named-constructor ↓
fix check documentation for other plugins if more rules are needed
gotcha settings.oro.backboneExtendablesTypes must be an array of strings, otherwise plugin may fail silently ↓
fix provide array with Backbone class name suffixes (e.g., ['View','Model','Collection'])
gotcha plugin is not actively maintained (last release 0.0.2, no updates since 2021) ↓
fix consider forking or using alternative eslint plugins for Backbone
Install
npm install eslint-plugin-oro yarn add eslint-plugin-oro pnpm add eslint-plugin-oro Imports
- plugin wrong
plugins: ['eslint-plugin-oro']correctplugins: ['oro'] - recommended config wrong
extends: ['oro/recommended']correctextends: ['plugin:oro/recommended'] - named-constructor rule wrong
rules: { 'named-constructor': 'warn' }correctrules: { 'oro/named-constructor': 'warn' }
Quickstart
// .eslintrc.json
{
"plugins": ["oro"],
"extends": ["plugin:oro/recommended"],
"settings": {
"oro": {
"backboneExtendablesTypes": ["View", "Model", "Collection"]
}
},
"rules": {
"oro/named-constructor": "error"
}
}
// Example file that may trigger rule:
// Non-compliant: const view = BaseView.extend({});
// Compliant: const MyView = BaseView.extend({});