@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

  1. {
  2. "plugins": [
  3. "@sencha/extjs"
  4. ],
  5. "extends": [
  6. // this rule is in the recommended configuration list
  7. // so including this line enables this rule
  8. "plugin:@sencha/extjs/recommended"
  9. ],
  10. "settings": {
  11. "extjs": {
  12. "toolkit": "classic",
  13. "fromVersion": 4,
  14. "toVersion": 'latest'
  15. }
  16. },
  17. "rules": {
  18. // optionally, you can specify the rule explicitly
  19. // and the errorlevel and any options set here
  20. // will override any defaults from the 'extends' section
  21. "@sencha/extjs/no-deprecated-method-override": "warn"
  22. }
  23. }

JavaScript

  1. // validate is a deprecated method of Ext.data.Model as of 5.0
  2. Ext.define('User', {
  3. extend: 'Ext.data.Model',
  4. validate: function () {}
  5. });
  6. // doComponentLayout is a deprecated method of Ext.Componet as of 4.1
  7. Ext.define('MyCustomComponent', {
  8. extend: 'Ext.Component',
  9. doComponentLayout: function () {
  10. return this.callParent();
  11. }
  12. });

Problem Messages reported by ESLint

  1. Override of deprecated method 'validate' found for 'Ext.data.Model'
  2. Override of deprecated method 'doComponentLayout' found for 'Ext.Component'