@sencha/extjs/no-private-method-override

Report the overriding of a private method

Rule Details

This rule will report when a private method is being overridden.

In this example, getAutoId is a private method of the Ext.Component Class and has been around since version 4. And getActiveCounter is a getter method generated by the framework because of the activeCounter config starting with version 5. A problem will be reported if the fromVersion is any version and the toVersion is set to any value >= 5.

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-private-method-override": "warn"
  22. }
  23. }

JavaScript

  1. Ext.define('MyCustomComponent', {
  2. extend: 'Ext.Component',
  3. getAutoId: function () {},
  4. getActiveCounter: function () {}
  5. });

Problem Messages reported by ESLint

  1. Override of private method 'getAutoId' found for 'Ext.Component'
  2. Override of private method 'getActiveCounter', for the 'activeCounter' config, found for 'Ext.Component'