@sencha/extjs/override-method-call

Report the usage of a override method

Rule Details

This rule will report when the override method is being called.

In this example, Ext.override() and this.override() is being called. This rule reports this problem regardless of extjs settings so any value can be used for the fromVersion and the toVersion. In fact, these settings can be left off entirely and just the version setting used.

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. "version": "latest"
  14. }
  15. },
  16. "rules": {
  17. // optionally, you can specify the rule explicitly
  18. // and the errorlevel and any options set here
  19. // will override any defaults from the 'extends' section
  20. "@sencha/extjs/override-method-call": "warn"
  21. }
  22. }

JavaScript

  1. // Calling Ext.override() directly
  2. Ext.override(panel, {
  3. initComponent: function () {
  4. this.callParent();
  5. }
  6. });
  7. // Calling this.override() directly
  8. Ext.define('MyCustomClass', {
  9. extend: 'Ext.Component',
  10. constructor: function () {
  11. this.override({
  12. alignTo: function () {}
  13. });
  14. this.callParent();
  15. }
  16. });

Problem Messages reported by ESLint

  1. Call to 'Ext.override()' method found
  2. Call to 'this.override()' method found