@sencha/extjs/no-deprecated-method-call

Report the calling of a deprecated method

Rule Details

This rule will report when a deprecated method is being called.

In this example, we are calling the setText method of the Ext.toolbar.TextItem Class, which was deprecated in 5.1. So upgrading from a prior version to a version greater than 5.1 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-call": "warn"
  22. }
  23. }

JavaScript

  1. // setText is a deprecated method of Ext.toolbar.TextItem
  2. Ext.define('Ext.ux.desktop.TrayClock', {
  3. extend: 'Ext.toolbar.TextItem',
  4. updateTime: function () {
  5. var me = this;
  6. me.setText(text);
  7. }
  8. });

Problem Message reported by ESLint

  1. Call to deprecated method 'setText' found for 'Ext.toolbar.TextItem'