Skip to content

Commit cf93ef1

Browse files
authored
fix: Disable import-x/no-duplicates in TypeScript files (#427)
This rule had to be disabled in `core` because the autofixer is very broken. I'm also not sure we want to strictly require one import between type and non-type imports anyway, it's a stylistic preference. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Disables `import-x/no-duplicates` in the TypeScript ESLint config, updates the rules snapshot, and adds changelog entries noting the change and related autofix behavior fix. > > - **TypeScript ESLint config**: > - Disable `import-x/no-duplicates` in `packages/typescript/src/index.mjs` with rationale comments. > - **Rules Snapshot**: > - Set `import-x/no-duplicates` to `off` in `packages/typescript/rules-snapshot.json`. > - **Changelog**: > - Add "Changed" entry for disabling `import-x/no-duplicates` in `packages/typescript/CHANGELOG.md`. > - Add "Fixed" entry noting prevention of non-type imports being grouped under a type import during auto-fix. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit d06d2c8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent f3246f7 commit cf93ef1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/typescript/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Disable `@typescript-eslint/no-unnecessary-type-arguments` ([#426](https://github.com/MetaMask/eslint-config/pull/426))
1515
- We decided that "unnecessary" type arguments make types easier to read sometimes, so we should allow them.
1616
- Disable `promise/valid-params` because it's redundant in type-checked projects ([#425](https://github.com/MetaMask/eslint-config/pull/425))
17+
- Disable `import-x/no-duplicates` ([#427](https://github.com/MetaMask/eslint-config/pull/427))
18+
- It was a style preference that we may not want, and the auto-fix was broken.
19+
20+
### Fixed
21+
22+
- Prevent non-type imports from being grouped under a type import upon auto-fix ([#427](https://github.com/MetaMask/eslint-config/pull/427))
23+
- This was caused by `import-x/no-duplicates`, which is now disabled.
1724

1825
## [14.1.0]
1926

packages/typescript/rules-snapshot.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
"getter-return": "off",
156156
"import-x/consistent-type-specifier-style": ["error", "prefer-top-level"],
157157
"import-x/named": "off",
158+
"import-x/no-duplicates": "off",
158159
"import-x/no-unresolved": "off",
159160
"jsdoc/check-access": "error",
160161
"jsdoc/check-alignment": "error",

packages/typescript/src/index.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ const config = createConfig({
199199

200200
/* import-x plugin rules */
201201

202+
// This rule is to aggresive about combining type and non-type imports, which I'm not sure that we want.
203+
// But more importantly, the auto-fixer is broken.
204+
// See here for details on that bug: https://github.com/un-ts/eslint-plugin-import-x/issues/231
205+
'import-x/no-duplicates': 'off',
206+
202207
// Handled by TypeScript
203208
'import-x/no-unresolved': 'off',
204209

0 commit comments

Comments
 (0)