eslint/rules/modules
Modules: import, export, require and module boundaries (the import-x plugin has its own block). Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only.
20 rules, 10 on. Source: lint/eslint/rules/modules.mjs.
| Rule | Setting | Files | What it checks | Why |
|---|---|---|---|---|
no-duplicate-imports | off | JS + TS | Disallow duplicate module imports | Off: import type lines are kept separate (consistent-type-imports). |
no-import-assign | error | JS + TS | Disallow assigning to imported bindings | — |
no-restricted-exports | off | JS + TS | Disallow specified names in exports | — |
no-restricted-imports | error, {"patterns":[{"regex":"^\\.\\./[^./]+/internal(?:/|$)","m… | JS + TS | Disallow specified modules when loaded by import | Custom: a theme's internal/ folder is private to it (src/internal/ is shared by every theme). |
sort-imports | off | JS + TS | Enforce sorted import declarations within modules | — |
strict | error | JS + TS | Require or disallow strict mode directives | — |
sonarjs/unused-import | off | JS + TS | Unnecessary imports should be removed | Off: duplicate of @typescript-eslint/no-unused-vars. |
sonarjs/no-default-utility-imports | warn | JS + TS | Default imports from modular utility libraries should not be used | — |
sonarjs/no-implicit-dependencies | off | JS + TS | Dependencies should be explicit | Off: not in the Sonar way profile of SonarQube. |
sonarjs/no-internal-api-use | warn | JS + TS | Users should not use internal APIs | — |
sonarjs/no-require-or-define | off | JS + TS | "import" should be used to include external code | Off: not in the Sonar way profile of SonarQube. |
sonarjs/no-wildcard-import | off | JS + TS | Wildcard imports should not be used | Off: not in the Sonar way profile of SonarQube. |
no-import-assign | off | TS | Disallow assigning to imported bindings | — |
@typescript-eslint/no-namespace | warn | TS | Disallow TypeScript namespaces | — |
@typescript-eslint/no-require-imports | error | TS | Disallow invocation of require() | — |
@typescript-eslint/no-restricted-imports | off | TS | Disallow specified modules when loaded by import | Deprecated: use the core no-restricted-imports if needed. |
@typescript-eslint/no-useless-empty-export | error | TS | Disallow empty exports that don't change anything in a module file | — |
@typescript-eslint/no-var-requires | off | TS | Disallow require statements except in import statements | Deprecated: replaced by no-require-imports. |
@typescript-eslint/prefer-namespace-keyword | error | TS | Require using namespace keyword over module keyword to declare custom TypeScript modules | — |
@typescript-eslint/triple-slash-reference | warn | TS | Disallow certain triple slash directives in favor of ES6-style import declarations | — |