@sencha/extjs/no-deprecated-method-override
Report the overriding of a deprecated method
Rule Details
This rule will report when a deprecated method is being overridden.
In this example, we are overriding the validate
method of the Ext.data.Model
Class, which was deprecated in 5.0
and the doComponentLayout
method of the Ext.Component
Class, which was deprecated in 4.1
. So upgrading from a prior version to a version greater than 5.0
will cause this problem to be reported.
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-deprecated-method-override": "warn"
}
}
JavaScript
// validate is a deprecated method of Ext.data.Model as of 5.0
Ext.define('User', {
extend: 'Ext.data.Model',
validate: function () {}
});
// doComponentLayout is a deprecated method of Ext.Componet as of 4.1
Ext.define('MyCustomComponent', {
extend: 'Ext.Component',
doComponentLayout: function () {
return this.callParent();
}
});
Problem Messages reported by ESLint
Override of deprecated method 'validate' found for 'Ext.data.Model'
Override of deprecated method 'doComponentLayout' found for 'Ext.Component'