@sencha/extjs/no-deprecated-class-usage
Report the usage of a deprecated Class
Rule Details
This rule will report when a deprecated class is being used.
In this example, we are showing various ways to use a deprecated class. All of these examples are of classes that have been deprecated in earlier versions. So upgrading to the latest version will result in these problems 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-class-usage": "warn"
}
}
JavaScript
// Extending a deprecated Class using Ext.extend()
var MyCustomClass = Ext.extend(Ext.AbstractManager, {
customProp: true
});
// Using a conditional to extend a deprecated Class
var MyCustomDataClass = Ext.extend(true ? Ext.data.Types : Ext.data.Error, {
customProp: true
});
// Defining a new Class that extends a deprecated Class
Ext.define('MyCustomPlugin', {
extend: 'Ext.plugin.Responsive'
});
// Overriding a deprecated Class
Ext.define('overrides.Draggable', {
override: 'Ext.util.Draggable'
});
// Creating an instance of a deprecated Class by calling Ext.create
Ext.create('Ext.util.Draggable', {});
// Creating an instance of a deprecated Class by calling Ext.create and using the 'xclass' property
Ext.create({xclass: 'Ext.util.Draggable'});
// Creating an instance of a deprecated Class by calling Ext.create and using the 'xtype' property
Ext.create({xtype: 'trigger'});
// Creating an instance of a deprecated Class using the 'new' keyword
new Ext.util.Draggable({});
// Adding to the prototoype of a deprecated Class wil give you this warning
Ext.util.Draggable.prototype.customMethod = function () {};
Problem Messages reported by ESLint
Usage of deprecated Class 'Ext.AbstractManager' found
Usage of deprecated Class 'Ext.data.Types' found
Usage of deprecated Class 'Ext.data.Error' found
Usage of deprecated Class 'Ext.plugin.Responsive' found
Usage of deprecated Class 'Ext.util.Draggable' found
Usage of deprecated Class 'Ext.form.field.Trigger' found