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

Report the calling of a private method

Rule Details

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

In this example, createWidget is a private method of the Ext Class and has been around since version 4. And _hasIcon is a private method of the Ext.button.Button Class and has been around since version 5. A problem will be reported when calling either of these methods when the fromVersion is >= 4 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-call": "warn"
  22. }
  23. }

JavaScript

  1. Ext.createWidget('button', {})._hasIcon();

Problem Messages reported by ESLint

  1. Call to private method 'createWidget' found for 'Ext'
  2. Call to private method '_hasIcon' found for 'Ext.button.Button'