@sencha/extjs/no-existing-alias-override
Report the overriding of an existing alias
Rule Details
This rule will report when an existing alias is being overridden.
In this example, we are defining several classes that use an alias of an existing Class. Since an alias needs to be unique, overriding an existing alias can cause unexpected results. This problem can easily be caught by enabling this rule.
ESLint Config
{
"plugins": [
"@sencha/extjs"
],
"extends": [
// this rule is in the recommended configuration list
// so including this line enables this rule
"plugin:@sencha/extjs/recommended"
],
"settings": {
"extjs": {
"toolkit": "classic",
"fromVersion": 4,
"toVersion": 'latest'
}
},
"rules": {
// optionally, you can specify the rule explicitly
// and the errorlevel and any options set here
// will override any defaults from the 'extends' section
"@sencha/extjs/no-existing-alias-override": "warn"
}
}
JavaScript
// 'dashboard' did not exist in 4 but does in a later version
Ext.define('MyCustomDashboard', {
xtype: 'dashboard'
});
// 'widget.widgetcolumn' did not exist in 4 but does in a later version
Ext.define('MyCustomGridWidgetColumn', {
alias: 'widget.widgetcolumn'
});
// 'breadcrumb' did not exist in 4 but does in a later version
Ext.define('MyCustomBreadCrumb', {
xtype: 'breadcrumb'
});
// 'store.chained' did not exist in 4 but does in a later version
Ext.define('MyCustomChainedStore', {
extend: 'Ext.data.AbstractStore',
alias: 'store.chained',
});
Problem Messages reported by ESLint
Override of existing alias 'widget.dashboard' found for 'Ext.dashboard.Dashboard'
Override of existing alias 'widget.widgetcolumn' found for 'Ext.grid.column.Widget'
Override of existing alias 'widget.breadcrumb' found for 'Ext.toolbar.Breadcrumb'
Override of existing alias 'store.chained' found for 'Ext.data.ChainedStore'