diff --git a/.monoweave/303f42b9.md b/.monoweave/303f42b9.md new file mode 100644 index 0000000..3bacae4 --- /dev/null +++ b/.monoweave/303f42b9.md @@ -0,0 +1,4 @@ +--- +"@noahnu/eslint-config": major +--- +Migrate from eslint-plugin-import to eslint-plugin-import-x \ No newline at end of file diff --git a/.yarnrc.yml b/.yarnrc.yml index 140273f..36b6d1b 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -5,3 +5,7 @@ npmRegistries: npmAuthToken: "${NPM_PUBLISH_TOKEN:-invalid}" enableTransparentWorkspaces: false + +logFilters: + - pattern: "doesn't provide eslint-plugin-import (*), requested by eslint-import-resolver-typescript" + level: discard diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 5762f1b..a15ad5c 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -62,7 +62,7 @@ "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-node": "^0.3.9", "eslint-import-resolver-typescript": "^3.6.1", - "eslint-plugin-import": "^2.29.1", + "eslint-plugin-import-x": "^0.5.1", "eslint-plugin-jest": "^28.5.0", "eslint-plugin-prettier": "^5.1.3", "prettier": "^3.2.5" @@ -80,7 +80,7 @@ "eslint-config-prettier": ">=9.1.0", "eslint-import-resolver-node": ">=0.3.9", "eslint-import-resolver-typescript": ">=3.6.1", - "eslint-plugin-import": ">=2.29.1", + "eslint-plugin-import-x": ">=0.5.1", "eslint-plugin-jest": ">=28.5.0", "eslint-plugin-prettier": ">=5.1.3", "prettier": ">=3.2.5", diff --git a/packages/eslint-config/src/base/index.ts b/packages/eslint-config/src/base/index.ts index 1b27ecf..bd41361 100644 --- a/packages/eslint-config/src/base/index.ts +++ b/packages/eslint-config/src/base/index.ts @@ -77,17 +77,14 @@ const rules: ESLint.ConfigData['rules'] = { ignoreDeclarationSort: true, }, ], - 'import/default': 'error', - 'import/export': 'error', - 'import/named': 'error', - 'import/newline-after-import': 'error', - 'import/no-absolute-path': 'error', - 'import/no-duplicates': 'error', - 'import/no-mutable-exports': 'error', - 'import/no-self-import': 'error', - 'import/no-useless-path-segments': 'error', - 'import/no-unresolved': 'error', - 'import/order': [ + 'import-x/newline-after-import': 'error', + 'import-x/no-absolute-path': 'error', + 'import-x/no-duplicates': 'error', + 'import-x/no-mutable-exports': 'error', + 'import-x/no-self-import': 'error', + 'import-x/no-useless-path-segments': 'error', + 'import-x/no-unresolved': 'error', + 'import-x/order': [ 'error', { alphabetize: { order: 'asc' }, @@ -134,11 +131,13 @@ const config: ESLint.ConfigData = { ecmaVersion: 'latest', sourceType: 'module', }, - plugins: ['import', 'prettier', '@typescript-eslint'], + plugins: ['import-x', 'prettier', '@typescript-eslint'], extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/stylistic', + 'plugin:import-x/recommended', + 'plugin:import-x/typescript', // prettier must be the last item in this list to prevent conflicts 'prettier', ], @@ -154,20 +153,8 @@ const config: ESLint.ConfigData = { }, ], settings: { - 'import/external-module-folders': ['node_modules', '.yarn'], - 'import/parsers': { - '@typescript-eslint/parser': [ - '.ts', - '.tsx', - '.mts', - '.cts', - '.js', - '.mjs', - '.cjs', - '.jsx', - ], - }, - 'import/resolver': [ + 'import-x/external-module-folders': ['node_modules', '.yarn'], + 'import-x/resolver': [ { [require.resolve('eslint-import-resolver-typescript')]: { alwaysTryTypes: true, diff --git a/yarn.lock b/yarn.lock index f7a1395..8b5c1c3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1406,7 +1406,7 @@ __metadata: eslint-config-prettier: "npm:^9.1.0" eslint-import-resolver-node: "npm:^0.3.9" eslint-import-resolver-typescript: "npm:^3.6.1" - eslint-plugin-import: "npm:^2.29.1" + eslint-plugin-import-x: "npm:^0.5.1" eslint-plugin-jest: "npm:^28.5.0" eslint-plugin-prettier: "npm:^5.1.3" prettier: "npm:^3.2.5" @@ -1418,7 +1418,7 @@ __metadata: eslint-config-prettier: ">=9.1.0" eslint-import-resolver-node: ">=0.3.9" eslint-import-resolver-typescript: ">=3.6.1" - eslint-plugin-import: ">=2.29.1" + eslint-plugin-import-x: ">=0.5.1" eslint-plugin-jest: ">=28.5.0" eslint-plugin-prettier: ">=5.1.3" prettier: ">=3.2.5" @@ -2149,6 +2149,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/scope-manager@npm:7.11.0" + dependencies: + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" + checksum: 10c0/35f9d88f38f2366017b15c9ee752f2605afa8009fa1eaf81c8b2b71fc22ddd2a33fff794a02015c8991a5fa99f315c3d6d76a5957d3fad1ccbb4cd46735c98b5 + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:7.10.0": version: 7.10.0 resolution: "@typescript-eslint/type-utils@npm:7.10.0" @@ -2173,7 +2183,14 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.10.0, @typescript-eslint/typescript-estree@npm:^7.8.0": +"@typescript-eslint/types@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/types@npm:7.11.0" + checksum: 10c0/c5d6c517124017eb44aa180c8ea1fad26ec8e47502f92fd12245ba3141560e69d7f7e35b8aa160ddd5df63a2952af407e2f62cc58b663c86e1f778ffb5b01789 + languageName: node + linkType: hard + +"@typescript-eslint/typescript-estree@npm:7.10.0": version: 7.10.0 resolution: "@typescript-eslint/typescript-estree@npm:7.10.0" dependencies: @@ -2192,7 +2209,26 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.10.0, @typescript-eslint/utils@npm:^6.0.0 || ^7.0.0, @typescript-eslint/utils@npm:^7.8.0": +"@typescript-eslint/typescript-estree@npm:7.11.0, @typescript-eslint/typescript-estree@npm:^7.8.0": + version: 7.11.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.11.0" + dependencies: + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/visitor-keys": "npm:7.11.0" + debug: "npm:^4.3.4" + globby: "npm:^11.1.0" + is-glob: "npm:^4.0.3" + minimatch: "npm:^9.0.4" + semver: "npm:^7.6.0" + ts-api-utils: "npm:^1.3.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/a4eda43f352d20edebae0c1c221c4fd9de0673a94988cf1ae3f5e4917ef9cdb9ead8d3673ea8dd6e80d9cf3523a47c295be1326a3fae017b277233f4c4b4026b + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:7.10.0": version: 7.10.0 resolution: "@typescript-eslint/utils@npm:7.10.0" dependencies: @@ -2206,6 +2242,20 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/utils@npm:^6.0.0 || ^7.0.0, @typescript-eslint/utils@npm:^7.4.0, @typescript-eslint/utils@npm:^7.8.0": + version: 7.11.0 + resolution: "@typescript-eslint/utils@npm:7.11.0" + dependencies: + "@eslint-community/eslint-utils": "npm:^4.4.0" + "@typescript-eslint/scope-manager": "npm:7.11.0" + "@typescript-eslint/types": "npm:7.11.0" + "@typescript-eslint/typescript-estree": "npm:7.11.0" + peerDependencies: + eslint: ^8.56.0 + checksum: 10c0/539a7ff8b825ad810fc59a80269094748df1a397a42cdbb212c493fc2486711c7d8fd6d75d4cd8a067822b8e6a11f42c50441977d51c183eec47992506d1cdf8 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:7.10.0": version: 7.10.0 resolution: "@typescript-eslint/visitor-keys@npm:7.10.0" @@ -2216,6 +2266,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:7.11.0": + version: 7.11.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.11.0" + dependencies: + "@typescript-eslint/types": "npm:7.11.0" + eslint-visitor-keys: "npm:^3.4.3" + checksum: 10c0/664e558d9645896484b7ffc9381837f0d52443bf8d121a5586d02d42ca4d17dc35faf526768c4b1beb52c57c43fae555898eb087651eb1c7a3d60f1085effea1 + languageName: node + linkType: hard + "@ungap/structured-clone@npm:^1.2.0": version: 1.2.0 resolution: "@ungap/structured-clone@npm:1.2.0" @@ -4520,6 +4580,25 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-import-x@npm:^0.5.1": + version: 0.5.1 + resolution: "eslint-plugin-import-x@npm:0.5.1" + dependencies: + "@typescript-eslint/utils": "npm:^7.4.0" + debug: "npm:^4.3.4" + doctrine: "npm:^3.0.0" + eslint-import-resolver-node: "npm:^0.3.9" + get-tsconfig: "npm:^4.7.3" + is-glob: "npm:^4.0.3" + minimatch: "npm:^9.0.3" + semver: "npm:^7.6.0" + tslib: "npm:^2.6.2" + peerDependencies: + eslint: ^8.56.0 || ^9.0.0-0 + checksum: 10c0/3e605970550afd6c8372da774de1ed5a86164d0d69190c532ef9caed4e882d4519f589683130122ba2d353fba15e96e3b49391f893139147c5d48a432eaa9945 + languageName: node + linkType: hard + "eslint-plugin-import@npm:^2.29.1": version: 2.29.1 resolution: "eslint-plugin-import@npm:2.29.1" @@ -5160,12 +5239,12 @@ __metadata: languageName: node linkType: hard -"get-tsconfig@npm:^4.5.0": - version: 4.7.2 - resolution: "get-tsconfig@npm:4.7.2" +"get-tsconfig@npm:^4.5.0, get-tsconfig@npm:^4.7.3": + version: 4.7.5 + resolution: "get-tsconfig@npm:4.7.5" dependencies: resolve-pkg-maps: "npm:^1.0.0" - checksum: 10c0/169b2beababfbb16e8a0ae813ee59d3e14d4960231c816615161ab5be68ec07a394dce59695742ac84295e2efab8d9e89bcf3abaf5e253dfbec3496e01bb9a65 + checksum: 10c0/a917dff2ba9ee187c41945736bf9bbab65de31ce5bc1effd76267be483a7340915cff232199406379f26517d2d0a4edcdbcda8cca599c2480a0f2cf1e1de3efa languageName: node linkType: hard @@ -7209,7 +7288,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^9.0.1, minimatch@npm:^9.0.4": +"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3, minimatch@npm:^9.0.4": version: 9.0.4 resolution: "minimatch@npm:9.0.4" dependencies: