Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To count the total number of exported identifiers using eslint rule, you can use the eslint-plugin-import rule "import/no-named-as-default-member".

This rule detects if a default import is an exported member of its own module, which could imply confusion as to which name should be imported.

The way to use this rule is to first install the eslint-plugin-import package and add it to your eslint config file:

npm install eslint-plugin-import --save-dev
{
  "plugins": [
    "import"
  ],
  "rules": {
    "import/no-named-as-default-member": "error"
  }
}

With this rule, you will get an error whenever a default import is an exported member of its own module when importing the module. You can then count the total number of errors reported by this rule in your eslint output to determine the number of exported identifiers.