@sencha/extjs/no-existing-method-override
Report the overriding of an existing method
Rule Details
This rule will report when an existing method is being overridden.
In this example, getModel
is an existing method of the Ext.app.Application
Class since version 4 and getName
is an existing getter
method from the name
config of the Ext.app.Application
Class since version 5. It goes without saying that accidentally overriding these methods could cause your application to not start or to have unexpected results. And what could have been an ok method to override or define in an earlier version of the framework could be conflicting in the version you wish to upgrade to. So by configuring to use this no-existing-method-override
rule, problems will be reported when you accidentally do so.
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-method-override": "warn"
}
}
JavaScript
Ext.define('MyApp.Application', {
extend: 'Ext.app.Application',
name: 'MyApp',
getModel: Ext.emptyFn,
getName: Ext.emptyFn
});
Problem Messages reported by ESLint
Override of existing method 'getModel' found for 'Ext.app.Application'
Override of existing method 'getName', for the 'name' config, found for 'Ext.app.Application'