Skip to content

Commit 22c1363

Browse files
committed
feat!(deps): Replace import with import-x (#64)
BREAKING CHANGE: there might be differences in a way this plugin works and this might require changes to project's own `eslint.config.js` files
1 parent 684c573 commit 22c1363

File tree

5 files changed

+43
-106
lines changed

5 files changed

+43
-106
lines changed

configs/base.js

+20-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import stylisticPlugin from '@stylistic/eslint-plugin';
2-
import * as importPlugin from 'eslint-plugin-import';
2+
import * as importPlugin from 'eslint-plugin-import-x';
33
import promise from 'eslint-plugin-promise';
44
import tseslint from 'typescript-eslint';
55

@@ -23,15 +23,15 @@ export function prepareConfig() {
2323
linterOptions: { reportUnusedDisableDirectives: true },
2424
settings: {
2525
...importPlugin.configs.typescript.settings,
26-
'import/extensions': allImportExtensions,
27-
'import/parsers': { '@typescript-eslint/parser': allImportExtensions },
28-
'import/resolver': {
26+
'import-x/extensions': allImportExtensions,
27+
'import-x/parsers': { '@typescript-eslint/parser': allImportExtensions },
28+
'import-x/resolver': {
2929
node: { extensions: allImportExtensions },
3030
typescript: true
3131
}
3232
},
3333
plugins: {
34-
import: importPlugin,
34+
'import-x': importPlugin,
3535
promise
3636
},
3737
rules: {
@@ -199,28 +199,26 @@ export function prepareConfig() {
199199
'valid-typeof': ['error', { requireStringLiterals: true }],
200200
'yoda': ['error', 'never', { exceptRange: true }],
201201

202-
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
203-
'import/default': 'error',
204-
'import/export': 'error',
205-
'import/first': 'error',
206-
'import/namespace': 'error',
207-
'import/newline-after-import': [
202+
...importPlugin.configs.recommended.rules,
203+
'import-x/no-unresolved': 'off',
204+
'import-x/named': 'off',
205+
'import-x/consistent-type-specifier-style': ['error', 'prefer-top-level'],
206+
'import-x/first': 'error',
207+
'import-x/newline-after-import': [
208208
'error',
209209
{
210210
considerComments: true,
211211
count: 2
212212
}
213213
],
214-
'import/no-anonymous-default-export': 'error',
215-
'import/no-cycle': 'error',
216-
'import/no-deprecated': 'warn',
217-
'import/no-duplicates': 'error',
218-
'import/no-empty-named-blocks': 'error',
219-
'import/no-mutable-exports': 'error',
220-
'import/no-named-as-default': 'warn',
221-
'import/no-named-as-default-member': 'warn',
222-
'import/no-self-import': 'error',
223-
'import/order': [
214+
'import-x/no-anonymous-default-export': 'error',
215+
'import-x/no-cycle': 'error',
216+
'import-x/no-deprecated': 'warn',
217+
'import-x/no-duplicates': 'error',
218+
'import-x/no-empty-named-blocks': 'error',
219+
'import-x/no-mutable-exports': 'error',
220+
'import-x/no-self-import': 'error',
221+
'import-x/order': [
224222
'error',
225223
{
226224
'groups': [
@@ -443,7 +441,7 @@ export function prepareConfig() {
443441
'@typescript-eslint/no-floating-promises': 'error',
444442
'@typescript-eslint/consistent-return': 'error',
445443
'@typescript-eslint/no-implied-eval': 'error',
446-
// import/consistent-type-specifier-style makes sure we don't inline `type` modifier
444+
// import-x/consistent-type-specifier-style makes sure we don't inline `type` modifier
447445
'@typescript-eslint/no-import-type-side-effects': 'off',
448446
'@typescript-eslint/no-invalid-this': 'error',
449447
'@typescript-eslint/no-invalid-void-type': 'error',

eslint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default tseslint.config(
1616
rules: {
1717
'no-extra-parens': 'off',
1818
'no-magic-numbers': 'off',
19-
'import/no-named-as-default-member': 'off',
19+
'import-x/no-named-as-default-member': 'off',
2020
'@stylistic/quote-props': ['error', 'consistent-as-needed']
2121
}
2222
},

import-types.d.ts

-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
declare module 'eslint-plugin-import' {
2-
import type { TSESLint } from '@typescript-eslint/utils';
3-
import type { Rule } from 'eslint';
4-
5-
6-
export const configs: Record<'recommended' | 'error' | 'warnings' | 'react' | 'react-native' | 'electron' | 'typescript',
7-
TSESLint.ClassicConfig.Config>;
8-
export const rules: Record<string, Rule.RuleModule>;
9-
}
10-
111
declare module 'eslint-plugin-promise' {
122
import type { TSESLint } from '@typescript-eslint/utils';
133
import type { Rule } from 'eslint';

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@stylistic/eslint-plugin": "~2.3.0",
1717
"eslint-import-resolver-typescript": "~3.6.1",
1818
"eslint-plugin-cypress": "~3.3.0",
19-
"eslint-plugin-import": "~2.29.1",
19+
"eslint-plugin-import-x": "~0.5.1",
2020
"eslint-plugin-jest": "~28.6.0",
2121
"eslint-plugin-jest-dom": "~5.4.0",
2222
"eslint-plugin-jest-formatting": "~3.1.0",

yarn.lock

+21-72
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,6 @@
915915
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
916916
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
917917

918-
"@types/json5@^0.0.29":
919-
version "0.0.29"
920-
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
921-
integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==
922-
923918
"@types/mdast@^3.0.0":
924919
version "3.0.15"
925920
resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-3.0.15.tgz#49c524a263f30ffa28b71ae282f813ed000ab9f5"
@@ -1082,7 +1077,7 @@
10821077
semver "^7.6.0"
10831078
ts-api-utils "^1.3.0"
10841079

1085-
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^6.0.0 || ^7.0.0", "@typescript-eslint/utils@^7.12.0":
1080+
"@typescript-eslint/[email protected]", "@typescript-eslint/utils@^6.0.0 || ^7.0.0", "@typescript-eslint/utils@^7.12.0", "@typescript-eslint/utils@^7.4.0":
10861081
version "7.14.1"
10871082
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.14.1.tgz#3307b8226f99103dca2133d0ebcae38419d82c9d"
10881083
integrity sha512-CMmVVELns3nak3cpJhZosDkm63n+DwBlDX8g0k4QUa9BMnF+lH2lr3d130M1Zt1xxmB3LLk3NV7KQCq86ZBBhQ==
@@ -1263,7 +1258,7 @@ array-ify@^1.0.0:
12631258
resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece"
12641259
integrity sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==
12651260

1266-
array-includes@^3.1.6, array-includes@^3.1.7, array-includes@^3.1.8:
1261+
array-includes@^3.1.6, array-includes@^3.1.8:
12671262
version "3.1.8"
12681263
resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.8.tgz#5e370cbe172fdd5dd6530c1d4aadda25281ba97d"
12691264
integrity sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==
@@ -1292,19 +1287,7 @@ array.prototype.findlast@^1.2.5:
12921287
es-object-atoms "^1.0.0"
12931288
es-shim-unscopables "^1.0.2"
12941289

1295-
array.prototype.findlastindex@^1.2.3:
1296-
version "1.2.5"
1297-
resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz#8c35a755c72908719453f87145ca011e39334d0d"
1298-
integrity sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==
1299-
dependencies:
1300-
call-bind "^1.0.7"
1301-
define-properties "^1.2.1"
1302-
es-abstract "^1.23.2"
1303-
es-errors "^1.3.0"
1304-
es-object-atoms "^1.0.0"
1305-
es-shim-unscopables "^1.0.2"
1306-
1307-
array.prototype.flat@^1.3.1, array.prototype.flat@^1.3.2:
1290+
array.prototype.flat@^1.3.1:
13081291
version "1.3.2"
13091292
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18"
13101293
integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==
@@ -2460,7 +2443,7 @@ eslint-mdx@^3.1.5:
24602443
uvu "^0.5.6"
24612444
vfile "^6.0.1"
24622445

2463-
eslint-module-utils@^2.7.4, eslint-module-utils@^2.8.0:
2446+
eslint-module-utils@^2.7.4:
24642447
version "2.8.1"
24652448
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz#52f2404300c3bd33deece9d7372fb337cc1d7c34"
24662449
integrity sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==
@@ -2483,28 +2466,20 @@ eslint-plugin-es-x@^7.5.0:
24832466
"@eslint-community/regexpp" "^4.6.0"
24842467
eslint-compat-utils "^0.5.0"
24852468

2486-
eslint-plugin-import@~2.29.1:
2487-
version "2.29.1"
2488-
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz#d45b37b5ef5901d639c15270d74d46d161150643"
2489-
integrity sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==
2469+
eslint-plugin-import-x@~0.5.1:
2470+
version "0.5.1"
2471+
resolved "https://registry.yarnpkg.com/eslint-plugin-import-x/-/eslint-plugin-import-x-0.5.1.tgz#0781096ee737ccfc0f9a028d286839bfa53b1080"
2472+
integrity sha512-2JK8bbFOLes+gG6tgdnM8safCxMAj4u2wjX8X1BRFPfnY7Ct2hFYESoIcVwABX/DDcdpQFLGtKmzbNEWJZD9iQ==
24902473
dependencies:
2491-
array-includes "^3.1.7"
2492-
array.prototype.findlastindex "^1.2.3"
2493-
array.prototype.flat "^1.3.2"
2494-
array.prototype.flatmap "^1.3.2"
2495-
debug "^3.2.7"
2496-
doctrine "^2.1.0"
2474+
"@typescript-eslint/utils" "^7.4.0"
2475+
debug "^4.3.4"
2476+
doctrine "^3.0.0"
24972477
eslint-import-resolver-node "^0.3.9"
2498-
eslint-module-utils "^2.8.0"
2499-
hasown "^2.0.0"
2500-
is-core-module "^2.13.1"
2478+
get-tsconfig "^4.7.3"
25012479
is-glob "^4.0.3"
2502-
minimatch "^3.1.2"
2503-
object.fromentries "^2.0.7"
2504-
object.groupby "^1.0.1"
2505-
object.values "^1.1.7"
2506-
semver "^6.3.1"
2507-
tsconfig-paths "^3.15.0"
2480+
minimatch "^9.0.3"
2481+
semver "^7.6.0"
2482+
tslib "^2.6.2"
25082483

25092484
eslint-plugin-jest-dom@~5.4.0:
25102485
version "5.4.0"
@@ -3034,7 +3009,7 @@ get-symbol-description@^1.0.2:
30343009
es-errors "^1.3.0"
30353010
get-intrinsic "^1.2.4"
30363011

3037-
get-tsconfig@^4.5.0, get-tsconfig@^4.7.0:
3012+
get-tsconfig@^4.5.0, get-tsconfig@^4.7.0, get-tsconfig@^4.7.3:
30383013
version "4.7.5"
30393014
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.5.tgz#5e012498579e9a6947511ed0cd403272c7acbbaf"
30403015
integrity sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==
@@ -3440,7 +3415,7 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7:
34403415
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055"
34413416
integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==
34423417

3443-
is-core-module@^2.11.0, is-core-module@^2.13.0, is-core-module@^2.13.1, is-core-module@^2.5.0:
3418+
is-core-module@^2.11.0, is-core-module@^2.13.0, is-core-module@^2.5.0:
34443419
version "2.13.1"
34453420
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
34463421
integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==
@@ -4175,13 +4150,6 @@ json-stringify-safe@^5.0.1:
41754150
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
41764151
integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==
41774152

4178-
json5@^1.0.2:
4179-
version "1.0.2"
4180-
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
4181-
integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==
4182-
dependencies:
4183-
minimist "^1.2.0"
4184-
41854153
json5@^2.2.3:
41864154
version "2.2.3"
41874155
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
@@ -4879,7 +4847,7 @@ minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
48794847
dependencies:
48804848
brace-expansion "^1.1.7"
48814849

4882-
minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.4:
4850+
minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.3, minimatch@^9.0.4:
48834851
version "9.0.4"
48844852
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51"
48854853
integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==
@@ -4895,7 +4863,7 @@ [email protected]:
48954863
is-plain-obj "^1.1.0"
48964864
kind-of "^6.0.3"
48974865

4898-
minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6:
4866+
minimist@^1.2.5:
48994867
version "1.2.8"
49004868
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
49014869
integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==
@@ -5026,7 +4994,7 @@ object.entries@^1.1.8:
50264994
define-properties "^1.2.1"
50274995
es-object-atoms "^1.0.0"
50284996

5029-
object.fromentries@^2.0.7, object.fromentries@^2.0.8:
4997+
object.fromentries@^2.0.8:
50304998
version "2.0.8"
50314999
resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.8.tgz#f7195d8a9b97bd95cbc1999ea939ecd1a2b00c65"
50325000
integrity sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==
@@ -5036,15 +5004,6 @@ object.fromentries@^2.0.7, object.fromentries@^2.0.8:
50365004
es-abstract "^1.23.2"
50375005
es-object-atoms "^1.0.0"
50385006

5039-
object.groupby@^1.0.1:
5040-
version "1.0.3"
5041-
resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.3.tgz#9b125c36238129f6f7b61954a1e7176148d5002e"
5042-
integrity sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==
5043-
dependencies:
5044-
call-bind "^1.0.7"
5045-
define-properties "^1.2.1"
5046-
es-abstract "^1.23.2"
5047-
50485007
object.hasown@^1.1.4:
50495008
version "1.1.4"
50505009
resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.4.tgz#e270ae377e4c120cdcb7656ce66884a6218283dc"
@@ -5054,7 +5013,7 @@ object.hasown@^1.1.4:
50545013
es-abstract "^1.23.2"
50555014
es-object-atoms "^1.0.0"
50565015

5057-
object.values@^1.1.6, object.values@^1.1.7, object.values@^1.2.0:
5016+
object.values@^1.1.6, object.values@^1.2.0:
50585017
version "1.2.0"
50595018
resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.2.0.tgz#65405a9d92cee68ac2d303002e0b8470a4d9ab1b"
50605019
integrity sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==
@@ -6152,16 +6111,6 @@ ts-node@^10.9.2:
61526111
v8-compile-cache-lib "^3.0.1"
61536112
yn "3.1.1"
61546113

6155-
tsconfig-paths@^3.15.0:
6156-
version "3.15.0"
6157-
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz#5299ec605e55b1abb23ec939ef15edaf483070d4"
6158-
integrity sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==
6159-
dependencies:
6160-
"@types/json5" "^0.0.29"
6161-
json5 "^1.0.2"
6162-
minimist "^1.2.6"
6163-
strip-bom "^3.0.0"
6164-
61656114
tslib@^1.8.1:
61666115
version "1.14.1"
61676116
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"

0 commit comments

Comments
 (0)