Skip to content

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.

RuleSettingFilesWhat it checksWhy
no-duplicate-importsoffJS + TSDisallow duplicate module importsOff: import type lines are kept separate (consistent-type-imports).
no-import-assignerrorJS + TSDisallow assigning to imported bindings—
no-restricted-exportsoffJS + TSDisallow specified names in exports—
no-restricted-importserror, {"patterns":[{"regex":"^\\.\\./[^./]+/internal(?:/|$)","m…JS + TSDisallow specified modules when loaded by importCustom: a theme's internal/ folder is private to it (src/internal/ is shared by every theme).
sort-importsoffJS + TSEnforce sorted import declarations within modules—
stricterrorJS + TSRequire or disallow strict mode directives—
sonarjs/unused-importoffJS + TSUnnecessary imports should be removedOff: duplicate of @typescript-eslint/no-unused-vars.
sonarjs/no-default-utility-importswarnJS + TSDefault imports from modular utility libraries should not be used—
sonarjs/no-implicit-dependenciesoffJS + TSDependencies should be explicitOff: not in the Sonar way profile of SonarQube.
sonarjs/no-internal-api-usewarnJS + TSUsers should not use internal APIs—
sonarjs/no-require-or-defineoffJS + TS"import" should be used to include external codeOff: not in the Sonar way profile of SonarQube.
sonarjs/no-wildcard-importoffJS + TSWildcard imports should not be usedOff: not in the Sonar way profile of SonarQube.
no-import-assignoffTSDisallow assigning to imported bindings—
@typescript-eslint/no-namespacewarnTSDisallow TypeScript namespaces—
@typescript-eslint/no-require-importserrorTSDisallow invocation of require()—
@typescript-eslint/no-restricted-importsoffTSDisallow specified modules when loaded by importDeprecated: use the core no-restricted-imports if needed.
@typescript-eslint/no-useless-empty-exporterrorTSDisallow empty exports that don't change anything in a module file—
@typescript-eslint/no-var-requiresoffTSDisallow require statements except in import statementsDeprecated: replaced by no-require-imports.
@typescript-eslint/prefer-namespace-keyworderrorTSRequire using namespace keyword over module keyword to declare custom TypeScript modules—
@typescript-eslint/triple-slash-referencewarnTSDisallow certain triple slash directives in favor of ES6-style import declarations—

Generated from the JSDoc of the sources.