no-duplicates
Added in v0.4.2Configuration
rslint.config.ts
Rule Details
Reports if a resolved path is imported more than once.
This rule is similar to ESLint core's no-duplicate-imports, but differs in two key ways:
- The paths in the source code don't have to exactly match — they just have to point to the same module on the filesystem (e.g.,
./fooand./foo.js). - This version distinguishes
typeimports from standard imports.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
considerQueryString
- Default:
falseby defaulttrueif using theimportPlugin.configs.recommendedpreset
When set to true, imports with different query strings are treated as different modules.
For example, these imports are reported as duplicates when considerQueryString is false, but are allowed when it is true:
prefer-inline
- Default:
false
When set to true, supports TypeScript inline type imports, allowing import type { X } to be merged into import { type X }.