Skip to content

Commit 93c98d0

Browse files
authored
Fix no-extraneous-dependencies rule operation (#1857)
Workaround for the related issues: - un-ts/eslint-plugin-import-x#91 - import-js/eslint-import-resolver-typescript#293
1 parent c6ecdd7 commit 93c98d0

File tree

3 files changed

+64
-14
lines changed

3 files changed

+64
-14
lines changed

eslint.config.js

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ import tsPlugin from "typescript-eslint";
44
import prettierOverrides from "eslint-config-prettier";
55
import prettierRules from "eslint-plugin-prettier/recommended";
66
import unicornPlugin from "eslint-plugin-unicorn";
7-
import importPlugin from "eslint-plugin-import-x";
7+
import importPlugin from "eslint-plugin-import";
88

99
export default [
1010
{
1111
languageOptions: { globals: globals.node },
1212
plugins: {
1313
unicorn: unicornPlugin,
14-
"import-x": importPlugin,
14+
import: importPlugin,
15+
},
16+
settings: {
17+
// "import-x" plugin installed as "import", in order to suppress the warning from the typescript resolver
18+
// @link https://github.com/import-js/eslint-import-resolver-typescript/issues/293
19+
"import-x/resolver": { typescript: true, node: true },
1520
},
1621
},
1722
jsPlugin.configs.recommended,
@@ -30,16 +35,16 @@ export default [
3035
{
3136
rules: {
3237
"unicorn/prefer-node-protocol": "error",
33-
"import-x/named": "error",
34-
"import-x/export": "error",
35-
"import-x/no-duplicates": "warn",
38+
"import/named": "error",
39+
"import/export": "error",
40+
"import/no-duplicates": "warn",
3641
},
3742
},
3843
// For the sources
3944
{
4045
files: ["src/*.ts"],
4146
rules: {
42-
"import-x/no-extraneous-dependencies": "error",
47+
"import/no-extraneous-dependencies": "error",
4348
"@typescript-eslint/no-explicit-any": "off", // @todo remove
4449
"@typescript-eslint/no-empty-object-type": "off", // @todo narrow
4550
},
@@ -64,7 +69,7 @@ export default [
6469
files: ["tests/*/quick-start.ts", "example/example.client.ts"],
6570
rules: {
6671
"prettier/prettier": "off",
67-
"import-x/no-duplicates": "off",
72+
"import/no-duplicates": "off",
6873
"@typescript-eslint/no-explicit-any": "off",
6974
"@typescript-eslint/no-empty-object-type": [
7075
"error",

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@
140140
"cors": "^2.8.5",
141141
"eslint": "^9.3.0",
142142
"eslint-config-prettier": "^9.1.0",
143-
"eslint-plugin-import-x": "^0.5.0",
143+
"eslint-import-resolver-typescript": "^3.6.1",
144+
"eslint-plugin-import": "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-0.5.2.tgz",
144145
"eslint-plugin-prettier": "^5.1.3",
145146
"eslint-plugin-unicorn": "^54.0.0",
146147
"express": "^4.19.2",

yarn.lock

+50-6
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,14 @@ encodeurl@~1.0.2:
14711471
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
14721472
integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==
14731473

1474+
enhanced-resolve@^5.12.0:
1475+
version "5.17.0"
1476+
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.0.tgz#d037603789dd9555b89aaec7eb78845c49089bc5"
1477+
integrity sha512-dwDPwZL0dmye8Txp2gzFmA6sxALaSvdRDjPH0viLcKrtlOL3tw62nWWweVD1SdILDTJrbrL6tdWVN58Wo6U3eA==
1478+
dependencies:
1479+
graceful-fs "^4.2.4"
1480+
tapable "^2.2.0"
1481+
14741482
error-ex@^1.3.1:
14751483
version "1.3.2"
14761484
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@@ -1567,10 +1575,29 @@ eslint-import-resolver-node@^0.3.9:
15671575
is-core-module "^2.13.0"
15681576
resolve "^1.22.4"
15691577

1570-
eslint-plugin-import-x@^0.5.0:
1578+
eslint-import-resolver-typescript@^3.6.1:
1579+
version "3.6.1"
1580+
resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz#7b983680edd3f1c5bce1a5829ae0bc2d57fe9efa"
1581+
integrity sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==
1582+
dependencies:
1583+
debug "^4.3.4"
1584+
enhanced-resolve "^5.12.0"
1585+
eslint-module-utils "^2.7.4"
1586+
fast-glob "^3.3.1"
1587+
get-tsconfig "^4.5.0"
1588+
is-core-module "^2.11.0"
1589+
is-glob "^4.0.3"
1590+
1591+
eslint-module-utils@^2.7.4:
1592+
version "2.8.1"
1593+
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz#52f2404300c3bd33deece9d7372fb337cc1d7c34"
1594+
integrity sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==
1595+
dependencies:
1596+
debug "^3.2.7"
1597+
1598+
"eslint-plugin-import@https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-0.5.2.tgz":
15711599
version "0.5.2"
1572-
resolved "https://registry.yarnpkg.com/eslint-plugin-import-x/-/eslint-plugin-import-x-0.5.2.tgz#a2d23b8c3ec2a049772902ba4addc9f3ee549e50"
1573-
integrity sha512-6f1YMmg3PdLwfiJDYnCRPfh67zJKbwbOKL99l6xGZDmIFkMht/4xyudafGEcDOmDlgp36e41W4RXDfOn7+pGRg==
1600+
resolved "https://registry.npmjs.org/eslint-plugin-import-x/-/eslint-plugin-import-x-0.5.2.tgz#a2d23b8c3ec2a049772902ba4addc9f3ee549e50"
15741601
dependencies:
15751602
"@typescript-eslint/utils" "^7.4.0"
15761603
debug "^4.3.4"
@@ -1804,7 +1831,7 @@ fast-diff@^1.1.2:
18041831
resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0"
18051832
integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==
18061833

1807-
fast-glob@^3.2.9:
1834+
fast-glob@^3.2.9, fast-glob@^3.3.1:
18081835
version "3.3.2"
18091836
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
18101837
integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==
@@ -1962,7 +1989,7 @@ get-stream@^8.0.1:
19621989
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2"
19631990
integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==
19641991

1965-
get-tsconfig@^4.7.3, get-tsconfig@^4.7.5:
1992+
get-tsconfig@^4.5.0, get-tsconfig@^4.7.3, get-tsconfig@^4.7.5:
19661993
version "4.7.5"
19671994
resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.5.tgz#5e012498579e9a6947511ed0cd403272c7acbbaf"
19681995
integrity sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==
@@ -2040,6 +2067,11 @@ gopd@^1.0.1:
20402067
dependencies:
20412068
get-intrinsic "^1.1.3"
20422069

2070+
graceful-fs@^4.2.4:
2071+
version "4.2.11"
2072+
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
2073+
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
2074+
20432075
graphemer@^1.4.0:
20442076
version "1.4.0"
20452077
resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
@@ -2077,7 +2109,7 @@ has-symbols@^1.0.3:
20772109
resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8"
20782110
integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==
20792111

2080-
hasown@^2.0.0:
2112+
hasown@^2.0.0, hasown@^2.0.2:
20812113
version "2.0.2"
20822114
resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003"
20832115
integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==
@@ -2204,6 +2236,13 @@ is-builtin-module@^3.2.1:
22042236
dependencies:
22052237
builtin-modules "^3.3.0"
22062238

2239+
is-core-module@^2.11.0:
2240+
version "2.14.0"
2241+
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.14.0.tgz#43b8ef9f46a6a08888db67b1ffd4ec9e3dfd59d1"
2242+
integrity sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==
2243+
dependencies:
2244+
hasown "^2.0.2"
2245+
22072246
is-core-module@^2.13.0, is-core-module@^2.5.0:
22082247
version "2.13.1"
22092248
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384"
@@ -3541,6 +3580,11 @@ synckit@^0.8.6:
35413580
"@pkgr/core" "^0.1.0"
35423581
tslib "^2.6.2"
35433582

3583+
tapable@^2.2.0:
3584+
version "2.2.1"
3585+
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0"
3586+
integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==
3587+
35443588
test-exclude@^6.0.0:
35453589
version "6.0.0"
35463590
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e"

0 commit comments

Comments
 (0)