@plugjs/eslint-plugin 0.2.14 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/eslint-import-resolver-typescript.cjs +3 -2
- package/bundles/eslint-plugin-import-x.cjs +910 -422
- package/bundles/stylistic-eslint-plugin.cjs +13689 -15196
- package/package.json +13 -11
|
@@ -25,6 +25,140 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
|
|
28
|
+
// node_modules/eslint-plugin-import-x/package.json
|
|
29
|
+
var require_package = __commonJS({
|
|
30
|
+
"node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
|
|
31
|
+
module2.exports = {
|
|
32
|
+
name: "eslint-plugin-import-x",
|
|
33
|
+
version: "4.2.1",
|
|
34
|
+
description: "Import with sanity.",
|
|
35
|
+
repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
|
|
36
|
+
author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
|
|
37
|
+
license: "MIT",
|
|
38
|
+
packageManager: "yarn@1.22.19",
|
|
39
|
+
engines: {
|
|
40
|
+
node: "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
41
|
+
},
|
|
42
|
+
main: "lib/index.js",
|
|
43
|
+
exports: {
|
|
44
|
+
".": "./lib/index.js",
|
|
45
|
+
"./package.json": "./package.json",
|
|
46
|
+
"./*": "./lib/*"
|
|
47
|
+
},
|
|
48
|
+
files: [
|
|
49
|
+
"lib",
|
|
50
|
+
"!lib/*.tsbuildinfo"
|
|
51
|
+
],
|
|
52
|
+
keywords: [
|
|
53
|
+
"eslint",
|
|
54
|
+
"eslintplugin",
|
|
55
|
+
"eslint-plugin",
|
|
56
|
+
"es6",
|
|
57
|
+
"jsnext",
|
|
58
|
+
"modules",
|
|
59
|
+
"import",
|
|
60
|
+
"export"
|
|
61
|
+
],
|
|
62
|
+
scripts: {
|
|
63
|
+
build: "tsc -p src",
|
|
64
|
+
clean: "rimraf lib",
|
|
65
|
+
"codesandbox:install": "yarn --ignore-engines",
|
|
66
|
+
lint: "run-p lint:*",
|
|
67
|
+
"lint:docs": "yarn update:eslint-docs --check",
|
|
68
|
+
"lint:es": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --cache",
|
|
69
|
+
"lint:tsc": "tsc -p tsconfig.base.json --noEmit",
|
|
70
|
+
prepare: "patch-package",
|
|
71
|
+
release: "changeset publish",
|
|
72
|
+
test: "jest",
|
|
73
|
+
"test-compiled": "yarn build && cross-env TEST_COMPILED=1 jest",
|
|
74
|
+
"update:eslint-docs": "eslint-doc-generator --rule-doc-title-format prefix-name --rule-doc-section-options false --rule-list-split meta.docs.category --ignore-config stage-0 --config-emoji recommended,\u2611\uFE0F",
|
|
75
|
+
watch: "yarn test --watch"
|
|
76
|
+
},
|
|
77
|
+
peerDependencies: {
|
|
78
|
+
eslint: "^8.57.0 || ^9.0.0"
|
|
79
|
+
},
|
|
80
|
+
dependencies: {
|
|
81
|
+
"@typescript-eslint/utils": "^8.1.0",
|
|
82
|
+
debug: "^4.3.4",
|
|
83
|
+
doctrine: "^3.0.0",
|
|
84
|
+
"eslint-import-resolver-node": "^0.3.9",
|
|
85
|
+
"get-tsconfig": "^4.7.3",
|
|
86
|
+
"is-glob": "^4.0.3",
|
|
87
|
+
minimatch: "^9.0.3",
|
|
88
|
+
semver: "^7.6.3",
|
|
89
|
+
"stable-hash": "^0.0.4",
|
|
90
|
+
tslib: "^2.6.3"
|
|
91
|
+
},
|
|
92
|
+
devDependencies: {
|
|
93
|
+
"@1stg/prettier-config": "^4.0.1",
|
|
94
|
+
"@1stg/tsconfig": "^2.3.3",
|
|
95
|
+
"@angular-eslint/template-parser": "^17.5.2",
|
|
96
|
+
"@babel/core": "^7.25.2",
|
|
97
|
+
"@babel/eslint-parser": "^7.25.1",
|
|
98
|
+
"@babel/plugin-proposal-decorators": "^7.24.7",
|
|
99
|
+
"@babel/plugin-proposal-export-default-from": "^7.24.7",
|
|
100
|
+
"@babel/preset-env": "^7.25.3",
|
|
101
|
+
"@babel/preset-flow": "^7.24.7",
|
|
102
|
+
"@babel/preset-react": "^7.24.7",
|
|
103
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
104
|
+
"@babel/register": "^7.24.6",
|
|
105
|
+
"@changesets/changelog-github": "^0.5.0",
|
|
106
|
+
"@changesets/cli": "^2.27.1",
|
|
107
|
+
"@eslint/import-test-order-redirect-scoped": "link:./test/fixtures/order-redirect-scoped",
|
|
108
|
+
"@swc-node/jest": "^1.8.12",
|
|
109
|
+
"@swc/core": "^1.7.6",
|
|
110
|
+
"@swc/helpers": "^0.5.12",
|
|
111
|
+
"@test-scope/some-module": "link:./test/fixtures/symlinked-module",
|
|
112
|
+
"@total-typescript/ts-reset": "^0.5.1",
|
|
113
|
+
"@types/debug": "^4.1.12",
|
|
114
|
+
"@types/doctrine": "^0.0.9",
|
|
115
|
+
"@types/eslint": "^9.6.0",
|
|
116
|
+
"@types/eslint8.56": "npm:@types/eslint@^8.56.11",
|
|
117
|
+
"@types/eslint9": "npm:@types/eslint@^9.6.0",
|
|
118
|
+
"@types/is-glob": "^4.0.4",
|
|
119
|
+
"@types/jest": "^29.5.12",
|
|
120
|
+
"@types/json-schema": "^7.0.15",
|
|
121
|
+
"@types/klaw-sync": "^6.0.5",
|
|
122
|
+
"@types/node": "^20.11.30",
|
|
123
|
+
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
124
|
+
"@typescript-eslint/parser": "^8.1.0",
|
|
125
|
+
"@typescript-eslint/rule-tester": "^8.1.0",
|
|
126
|
+
"@unts/patch-package": "^8.0.0",
|
|
127
|
+
"cross-env": "^7.0.3",
|
|
128
|
+
"enhanced-resolve": "^5.16.0",
|
|
129
|
+
escope: "^4.0.0",
|
|
130
|
+
eslint: "^9.9.0",
|
|
131
|
+
"eslint-config-prettier": "^9.1.0",
|
|
132
|
+
"eslint-doc-generator": "^1.7.1",
|
|
133
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
134
|
+
"eslint-import-resolver-webpack": "^0.13.8",
|
|
135
|
+
"eslint-import-test-order-redirect": "link:./test/fixtures/order-redirect",
|
|
136
|
+
"eslint-plugin-eslint-plugin": "^5.4.1",
|
|
137
|
+
"eslint-plugin-import-x": "link:.",
|
|
138
|
+
"eslint-plugin-jest": "^27.9.0",
|
|
139
|
+
"eslint-plugin-json": "^3.1.0",
|
|
140
|
+
"eslint-plugin-n": "^16.6.2",
|
|
141
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
142
|
+
"eslint-plugin-unicorn": "^51.0.1",
|
|
143
|
+
"eslint8.56": "npm:eslint@^8.56.0",
|
|
144
|
+
eslint9: "npm:eslint@^9.8.0",
|
|
145
|
+
"hermes-eslint": "^0.23.1",
|
|
146
|
+
jest: "^29.7.0",
|
|
147
|
+
"klaw-sync": "^6.0.0",
|
|
148
|
+
"npm-run-all2": "^6.1.2",
|
|
149
|
+
prettier: "^3.2.5",
|
|
150
|
+
redux: "^5.0.1",
|
|
151
|
+
rimraf: "^5.0.10",
|
|
152
|
+
svelte: "^4.2.12",
|
|
153
|
+
"ts-node": "^10.9.2",
|
|
154
|
+
"type-fest": "^4.14.0",
|
|
155
|
+
typescript: "^5.5.4",
|
|
156
|
+
zod: "^3.23.8"
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
28
162
|
// node_modules/eslint-plugin-import-x/lib/config/electron.js
|
|
29
163
|
var require_electron = __commonJS({
|
|
30
164
|
"node_modules/eslint-plugin-import-x/lib/config/electron.js"(exports2, module2) {
|
|
@@ -54,17 +188,170 @@ var require_errors = __commonJS({
|
|
|
54
188
|
}
|
|
55
189
|
});
|
|
56
190
|
|
|
57
|
-
// node_modules/eslint-plugin-import-x/lib/config/
|
|
191
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/electron.js
|
|
192
|
+
var require_electron2 = __commonJS({
|
|
193
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/electron.js"(exports2) {
|
|
194
|
+
"use strict";
|
|
195
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
196
|
+
exports2.default = {
|
|
197
|
+
settings: {
|
|
198
|
+
"import-x/core-modules": ["electron"]
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/errors.js
|
|
205
|
+
var require_errors2 = __commonJS({
|
|
206
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/errors.js"(exports2) {
|
|
207
|
+
"use strict";
|
|
208
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
209
|
+
exports2.default = {
|
|
210
|
+
rules: {
|
|
211
|
+
"import-x/no-unresolved": 2,
|
|
212
|
+
"import-x/named": 2,
|
|
213
|
+
"import-x/namespace": 2,
|
|
214
|
+
"import-x/default": 2,
|
|
215
|
+
"import-x/export": 2
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/react.js
|
|
58
222
|
var require_react = __commonJS({
|
|
223
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/react.js"(exports2) {
|
|
224
|
+
"use strict";
|
|
225
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
226
|
+
exports2.default = {
|
|
227
|
+
settings: {
|
|
228
|
+
"import-x/extensions": [".js", ".jsx", ".mjs", ".cjs"]
|
|
229
|
+
},
|
|
230
|
+
languageOptions: {
|
|
231
|
+
parserOptions: {
|
|
232
|
+
ecmaFeatures: {
|
|
233
|
+
jsx: true
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/react-native.js
|
|
242
|
+
var require_react_native = __commonJS({
|
|
243
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/react-native.js"(exports2) {
|
|
244
|
+
"use strict";
|
|
245
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
246
|
+
exports2.default = {
|
|
247
|
+
settings: {
|
|
248
|
+
"import-x/resolver": {
|
|
249
|
+
node: {
|
|
250
|
+
extensions: [".js", ".web.js", ".ios.js", ".android.js"]
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/recommended.js
|
|
259
|
+
var require_recommended = __commonJS({
|
|
260
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/recommended.js"(exports2) {
|
|
261
|
+
"use strict";
|
|
262
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
263
|
+
exports2.default = {
|
|
264
|
+
rules: {
|
|
265
|
+
"import-x/no-unresolved": "error",
|
|
266
|
+
"import-x/named": "error",
|
|
267
|
+
"import-x/namespace": "error",
|
|
268
|
+
"import-x/default": "error",
|
|
269
|
+
"import-x/export": "error",
|
|
270
|
+
"import-x/no-named-as-default": "warn",
|
|
271
|
+
"import-x/no-named-as-default-member": "warn",
|
|
272
|
+
"import-x/no-duplicates": "warn"
|
|
273
|
+
},
|
|
274
|
+
languageOptions: {
|
|
275
|
+
ecmaVersion: 2018,
|
|
276
|
+
sourceType: "module"
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/stage-0.js
|
|
283
|
+
var require_stage_0 = __commonJS({
|
|
284
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/stage-0.js"(exports2) {
|
|
285
|
+
"use strict";
|
|
286
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
287
|
+
exports2.default = {
|
|
288
|
+
rules: {
|
|
289
|
+
"import-x/no-deprecated": 1
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/typescript.js
|
|
296
|
+
var require_typescript = __commonJS({
|
|
297
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/typescript.js"(exports2) {
|
|
298
|
+
"use strict";
|
|
299
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
300
|
+
var typeScriptExtensions = [".ts", ".tsx", ".cts", ".mts"];
|
|
301
|
+
var allExtensions = [
|
|
302
|
+
...typeScriptExtensions,
|
|
303
|
+
".js",
|
|
304
|
+
".jsx",
|
|
305
|
+
".cjs",
|
|
306
|
+
".mjs"
|
|
307
|
+
];
|
|
308
|
+
exports2.default = {
|
|
309
|
+
settings: {
|
|
310
|
+
"import-x/extensions": allExtensions,
|
|
311
|
+
"import-x/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
312
|
+
"import-x/parsers": {
|
|
313
|
+
"@typescript-eslint/parser": [...typeScriptExtensions]
|
|
314
|
+
},
|
|
315
|
+
"import-x/resolver": {
|
|
316
|
+
typescript: true
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
rules: {
|
|
320
|
+
"import-x/named": "off"
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// node_modules/eslint-plugin-import-x/lib/config/flat/warnings.js
|
|
327
|
+
var require_warnings = __commonJS({
|
|
328
|
+
"node_modules/eslint-plugin-import-x/lib/config/flat/warnings.js"(exports2) {
|
|
329
|
+
"use strict";
|
|
330
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
331
|
+
exports2.default = {
|
|
332
|
+
rules: {
|
|
333
|
+
"import-x/no-named-as-default": 1,
|
|
334
|
+
"import-x/no-named-as-default-member": 1,
|
|
335
|
+
"import-x/no-rename-default": 1,
|
|
336
|
+
"import-x/no-duplicates": 1
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// node_modules/eslint-plugin-import-x/lib/config/react.js
|
|
343
|
+
var require_react2 = __commonJS({
|
|
59
344
|
"node_modules/eslint-plugin-import-x/lib/config/react.js"(exports2, module2) {
|
|
60
345
|
"use strict";
|
|
61
346
|
module2.exports = {
|
|
62
347
|
settings: {
|
|
63
348
|
"import-x/extensions": [".js", ".jsx"]
|
|
64
349
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
350
|
+
languageOptions: {
|
|
351
|
+
parserOptions: {
|
|
352
|
+
ecmaFeatures: {
|
|
353
|
+
jsx: true
|
|
354
|
+
}
|
|
68
355
|
}
|
|
69
356
|
}
|
|
70
357
|
};
|
|
@@ -72,7 +359,7 @@ var require_react = __commonJS({
|
|
|
72
359
|
});
|
|
73
360
|
|
|
74
361
|
// node_modules/eslint-plugin-import-x/lib/config/react-native.js
|
|
75
|
-
var
|
|
362
|
+
var require_react_native2 = __commonJS({
|
|
76
363
|
"node_modules/eslint-plugin-import-x/lib/config/react-native.js"(exports2, module2) {
|
|
77
364
|
"use strict";
|
|
78
365
|
module2.exports = {
|
|
@@ -88,7 +375,7 @@ var require_react_native = __commonJS({
|
|
|
88
375
|
});
|
|
89
376
|
|
|
90
377
|
// node_modules/eslint-plugin-import-x/lib/config/recommended.js
|
|
91
|
-
var
|
|
378
|
+
var require_recommended2 = __commonJS({
|
|
92
379
|
"node_modules/eslint-plugin-import-x/lib/config/recommended.js"(exports2, module2) {
|
|
93
380
|
"use strict";
|
|
94
381
|
module2.exports = {
|
|
@@ -112,7 +399,7 @@ var require_recommended = __commonJS({
|
|
|
112
399
|
});
|
|
113
400
|
|
|
114
401
|
// node_modules/eslint-plugin-import-x/lib/config/stage-0.js
|
|
115
|
-
var
|
|
402
|
+
var require_stage_02 = __commonJS({
|
|
116
403
|
"node_modules/eslint-plugin-import-x/lib/config/stage-0.js"(exports2, module2) {
|
|
117
404
|
"use strict";
|
|
118
405
|
module2.exports = {
|
|
@@ -125,22 +412,26 @@ var require_stage_0 = __commonJS({
|
|
|
125
412
|
});
|
|
126
413
|
|
|
127
414
|
// node_modules/eslint-plugin-import-x/lib/config/typescript.js
|
|
128
|
-
var
|
|
415
|
+
var require_typescript2 = __commonJS({
|
|
129
416
|
"node_modules/eslint-plugin-import-x/lib/config/typescript.js"(exports2, module2) {
|
|
130
417
|
"use strict";
|
|
131
|
-
var typeScriptExtensions = [".ts", ".tsx"];
|
|
132
|
-
var allExtensions = [
|
|
418
|
+
var typeScriptExtensions = [".ts", ".tsx", ".cts", ".mts"];
|
|
419
|
+
var allExtensions = [
|
|
420
|
+
...typeScriptExtensions,
|
|
421
|
+
".js",
|
|
422
|
+
".jsx",
|
|
423
|
+
".cjs",
|
|
424
|
+
".mjs"
|
|
425
|
+
];
|
|
133
426
|
module2.exports = {
|
|
134
427
|
settings: {
|
|
135
428
|
"import-x/extensions": allExtensions,
|
|
136
429
|
"import-x/external-module-folders": ["node_modules", "node_modules/@types"],
|
|
137
430
|
"import-x/parsers": {
|
|
138
|
-
"@typescript-eslint/parser": [...typeScriptExtensions
|
|
431
|
+
"@typescript-eslint/parser": [...typeScriptExtensions]
|
|
139
432
|
},
|
|
140
433
|
"import-x/resolver": {
|
|
141
|
-
|
|
142
|
-
extensions: allExtensions
|
|
143
|
-
}
|
|
434
|
+
typescript: true
|
|
144
435
|
}
|
|
145
436
|
},
|
|
146
437
|
rules: {
|
|
@@ -151,7 +442,7 @@ var require_typescript = __commonJS({
|
|
|
151
442
|
});
|
|
152
443
|
|
|
153
444
|
// node_modules/eslint-plugin-import-x/lib/config/warnings.js
|
|
154
|
-
var
|
|
445
|
+
var require_warnings2 = __commonJS({
|
|
155
446
|
"node_modules/eslint-plugin-import-x/lib/config/warnings.js"(exports2, module2) {
|
|
156
447
|
"use strict";
|
|
157
448
|
module2.exports = {
|
|
@@ -159,6 +450,7 @@ var require_warnings = __commonJS({
|
|
|
159
450
|
rules: {
|
|
160
451
|
"import-x/no-named-as-default": 1,
|
|
161
452
|
"import-x/no-named-as-default-member": 1,
|
|
453
|
+
"import-x/no-rename-default": 1,
|
|
162
454
|
"import-x/no-duplicates": 1
|
|
163
455
|
}
|
|
164
456
|
};
|
|
@@ -175,131 +467,6 @@ var require_constants = __commonJS({
|
|
|
175
467
|
}
|
|
176
468
|
});
|
|
177
469
|
|
|
178
|
-
// node_modules/eslint-plugin-import-x/package.json
|
|
179
|
-
var require_package = __commonJS({
|
|
180
|
-
"node_modules/eslint-plugin-import-x/package.json"(exports2, module2) {
|
|
181
|
-
module2.exports = {
|
|
182
|
-
name: "eslint-plugin-import-x",
|
|
183
|
-
version: "3.1.0",
|
|
184
|
-
description: "Import with sanity.",
|
|
185
|
-
repository: "git+https://github.com/un-ts/eslint-plugin-import-x",
|
|
186
|
-
author: "JounQin <admin@1stg.me> (https://www.1stG.me)",
|
|
187
|
-
license: "MIT",
|
|
188
|
-
packageManager: "yarn@1.22.19",
|
|
189
|
-
engines: {
|
|
190
|
-
node: ">=16"
|
|
191
|
-
},
|
|
192
|
-
main: "lib/index.js",
|
|
193
|
-
exports: {
|
|
194
|
-
".": "./lib/index.js",
|
|
195
|
-
"./package.json": "./package.json",
|
|
196
|
-
"./*": "./lib/*"
|
|
197
|
-
},
|
|
198
|
-
files: [
|
|
199
|
-
"lib",
|
|
200
|
-
"!lib/*.tsbuildinfo"
|
|
201
|
-
],
|
|
202
|
-
keywords: [
|
|
203
|
-
"eslint",
|
|
204
|
-
"eslintplugin",
|
|
205
|
-
"eslint-plugin",
|
|
206
|
-
"es6",
|
|
207
|
-
"jsnext",
|
|
208
|
-
"modules",
|
|
209
|
-
"import",
|
|
210
|
-
"export"
|
|
211
|
-
],
|
|
212
|
-
scripts: {
|
|
213
|
-
build: "tsc -p src",
|
|
214
|
-
clean: "rimraf lib",
|
|
215
|
-
"codesandbox:install": "yarn --ignore-engines",
|
|
216
|
-
lint: "run-p lint:*",
|
|
217
|
-
"lint:docs": "yarn update:eslint-docs --check",
|
|
218
|
-
"lint:es": "eslint . --cache",
|
|
219
|
-
"lint:tsc": "tsc -p tsconfig.base.json --noEmit",
|
|
220
|
-
prepare: "patch-package",
|
|
221
|
-
release: "changeset publish",
|
|
222
|
-
test: "jest",
|
|
223
|
-
"test-compiled": "yarn build && cross-env TEST_COMPILED=1 jest",
|
|
224
|
-
"update:eslint-docs": "eslint-doc-generator --rule-doc-title-format prefix-name --rule-doc-section-options false --rule-list-split meta.docs.category --ignore-config stage-0 --config-emoji recommended,\u2611\uFE0F",
|
|
225
|
-
watch: "yarn test --watch"
|
|
226
|
-
},
|
|
227
|
-
peerDependencies: {
|
|
228
|
-
eslint: "^8.56.0 || ^9.0.0-0"
|
|
229
|
-
},
|
|
230
|
-
dependencies: {
|
|
231
|
-
"@typescript-eslint/utils": "^7.4.0",
|
|
232
|
-
debug: "^4.3.4",
|
|
233
|
-
doctrine: "^3.0.0",
|
|
234
|
-
"eslint-import-resolver-node": "^0.3.9",
|
|
235
|
-
"get-tsconfig": "^4.7.3",
|
|
236
|
-
"is-glob": "^4.0.3",
|
|
237
|
-
minimatch: "^9.0.3",
|
|
238
|
-
semver: "^7.6.0",
|
|
239
|
-
"stable-hash": "^0.0.4",
|
|
240
|
-
tslib: "^2.6.2"
|
|
241
|
-
},
|
|
242
|
-
devDependencies: {
|
|
243
|
-
"@1stg/prettier-config": "^4.0.1",
|
|
244
|
-
"@1stg/tsconfig": "^2.3.3",
|
|
245
|
-
"@angular-eslint/template-parser": "^17.3.0",
|
|
246
|
-
"@babel/core": "^7.24.3",
|
|
247
|
-
"@babel/eslint-parser": "^7.24.1",
|
|
248
|
-
"@babel/plugin-proposal-decorators": "^7.24.1",
|
|
249
|
-
"@babel/plugin-proposal-export-default-from": "^7.24.1",
|
|
250
|
-
"@babel/preset-env": "^7.24.3",
|
|
251
|
-
"@babel/preset-flow": "^7.24.1",
|
|
252
|
-
"@babel/preset-react": "^7.24.1",
|
|
253
|
-
"@babel/preset-typescript": "^7.24.1",
|
|
254
|
-
"@babel/register": "^7.23.7",
|
|
255
|
-
"@changesets/changelog-github": "^0.5.0",
|
|
256
|
-
"@changesets/cli": "^2.27.1",
|
|
257
|
-
"@eslint/import-test-order-redirect-scoped": "link:./test/fixtures/order-redirect-scoped",
|
|
258
|
-
"@swc-node/jest": "^1.8.0",
|
|
259
|
-
"@swc/core": "^1.4.11",
|
|
260
|
-
"@swc/helpers": "^0.5.7",
|
|
261
|
-
"@test-scope/some-module": "link:./test/fixtures/symlinked-module",
|
|
262
|
-
"@total-typescript/ts-reset": "^0.5.1",
|
|
263
|
-
"@types/debug": "^4.1.12",
|
|
264
|
-
"@types/doctrine": "^0.0.9",
|
|
265
|
-
"@types/eslint": "^8.56.6",
|
|
266
|
-
"@types/is-glob": "^4.0.4",
|
|
267
|
-
"@types/jest": "^29.5.12",
|
|
268
|
-
"@types/json-schema": "^7.0.15",
|
|
269
|
-
"@types/node": "^20.11.30",
|
|
270
|
-
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
271
|
-
"@typescript-eslint/parser": "^7.4.0",
|
|
272
|
-
"@unts/patch-package": "^8.0.0",
|
|
273
|
-
"cross-env": "^7.0.3",
|
|
274
|
-
"enhanced-resolve": "^5.16.0",
|
|
275
|
-
escope: "^4.0.0",
|
|
276
|
-
eslint: "^7.2.0 || ^8",
|
|
277
|
-
"eslint-config-prettier": "^9.1.0",
|
|
278
|
-
"eslint-doc-generator": "^1.7.0",
|
|
279
|
-
"eslint-import-resolver-typescript": "^3.6.1",
|
|
280
|
-
"eslint-import-resolver-webpack": "^0.13.8",
|
|
281
|
-
"eslint-import-test-order-redirect": "link:./test/fixtures/order-redirect",
|
|
282
|
-
"eslint-plugin-eslint-plugin": "^5.4.1",
|
|
283
|
-
"eslint-plugin-import-x": "link:.",
|
|
284
|
-
"eslint-plugin-jest": "^27.9.0",
|
|
285
|
-
"eslint-plugin-json": "^3.1.0",
|
|
286
|
-
"eslint-plugin-n": "^16.6.2",
|
|
287
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
288
|
-
"eslint-plugin-unicorn": "^51.0.1",
|
|
289
|
-
jest: "^29.7.0",
|
|
290
|
-
"npm-run-all2": "^6.1.2",
|
|
291
|
-
prettier: "^3.2.5",
|
|
292
|
-
redux: "^5.0.1",
|
|
293
|
-
rimraf: "^5.0.5",
|
|
294
|
-
svelte: "^4.2.12",
|
|
295
|
-
"ts-node": "^10.9.2",
|
|
296
|
-
"type-fest": "^4.14.0",
|
|
297
|
-
typescript: "^5.4.3"
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
});
|
|
302
|
-
|
|
303
470
|
// node_modules/eslint-plugin-import-x/lib/utils/docs-url.js
|
|
304
471
|
var require_docs_url = __commonJS({
|
|
305
472
|
"node_modules/eslint-plugin-import-x/lib/utils/docs-url.js"(exports2) {
|
|
@@ -307,9 +474,9 @@ var require_docs_url = __commonJS({
|
|
|
307
474
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
308
475
|
exports2.docsUrl = void 0;
|
|
309
476
|
var tslib_12 = require("tslib");
|
|
310
|
-
var
|
|
477
|
+
var package_json_12 = tslib_12.__importDefault(require_package());
|
|
311
478
|
var repoUrl = "https://github.com/un-ts/eslint-plugin-import-x";
|
|
312
|
-
var docsUrl = (ruleName, commitish = `v${
|
|
479
|
+
var docsUrl = (ruleName, commitish = `v${package_json_12.default.version}`) => `${repoUrl}/blob/${commitish}/docs/rules/${ruleName}.md`;
|
|
313
480
|
exports2.docsUrl = docsUrl;
|
|
314
481
|
}
|
|
315
482
|
});
|
|
@@ -331,7 +498,7 @@ var require_declared_scope = __commonJS({
|
|
|
331
498
|
"node_modules/eslint-plugin-import-x/lib/utils/declared-scope.js"(exports2) {
|
|
332
499
|
"use strict";
|
|
333
500
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
334
|
-
exports2.declaredScope =
|
|
501
|
+
exports2.declaredScope = declaredScope;
|
|
335
502
|
function declaredScope(context, node, name) {
|
|
336
503
|
const references = context.sourceCode.getScope(node).references;
|
|
337
504
|
const reference = references.find((x) => x.identifier.name === name);
|
|
@@ -340,7 +507,6 @@ var require_declared_scope = __commonJS({
|
|
|
340
507
|
}
|
|
341
508
|
return reference.resolved.scope.type;
|
|
342
509
|
}
|
|
343
|
-
exports2.declaredScope = declaredScope;
|
|
344
510
|
}
|
|
345
511
|
});
|
|
346
512
|
|
|
@@ -373,7 +539,9 @@ var require_ignore = __commonJS({
|
|
|
373
539
|
"node_modules/eslint-plugin-import-x/lib/utils/ignore.js"(exports2) {
|
|
374
540
|
"use strict";
|
|
375
541
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
376
|
-
exports2.
|
|
542
|
+
exports2.getFileExtensions = getFileExtensions;
|
|
543
|
+
exports2.ignore = ignore;
|
|
544
|
+
exports2.hasValidExtension = hasValidExtension;
|
|
377
545
|
var tslib_12 = require("tslib");
|
|
378
546
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
379
547
|
var debug_1 = tslib_12.__importDefault(require("debug"));
|
|
@@ -389,7 +557,7 @@ var require_ignore = __commonJS({
|
|
|
389
557
|
return cachedSet;
|
|
390
558
|
}
|
|
391
559
|
function getFileExtensions(settings) {
|
|
392
|
-
const exts = new Set(settings["import-x/extensions"] || [".js"]);
|
|
560
|
+
const exts = new Set(settings["import-x/extensions"] || [".js", ".mjs", ".cjs"]);
|
|
393
561
|
if ("import-x/parsers" in settings) {
|
|
394
562
|
for (const parser in settings["import-x/parsers"]) {
|
|
395
563
|
const parserSettings = settings["import-x/parsers"][parser];
|
|
@@ -402,13 +570,12 @@ var require_ignore = __commonJS({
|
|
|
402
570
|
}
|
|
403
571
|
return exts;
|
|
404
572
|
}
|
|
405
|
-
exports2.getFileExtensions = getFileExtensions;
|
|
406
573
|
function ignore(filepath, context, skipExtensionCheck = false) {
|
|
407
574
|
if (!skipExtensionCheck && !hasValidExtension(filepath, context)) {
|
|
408
575
|
return true;
|
|
409
576
|
}
|
|
410
577
|
const ignoreStrings = context.settings["import-x/ignore"];
|
|
411
|
-
if (!
|
|
578
|
+
if (!ignoreStrings?.length) {
|
|
412
579
|
return false;
|
|
413
580
|
}
|
|
414
581
|
for (let i = 0, len = ignoreStrings.length; i < len; i++) {
|
|
@@ -421,11 +588,9 @@ var require_ignore = __commonJS({
|
|
|
421
588
|
}
|
|
422
589
|
return false;
|
|
423
590
|
}
|
|
424
|
-
exports2.ignore = ignore;
|
|
425
591
|
function hasValidExtension(filepath, context) {
|
|
426
592
|
return validExtensions(context).has(node_path_1.default.extname(filepath));
|
|
427
593
|
}
|
|
428
|
-
exports2.hasValidExtension = hasValidExtension;
|
|
429
594
|
}
|
|
430
595
|
});
|
|
431
596
|
|
|
@@ -434,7 +599,8 @@ var require_lazy_value = __commonJS({
|
|
|
434
599
|
"node_modules/eslint-plugin-import-x/lib/utils/lazy-value.js"(exports2) {
|
|
435
600
|
"use strict";
|
|
436
601
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
437
|
-
exports2.
|
|
602
|
+
exports2.lazy = void 0;
|
|
603
|
+
exports2.defineLazyProperty = defineLazyProperty;
|
|
438
604
|
var lazy = (cb) => {
|
|
439
605
|
let isCalled = false;
|
|
440
606
|
let result;
|
|
@@ -467,7 +633,6 @@ var require_lazy_value = __commonJS({
|
|
|
467
633
|
});
|
|
468
634
|
return object;
|
|
469
635
|
}
|
|
470
|
-
exports2.defineLazyProperty = defineLazyProperty;
|
|
471
636
|
}
|
|
472
637
|
});
|
|
473
638
|
|
|
@@ -476,7 +641,7 @@ var require_module_require = __commonJS({
|
|
|
476
641
|
"node_modules/eslint-plugin-import-x/lib/utils/module-require.js"(exports2) {
|
|
477
642
|
"use strict";
|
|
478
643
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
479
|
-
exports2.moduleRequire =
|
|
644
|
+
exports2.moduleRequire = moduleRequire;
|
|
480
645
|
var tslib_12 = require("tslib");
|
|
481
646
|
var node_module_1 = tslib_12.__importDefault(require("node:module"));
|
|
482
647
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
@@ -491,15 +656,14 @@ var require_module_require = __commonJS({
|
|
|
491
656
|
const eslintPath = require.resolve("eslint");
|
|
492
657
|
const eslintModule = createModule(eslintPath);
|
|
493
658
|
return require(node_module_1.default._resolveFilename(p, eslintModule));
|
|
494
|
-
} catch
|
|
659
|
+
} catch {
|
|
495
660
|
}
|
|
496
661
|
try {
|
|
497
662
|
return require.main.require(p);
|
|
498
|
-
} catch
|
|
663
|
+
} catch {
|
|
499
664
|
}
|
|
500
665
|
return require(p);
|
|
501
666
|
}
|
|
502
|
-
exports2.moduleRequire = moduleRequire;
|
|
503
667
|
}
|
|
504
668
|
});
|
|
505
669
|
|
|
@@ -508,11 +672,15 @@ var require_parse = __commonJS({
|
|
|
508
672
|
"node_modules/eslint-plugin-import-x/lib/utils/parse.js"(exports2) {
|
|
509
673
|
"use strict";
|
|
510
674
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
511
|
-
exports2.parse =
|
|
675
|
+
exports2.parse = parse;
|
|
512
676
|
var tslib_12 = require("tslib");
|
|
513
677
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
514
678
|
var debug_1 = tslib_12.__importDefault(require("debug"));
|
|
515
679
|
var module_require_1 = require_module_require();
|
|
680
|
+
function withoutProjectParserOptions(opts) {
|
|
681
|
+
const { EXPERIMENTAL_useProjectService, project, projectService, ...rest } = opts;
|
|
682
|
+
return rest;
|
|
683
|
+
}
|
|
516
684
|
var log = (0, debug_1.default)("eslint-plugin-import-x:parse");
|
|
517
685
|
function keysFromParser(parserPath, parserInstance, parsedResult) {
|
|
518
686
|
if (parsedResult && parsedResult.visitorKeys) {
|
|
@@ -536,27 +704,23 @@ var require_parse = __commonJS({
|
|
|
536
704
|
return text.replace(/^#!([^\r\n]+)/u, (_, captured) => `//${captured}`);
|
|
537
705
|
}
|
|
538
706
|
function parse(path, content, context) {
|
|
539
|
-
var _a;
|
|
540
707
|
if (context == null) {
|
|
541
708
|
throw new Error("need context to parse properly");
|
|
542
709
|
}
|
|
543
|
-
let parserOptions = "languageOptions" in context &&
|
|
710
|
+
let parserOptions = "languageOptions" in context && context.languageOptions?.parserOptions || context.parserOptions;
|
|
544
711
|
const parserOrPath = getParser(path, context);
|
|
545
712
|
if (!parserOrPath) {
|
|
546
713
|
throw new Error("parserPath or languageOptions.parser is required!");
|
|
547
714
|
}
|
|
548
|
-
parserOptions =
|
|
549
|
-
parserOptions.ecmaFeatures =
|
|
715
|
+
parserOptions = { ...parserOptions };
|
|
716
|
+
parserOptions.ecmaFeatures = { ...parserOptions.ecmaFeatures };
|
|
550
717
|
parserOptions.comment = true;
|
|
551
718
|
parserOptions.attachComment = true;
|
|
552
719
|
parserOptions.tokens = true;
|
|
553
720
|
parserOptions.loc = true;
|
|
554
721
|
parserOptions.range = true;
|
|
555
722
|
parserOptions.filePath = path;
|
|
556
|
-
|
|
557
|
-
delete parserOptions.projectService;
|
|
558
|
-
delete parserOptions.project;
|
|
559
|
-
delete parserOptions.projects;
|
|
723
|
+
parserOptions = withoutProjectParserOptions(parserOptions);
|
|
560
724
|
const parser = typeof parserOrPath === "string" ? (0, module_require_1.moduleRequire)(parserOrPath) : parserOrPath;
|
|
561
725
|
content = transformHashbang(stripUnicodeBOM(String(content)));
|
|
562
726
|
if ("parseForESLint" in parser && typeof parser.parseForESLint === "function") {
|
|
@@ -571,7 +735,7 @@ var require_parse = __commonJS({
|
|
|
571
735
|
console.warn(`Line ${error.lineNumber}, column ${error.column}: ${error.message}`);
|
|
572
736
|
}
|
|
573
737
|
if (!ast || typeof ast !== "object") {
|
|
574
|
-
console.warn(`\`parseForESLint\` from parser \`${typeof parserOrPath === "string" ? parserOrPath : "`context.languageOptions.parser`"}\` is invalid and will just be ignored
|
|
738
|
+
console.warn(`\`parseForESLint\` from parser \`${typeof parserOrPath === "string" ? parserOrPath : "`context.languageOptions.parser`"}\` is invalid and will just be ignored`, { content, parserMeta: parser.meta });
|
|
575
739
|
} else {
|
|
576
740
|
return makeParseReturn(ast, keysFromParser(parserOrPath, parser));
|
|
577
741
|
}
|
|
@@ -582,14 +746,12 @@ var require_parse = __commonJS({
|
|
|
582
746
|
}
|
|
583
747
|
throw new Error("Parser must expose a `parse` or `parseForESLint` method");
|
|
584
748
|
}
|
|
585
|
-
exports2.parse = parse;
|
|
586
749
|
function getParser(path, context) {
|
|
587
|
-
var _a;
|
|
588
750
|
const parserPath = getParserPath(path, context);
|
|
589
751
|
if (parserPath) {
|
|
590
752
|
return parserPath;
|
|
591
753
|
}
|
|
592
|
-
const parser = "languageOptions" in context &&
|
|
754
|
+
const parser = "languageOptions" in context && context.languageOptions?.parser;
|
|
593
755
|
if (parser && typeof parser !== "string" && ("parse" in parser && typeof parse === "function" || "parseForESLint" in parser && typeof parser.parseForESLint === "function")) {
|
|
594
756
|
return parser;
|
|
595
757
|
}
|
|
@@ -643,7 +805,10 @@ var require_module_cache = __commonJS({
|
|
|
643
805
|
}
|
|
644
806
|
}
|
|
645
807
|
static getSettings(settings) {
|
|
646
|
-
const cacheSettings =
|
|
808
|
+
const cacheSettings = {
|
|
809
|
+
lifetime: 30,
|
|
810
|
+
...settings["import-x/cache"]
|
|
811
|
+
};
|
|
647
812
|
if (typeof cacheSettings.lifetime === "string" && ["\u221E", "Infinity"].includes(cacheSettings.lifetime)) {
|
|
648
813
|
cacheSettings.lifetime = Number.POSITIVE_INFINITY;
|
|
649
814
|
}
|
|
@@ -659,7 +824,7 @@ var require_pkg_up = __commonJS({
|
|
|
659
824
|
"node_modules/eslint-plugin-import-x/lib/utils/pkg-up.js"(exports2) {
|
|
660
825
|
"use strict";
|
|
661
826
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
662
|
-
exports2.pkgUp =
|
|
827
|
+
exports2.pkgUp = pkgUp;
|
|
663
828
|
var tslib_12 = require("tslib");
|
|
664
829
|
var node_fs_1 = tslib_12.__importDefault(require("node:fs"));
|
|
665
830
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
@@ -681,7 +846,6 @@ var require_pkg_up = __commonJS({
|
|
|
681
846
|
function pkgUp(opts) {
|
|
682
847
|
return findUp("package.json", opts && opts.cwd);
|
|
683
848
|
}
|
|
684
|
-
exports2.pkgUp = pkgUp;
|
|
685
849
|
}
|
|
686
850
|
});
|
|
687
851
|
|
|
@@ -690,7 +854,7 @@ var require_pkg_dir = __commonJS({
|
|
|
690
854
|
"node_modules/eslint-plugin-import-x/lib/utils/pkg-dir.js"(exports2) {
|
|
691
855
|
"use strict";
|
|
692
856
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
693
|
-
exports2.pkgDir =
|
|
857
|
+
exports2.pkgDir = pkgDir;
|
|
694
858
|
var tslib_12 = require("tslib");
|
|
695
859
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
696
860
|
var pkg_up_1 = require_pkg_up();
|
|
@@ -698,7 +862,6 @@ var require_pkg_dir = __commonJS({
|
|
|
698
862
|
const fp = (0, pkg_up_1.pkgUp)({ cwd });
|
|
699
863
|
return fp ? node_path_1.default.dirname(fp) : null;
|
|
700
864
|
}
|
|
701
|
-
exports2.pkgDir = pkgDir;
|
|
702
865
|
}
|
|
703
866
|
});
|
|
704
867
|
|
|
@@ -707,7 +870,10 @@ var require_resolve = __commonJS({
|
|
|
707
870
|
"node_modules/eslint-plugin-import-x/lib/utils/resolve.js"(exports2) {
|
|
708
871
|
"use strict";
|
|
709
872
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
710
|
-
exports2.
|
|
873
|
+
exports2.CASE_SENSITIVE_FS = void 0;
|
|
874
|
+
exports2.fileExistsWithCaseSync = fileExistsWithCaseSync;
|
|
875
|
+
exports2.relative = relative;
|
|
876
|
+
exports2.resolve = resolve;
|
|
711
877
|
var tslib_12 = require("tslib");
|
|
712
878
|
var node_fs_1 = tslib_12.__importDefault(require("node:fs"));
|
|
713
879
|
var node_module_1 = require("node:module");
|
|
@@ -726,11 +892,11 @@ var require_resolve = __commonJS({
|
|
|
726
892
|
} else {
|
|
727
893
|
try {
|
|
728
894
|
resolved = (0, node_module_1.createRequire)(node_path_1.default.resolve(sourceFile)).resolve(target);
|
|
729
|
-
} catch
|
|
895
|
+
} catch {
|
|
730
896
|
resolved = require.resolve(target);
|
|
731
897
|
}
|
|
732
898
|
}
|
|
733
|
-
} catch
|
|
899
|
+
} catch {
|
|
734
900
|
return void 0;
|
|
735
901
|
}
|
|
736
902
|
return require(resolved);
|
|
@@ -760,7 +926,6 @@ var require_resolve = __commonJS({
|
|
|
760
926
|
fileExistsCache.set(filepath, result);
|
|
761
927
|
return result;
|
|
762
928
|
}
|
|
763
|
-
exports2.fileExistsWithCaseSync = fileExistsWithCaseSync;
|
|
764
929
|
var prevSettings = null;
|
|
765
930
|
var memoizedHash;
|
|
766
931
|
function fullResolve(modulePath, sourceFile, settings) {
|
|
@@ -800,7 +965,7 @@ var require_resolve = __commonJS({
|
|
|
800
965
|
found: true,
|
|
801
966
|
path: resolved
|
|
802
967
|
};
|
|
803
|
-
} catch
|
|
968
|
+
} catch {
|
|
804
969
|
return {
|
|
805
970
|
found: false
|
|
806
971
|
};
|
|
@@ -824,7 +989,6 @@ var require_resolve = __commonJS({
|
|
|
824
989
|
function relative(modulePath, sourceFile, settings) {
|
|
825
990
|
return fullResolve(modulePath, sourceFile, settings).path;
|
|
826
991
|
}
|
|
827
|
-
exports2.relative = relative;
|
|
828
992
|
function resolverReducer(resolvers, map) {
|
|
829
993
|
if (Array.isArray(resolvers)) {
|
|
830
994
|
for (const r of resolvers)
|
|
@@ -890,7 +1054,6 @@ var require_resolve = __commonJS({
|
|
|
890
1054
|
}
|
|
891
1055
|
}
|
|
892
1056
|
}
|
|
893
|
-
exports2.resolve = resolve;
|
|
894
1057
|
}
|
|
895
1058
|
});
|
|
896
1059
|
|
|
@@ -899,17 +1062,16 @@ var require_unambiguous = __commonJS({
|
|
|
899
1062
|
"node_modules/eslint-plugin-import-x/lib/utils/unambiguous.js"(exports2) {
|
|
900
1063
|
"use strict";
|
|
901
1064
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
902
|
-
exports2.
|
|
1065
|
+
exports2.isMaybeUnambiguousModule = isMaybeUnambiguousModule;
|
|
1066
|
+
exports2.isUnambiguousModule = isUnambiguousModule;
|
|
903
1067
|
var pattern = /(^|;)\s*(export|import)((\s+\w)|(\s*[*={]))|import\(/m;
|
|
904
1068
|
function isMaybeUnambiguousModule(content) {
|
|
905
1069
|
return pattern.test(content);
|
|
906
1070
|
}
|
|
907
|
-
exports2.isMaybeUnambiguousModule = isMaybeUnambiguousModule;
|
|
908
1071
|
var unambiguousNodeType = /^(?:(?:Exp|Imp)ort.*Declaration|TSExportAssignment)$/;
|
|
909
1072
|
function isUnambiguousModule(ast) {
|
|
910
1073
|
return ast.body && ast.body.some((node) => unambiguousNodeType.test(node.type));
|
|
911
1074
|
}
|
|
912
|
-
exports2.isUnambiguousModule = isUnambiguousModule;
|
|
913
1075
|
}
|
|
914
1076
|
});
|
|
915
1077
|
|
|
@@ -918,7 +1080,7 @@ var require_visit = __commonJS({
|
|
|
918
1080
|
"node_modules/eslint-plugin-import-x/lib/utils/visit.js"(exports2) {
|
|
919
1081
|
"use strict";
|
|
920
1082
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
921
|
-
exports2.visit =
|
|
1083
|
+
exports2.visit = visit;
|
|
922
1084
|
function visit(node, keys, visitorSpec) {
|
|
923
1085
|
if (!node || !keys) {
|
|
924
1086
|
return;
|
|
@@ -945,7 +1107,6 @@ var require_visit = __commonJS({
|
|
|
945
1107
|
exit(node);
|
|
946
1108
|
}
|
|
947
1109
|
}
|
|
948
|
-
exports2.visit = visit;
|
|
949
1110
|
}
|
|
950
1111
|
});
|
|
951
1112
|
|
|
@@ -954,7 +1115,8 @@ var require_export_map = __commonJS({
|
|
|
954
1115
|
"node_modules/eslint-plugin-import-x/lib/utils/export-map.js"(exports2) {
|
|
955
1116
|
"use strict";
|
|
956
1117
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
957
|
-
exports2.
|
|
1118
|
+
exports2.ExportMap = void 0;
|
|
1119
|
+
exports2.recursivePatternCapture = recursivePatternCapture;
|
|
958
1120
|
var tslib_12 = require("tslib");
|
|
959
1121
|
var node_fs_1 = tslib_12.__importDefault(require("node:fs"));
|
|
960
1122
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
@@ -1032,7 +1194,6 @@ var require_export_map = __commonJS({
|
|
|
1032
1194
|
return _ExportMap.for(childContext(path, context));
|
|
1033
1195
|
}
|
|
1034
1196
|
static parse(filepath, content, context) {
|
|
1035
|
-
var _a, _b;
|
|
1036
1197
|
const m = new _ExportMap(filepath);
|
|
1037
1198
|
const isEsModuleInteropTrue = (0, lazy_value_1.lazy)(isEsModuleInterop);
|
|
1038
1199
|
let ast;
|
|
@@ -1129,6 +1290,7 @@ var require_export_map = __commonJS({
|
|
|
1129
1290
|
break;
|
|
1130
1291
|
}
|
|
1131
1292
|
case "ExportNamespaceSpecifier": {
|
|
1293
|
+
m2.exports.set(s.exported.name, n);
|
|
1132
1294
|
m2.namespace.set(s.exported.name, Object.defineProperty(exportMeta, "namespace", {
|
|
1133
1295
|
get() {
|
|
1134
1296
|
return resolveImport(nsource);
|
|
@@ -1137,11 +1299,13 @@ var require_export_map = __commonJS({
|
|
|
1137
1299
|
return;
|
|
1138
1300
|
}
|
|
1139
1301
|
case "ExportAllDeclaration": {
|
|
1302
|
+
m2.exports.set((0, get_value_1.getValue)(s.exported), n);
|
|
1140
1303
|
m2.namespace.set((0, get_value_1.getValue)(s.exported), addNamespace(exportMeta, s.exported));
|
|
1141
1304
|
return;
|
|
1142
1305
|
}
|
|
1143
1306
|
case "ExportSpecifier": {
|
|
1144
1307
|
if (!("source" in n && n.source)) {
|
|
1308
|
+
m2.exports.set((0, get_value_1.getValue)(s.exported), n);
|
|
1145
1309
|
m2.namespace.set((0, get_value_1.getValue)(s.exported), addNamespace(exportMeta, s.local));
|
|
1146
1310
|
return;
|
|
1147
1311
|
}
|
|
@@ -1203,7 +1367,6 @@ var require_export_map = __commonJS({
|
|
|
1203
1367
|
}
|
|
1204
1368
|
const source = new eslint_1.SourceCode({ text: content, ast });
|
|
1205
1369
|
function isEsModuleInterop() {
|
|
1206
|
-
var _a2, _b2;
|
|
1207
1370
|
const parserOptions = context.parserOptions || {};
|
|
1208
1371
|
let tsconfigRootDir = parserOptions.tsconfigRootDir;
|
|
1209
1372
|
const project = parserOptions.project;
|
|
@@ -1228,7 +1391,7 @@ var require_export_map = __commonJS({
|
|
|
1228
1391
|
tsConfig = tsconfigResult && tsconfigResult.config || null;
|
|
1229
1392
|
tsconfigCache.set(cacheKey, tsConfig);
|
|
1230
1393
|
}
|
|
1231
|
-
return
|
|
1394
|
+
return tsConfig?.compilerOptions?.esModuleInterop ?? false;
|
|
1232
1395
|
}
|
|
1233
1396
|
for (const n of ast.body) {
|
|
1234
1397
|
if (n.type === "ExportDefaultDeclaration") {
|
|
@@ -1236,6 +1399,7 @@ var require_export_map = __commonJS({
|
|
|
1236
1399
|
if (n.declaration.type === "Identifier") {
|
|
1237
1400
|
addNamespace(exportMeta, n.declaration);
|
|
1238
1401
|
}
|
|
1402
|
+
m.exports.set("default", n);
|
|
1239
1403
|
m.namespace.set("default", exportMeta);
|
|
1240
1404
|
continue;
|
|
1241
1405
|
}
|
|
@@ -1274,12 +1438,16 @@ var require_export_map = __commonJS({
|
|
|
1274
1438
|
case "TSInterfaceDeclaration":
|
|
1275
1439
|
case "TSAbstractClassDeclaration":
|
|
1276
1440
|
case "TSModuleDeclaration": {
|
|
1441
|
+
m.exports.set(n.declaration.id.name, n);
|
|
1277
1442
|
m.namespace.set(n.declaration.id.name, captureDoc(source, docStyleParsers, n));
|
|
1278
1443
|
break;
|
|
1279
1444
|
}
|
|
1280
1445
|
case "VariableDeclaration": {
|
|
1281
1446
|
for (const d of n.declaration.declarations) {
|
|
1282
|
-
recursivePatternCapture(d.id, (id) =>
|
|
1447
|
+
recursivePatternCapture(d.id, (id) => {
|
|
1448
|
+
m.exports.set(id.name, n);
|
|
1449
|
+
m.namespace.set(id.name, captureDoc(source, docStyleParsers, d, n));
|
|
1450
|
+
});
|
|
1283
1451
|
}
|
|
1284
1452
|
break;
|
|
1285
1453
|
}
|
|
@@ -1306,16 +1474,19 @@ var require_export_map = __commonJS({
|
|
|
1306
1474
|
return declTypes.has(node.type) && ("id" in node && node.id && ("name" in node.id ? node.id.name === exportedName : "left" in node.id && getRoot(node.id).name === exportedName) || "declarations" in node && node.declarations.find((d) => "name" in d.id && d.id.name === exportedName));
|
|
1307
1475
|
});
|
|
1308
1476
|
if (exportedDecls.length === 0) {
|
|
1477
|
+
m.exports.set("default", n);
|
|
1309
1478
|
m.namespace.set("default", captureDoc(source, docStyleParsers, n));
|
|
1310
1479
|
continue;
|
|
1311
1480
|
}
|
|
1312
1481
|
if (isEsModuleInteropTrue() && !m.namespace.has("default")) {
|
|
1482
|
+
m.exports.set("default", n);
|
|
1313
1483
|
m.namespace.set("default", {});
|
|
1314
1484
|
}
|
|
1315
1485
|
for (const decl of exportedDecls) {
|
|
1316
1486
|
if (decl.type === "TSModuleDeclaration") {
|
|
1317
|
-
const type =
|
|
1487
|
+
const type = decl.body?.type;
|
|
1318
1488
|
if (type === "TSModuleDeclaration") {
|
|
1489
|
+
m.exports.set(decl.body.id.name, n);
|
|
1319
1490
|
m.namespace.set(decl.body.id.name, captureDoc(source, docStyleParsers, decl.body));
|
|
1320
1491
|
continue;
|
|
1321
1492
|
} else if (type === "TSModuleBlock" && decl.kind === "namespace") {
|
|
@@ -1326,19 +1497,24 @@ var require_export_map = __commonJS({
|
|
|
1326
1497
|
m.namespace.set(decl.id.right.name, metadata);
|
|
1327
1498
|
}
|
|
1328
1499
|
}
|
|
1329
|
-
if (
|
|
1500
|
+
if (decl.body?.body) {
|
|
1330
1501
|
for (const moduleBlockNode of decl.body.body) {
|
|
1331
1502
|
const namespaceDecl = moduleBlockNode.type === "ExportNamedDeclaration" ? moduleBlockNode.declaration : moduleBlockNode;
|
|
1332
1503
|
if (!namespaceDecl) {
|
|
1333
1504
|
} else if (namespaceDecl.type === "VariableDeclaration") {
|
|
1334
1505
|
for (const d of namespaceDecl.declarations)
|
|
1335
|
-
recursivePatternCapture(d.id, (id) =>
|
|
1506
|
+
recursivePatternCapture(d.id, (id) => {
|
|
1507
|
+
m.exports.set(id.name, n);
|
|
1508
|
+
m.namespace.set(id.name, captureDoc(source, docStyleParsers, decl, namespaceDecl, moduleBlockNode));
|
|
1509
|
+
});
|
|
1336
1510
|
} else if ("id" in namespaceDecl) {
|
|
1511
|
+
m.exports.set(namespaceDecl.id.name, n);
|
|
1337
1512
|
m.namespace.set(namespaceDecl.id.name, captureDoc(source, docStyleParsers, moduleBlockNode));
|
|
1338
1513
|
}
|
|
1339
1514
|
}
|
|
1340
1515
|
}
|
|
1341
1516
|
} else {
|
|
1517
|
+
m.exports.set("default", n);
|
|
1342
1518
|
m.namespace.set("default", captureDoc(source, docStyleParsers, decl));
|
|
1343
1519
|
}
|
|
1344
1520
|
}
|
|
@@ -1356,12 +1532,13 @@ var require_export_map = __commonJS({
|
|
|
1356
1532
|
if (doc.tags.some((t) => t.title === "module")) {
|
|
1357
1533
|
return doc;
|
|
1358
1534
|
}
|
|
1359
|
-
} catch
|
|
1535
|
+
} catch {
|
|
1360
1536
|
}
|
|
1361
1537
|
}
|
|
1362
1538
|
}
|
|
1363
1539
|
});
|
|
1364
1540
|
if (isEsModuleInteropTrue() && m.namespace.size > 0 && !m.namespace.has("default")) {
|
|
1541
|
+
m.exports.set("default", ast.body[0]);
|
|
1365
1542
|
m.namespace.set("default", {});
|
|
1366
1543
|
}
|
|
1367
1544
|
const prevParseGoal = m.parseGoal;
|
|
@@ -1379,6 +1556,7 @@ var require_export_map = __commonJS({
|
|
|
1379
1556
|
this.reexports = /* @__PURE__ */ new Map();
|
|
1380
1557
|
this.dependencies = /* @__PURE__ */ new Set();
|
|
1381
1558
|
this.imports = /* @__PURE__ */ new Map();
|
|
1559
|
+
this.exports = /* @__PURE__ */ new Map();
|
|
1382
1560
|
this.errors = [];
|
|
1383
1561
|
this.parseGoal = "ambiguous";
|
|
1384
1562
|
}
|
|
@@ -1491,7 +1669,7 @@ var require_export_map = __commonJS({
|
|
|
1491
1669
|
}
|
|
1492
1670
|
for (const [name, reexports] of this.reexports.entries()) {
|
|
1493
1671
|
const reexported = reexports.getImport();
|
|
1494
|
-
callback.call(thisArg, reexported
|
|
1672
|
+
callback.call(thisArg, reexported?.get(reexports.local), name, this);
|
|
1495
1673
|
}
|
|
1496
1674
|
this.dependencies.forEach((dep) => {
|
|
1497
1675
|
const d = dep();
|
|
@@ -1542,7 +1720,7 @@ var require_export_map = __commonJS({
|
|
|
1542
1720
|
}
|
|
1543
1721
|
}
|
|
1544
1722
|
return;
|
|
1545
|
-
} catch
|
|
1723
|
+
} catch {
|
|
1546
1724
|
continue;
|
|
1547
1725
|
}
|
|
1548
1726
|
}
|
|
@@ -1561,7 +1739,7 @@ var require_export_map = __commonJS({
|
|
|
1561
1739
|
}
|
|
1562
1740
|
try {
|
|
1563
1741
|
return doctrine_1.default.parse(comment.value, { unwrap: true });
|
|
1564
|
-
} catch
|
|
1742
|
+
} catch {
|
|
1565
1743
|
}
|
|
1566
1744
|
}
|
|
1567
1745
|
}
|
|
@@ -1629,7 +1807,6 @@ var require_export_map = __commonJS({
|
|
|
1629
1807
|
default:
|
|
1630
1808
|
}
|
|
1631
1809
|
}
|
|
1632
|
-
exports2.recursivePatternCapture = recursivePatternCapture;
|
|
1633
1810
|
function childContext(path, context) {
|
|
1634
1811
|
const { settings, parserOptions, parserPath, languageOptions } = context;
|
|
1635
1812
|
return {
|
|
@@ -1643,13 +1820,12 @@ var require_export_map = __commonJS({
|
|
|
1643
1820
|
};
|
|
1644
1821
|
}
|
|
1645
1822
|
function makeContextCacheKey(context) {
|
|
1646
|
-
var _a, _b, _c;
|
|
1647
1823
|
const { settings, parserPath, parserOptions, languageOptions } = context;
|
|
1648
|
-
let hash = (0, stable_hash_1.default)(settings) + (0, stable_hash_1.default)(
|
|
1824
|
+
let hash = (0, stable_hash_1.default)(settings) + (0, stable_hash_1.default)(languageOptions?.parserOptions ?? parserOptions);
|
|
1649
1825
|
if (languageOptions) {
|
|
1650
1826
|
hash += String(languageOptions.ecmaVersion) + String(languageOptions.sourceType);
|
|
1651
1827
|
}
|
|
1652
|
-
hash += (0, stable_hash_1.default)(
|
|
1828
|
+
hash += (0, stable_hash_1.default)(parserPath ?? languageOptions?.parser?.meta ?? languageOptions?.parser);
|
|
1653
1829
|
return hash;
|
|
1654
1830
|
}
|
|
1655
1831
|
}
|
|
@@ -1660,10 +1836,12 @@ var require_hash = __commonJS({
|
|
|
1660
1836
|
"node_modules/eslint-plugin-import-x/lib/utils/hash.js"(exports2) {
|
|
1661
1837
|
"use strict";
|
|
1662
1838
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1663
|
-
exports2.
|
|
1839
|
+
exports2.hashify = hashify;
|
|
1840
|
+
exports2.hashArray = hashArray;
|
|
1841
|
+
exports2.hashObject = hashObject;
|
|
1664
1842
|
var node_crypto_1 = require("node:crypto");
|
|
1665
1843
|
function hashify(value, hash) {
|
|
1666
|
-
hash
|
|
1844
|
+
hash ??= (0, node_crypto_1.createHash)("sha256");
|
|
1667
1845
|
if (Array.isArray(value)) {
|
|
1668
1846
|
hashArray(value, hash);
|
|
1669
1847
|
} else if (value instanceof Object) {
|
|
@@ -1673,9 +1851,8 @@ var require_hash = __commonJS({
|
|
|
1673
1851
|
}
|
|
1674
1852
|
return hash;
|
|
1675
1853
|
}
|
|
1676
|
-
exports2.hashify = hashify;
|
|
1677
1854
|
function hashArray(array, hash) {
|
|
1678
|
-
hash
|
|
1855
|
+
hash ??= (0, node_crypto_1.createHash)("sha256");
|
|
1679
1856
|
hash.update("[");
|
|
1680
1857
|
for (const element of array) {
|
|
1681
1858
|
hashify(element, hash);
|
|
@@ -1684,9 +1861,8 @@ var require_hash = __commonJS({
|
|
|
1684
1861
|
hash.update("]");
|
|
1685
1862
|
return hash;
|
|
1686
1863
|
}
|
|
1687
|
-
exports2.hashArray = hashArray;
|
|
1688
1864
|
function hashObject(object, hash) {
|
|
1689
|
-
hash
|
|
1865
|
+
hash ??= (0, node_crypto_1.createHash)("sha256");
|
|
1690
1866
|
hash.update("{");
|
|
1691
1867
|
for (const key of Object.keys(object).sort()) {
|
|
1692
1868
|
hash.update(JSON.stringify(key));
|
|
@@ -1697,7 +1873,6 @@ var require_hash = __commonJS({
|
|
|
1697
1873
|
hash.update("}");
|
|
1698
1874
|
return hash;
|
|
1699
1875
|
}
|
|
1700
|
-
exports2.hashObject = hashObject;
|
|
1701
1876
|
}
|
|
1702
1877
|
});
|
|
1703
1878
|
|
|
@@ -1720,7 +1895,7 @@ var require_read_pkg_up = __commonJS({
|
|
|
1720
1895
|
"node_modules/eslint-plugin-import-x/lib/utils/read-pkg-up.js"(exports2) {
|
|
1721
1896
|
"use strict";
|
|
1722
1897
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1723
|
-
exports2.readPkgUp =
|
|
1898
|
+
exports2.readPkgUp = readPkgUp;
|
|
1724
1899
|
var tslib_12 = require("tslib");
|
|
1725
1900
|
var node_fs_1 = tslib_12.__importDefault(require("node:fs"));
|
|
1726
1901
|
var pkg_up_1 = require_pkg_up();
|
|
@@ -1737,11 +1912,10 @@ var require_read_pkg_up = __commonJS({
|
|
|
1737
1912
|
pkg: JSON.parse(stripBOM(node_fs_1.default.readFileSync(fp, { encoding: "utf8" }))),
|
|
1738
1913
|
path: fp
|
|
1739
1914
|
};
|
|
1740
|
-
} catch
|
|
1915
|
+
} catch {
|
|
1741
1916
|
return {};
|
|
1742
1917
|
}
|
|
1743
1918
|
}
|
|
1744
|
-
exports2.readPkgUp = readPkgUp;
|
|
1745
1919
|
}
|
|
1746
1920
|
});
|
|
1747
1921
|
|
|
@@ -1750,7 +1924,9 @@ var require_package_path = __commonJS({
|
|
|
1750
1924
|
"node_modules/eslint-plugin-import-x/lib/utils/package-path.js"(exports2) {
|
|
1751
1925
|
"use strict";
|
|
1752
1926
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1753
|
-
exports2.
|
|
1927
|
+
exports2.getContextPackagePath = getContextPackagePath;
|
|
1928
|
+
exports2.getFilePackagePath = getFilePackagePath;
|
|
1929
|
+
exports2.getFilePackageName = getFilePackageName;
|
|
1754
1930
|
var tslib_12 = require("tslib");
|
|
1755
1931
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
1756
1932
|
var pkg_up_1 = require_pkg_up();
|
|
@@ -1758,11 +1934,9 @@ var require_package_path = __commonJS({
|
|
|
1758
1934
|
function getContextPackagePath(context) {
|
|
1759
1935
|
return getFilePackagePath(context.physicalFilename);
|
|
1760
1936
|
}
|
|
1761
|
-
exports2.getContextPackagePath = getContextPackagePath;
|
|
1762
1937
|
function getFilePackagePath(filename) {
|
|
1763
1938
|
return node_path_1.default.dirname((0, pkg_up_1.pkgUp)({ cwd: filename }));
|
|
1764
1939
|
}
|
|
1765
|
-
exports2.getFilePackagePath = getFilePackagePath;
|
|
1766
1940
|
function getFilePackageName(filename) {
|
|
1767
1941
|
const { pkg, path: pkgPath } = (0, read_pkg_up_1.readPkgUp)({ cwd: filename });
|
|
1768
1942
|
if (pkg) {
|
|
@@ -1770,7 +1944,6 @@ var require_package_path = __commonJS({
|
|
|
1770
1944
|
}
|
|
1771
1945
|
return null;
|
|
1772
1946
|
}
|
|
1773
|
-
exports2.getFilePackageName = getFilePackageName;
|
|
1774
1947
|
}
|
|
1775
1948
|
});
|
|
1776
1949
|
|
|
@@ -1779,7 +1952,13 @@ var require_import_type = __commonJS({
|
|
|
1779
1952
|
"node_modules/eslint-plugin-import-x/lib/utils/import-type.js"(exports2) {
|
|
1780
1953
|
"use strict";
|
|
1781
1954
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1782
|
-
exports2.
|
|
1955
|
+
exports2.isAbsolute = isAbsolute;
|
|
1956
|
+
exports2.isBuiltIn = isBuiltIn;
|
|
1957
|
+
exports2.isExternalModule = isExternalModule;
|
|
1958
|
+
exports2.isExternalModuleMain = isExternalModuleMain;
|
|
1959
|
+
exports2.isScoped = isScoped;
|
|
1960
|
+
exports2.isScopedMain = isScopedMain;
|
|
1961
|
+
exports2.importType = importType;
|
|
1783
1962
|
var tslib_12 = require("tslib");
|
|
1784
1963
|
var node_module_1 = require("node:module");
|
|
1785
1964
|
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
@@ -1794,13 +1973,12 @@ var require_import_type = __commonJS({
|
|
|
1794
1973
|
return pkg;
|
|
1795
1974
|
}
|
|
1796
1975
|
function isInternalRegexMatch(name, settings) {
|
|
1797
|
-
const internalScope = settings
|
|
1976
|
+
const internalScope = settings?.["import-x/internal-regex"];
|
|
1798
1977
|
return internalScope && new RegExp(internalScope).test(name);
|
|
1799
1978
|
}
|
|
1800
1979
|
function isAbsolute(name) {
|
|
1801
1980
|
return typeof name === "string" && node_path_1.default.isAbsolute(name);
|
|
1802
1981
|
}
|
|
1803
|
-
exports2.isAbsolute = isAbsolute;
|
|
1804
1982
|
function isBuiltIn(name, settings, modulePath) {
|
|
1805
1983
|
if (modulePath || !name) {
|
|
1806
1984
|
return false;
|
|
@@ -1809,18 +1987,15 @@ var require_import_type = __commonJS({
|
|
|
1809
1987
|
const extras = settings && settings["import-x/core-modules"] || [];
|
|
1810
1988
|
return (0, node_module_1.isBuiltin)(base) || extras.includes(base);
|
|
1811
1989
|
}
|
|
1812
|
-
exports2.isBuiltIn = isBuiltIn;
|
|
1813
1990
|
function isExternalModule(name, modulePath, context) {
|
|
1814
1991
|
return (isModule(name) || isScoped(name)) && typeTest(name, context, modulePath) === "external";
|
|
1815
1992
|
}
|
|
1816
|
-
exports2.isExternalModule = isExternalModule;
|
|
1817
1993
|
function isExternalModuleMain(name, modulePath, context) {
|
|
1818
1994
|
if (arguments.length < 3) {
|
|
1819
1995
|
throw new TypeError("isExternalModule: name, path, and context are all required");
|
|
1820
1996
|
}
|
|
1821
1997
|
return isModuleMain(name) && typeTest(name, context, modulePath) === "external";
|
|
1822
1998
|
}
|
|
1823
|
-
exports2.isExternalModuleMain = isExternalModuleMain;
|
|
1824
1999
|
var moduleRegExp = /^\w/;
|
|
1825
2000
|
function isModule(name) {
|
|
1826
2001
|
return !!name && moduleRegExp.test(name);
|
|
@@ -1833,12 +2008,10 @@ var require_import_type = __commonJS({
|
|
|
1833
2008
|
function isScoped(name) {
|
|
1834
2009
|
return !!name && scopedRegExp.test(name);
|
|
1835
2010
|
}
|
|
1836
|
-
exports2.isScoped = isScoped;
|
|
1837
2011
|
var scopedMainRegExp = /^@[^/]+\/?[^/]+$/;
|
|
1838
2012
|
function isScopedMain(name) {
|
|
1839
2013
|
return !!name && scopedMainRegExp.test(name);
|
|
1840
2014
|
}
|
|
1841
|
-
exports2.isScopedMain = isScopedMain;
|
|
1842
2015
|
function isRelativeToParent(name) {
|
|
1843
2016
|
return /^\.\.$|^\.\.[/\\]/.test(name);
|
|
1844
2017
|
}
|
|
@@ -1858,7 +2031,7 @@ var require_import_type = __commonJS({
|
|
|
1858
2031
|
if (node_path_1.default.relative(packagePath, filepath).startsWith("..")) {
|
|
1859
2032
|
return true;
|
|
1860
2033
|
}
|
|
1861
|
-
const folders =
|
|
2034
|
+
const folders = settings?.["import-x/external-module-folders"] || [
|
|
1862
2035
|
"node_modules"
|
|
1863
2036
|
];
|
|
1864
2037
|
return folders.some((folder) => {
|
|
@@ -1911,7 +2084,6 @@ var require_import_type = __commonJS({
|
|
|
1911
2084
|
function importType(name, context) {
|
|
1912
2085
|
return typeTest(name, context, (0, resolve_1.resolve)(name, context));
|
|
1913
2086
|
}
|
|
1914
|
-
exports2.importType = importType;
|
|
1915
2087
|
}
|
|
1916
2088
|
});
|
|
1917
2089
|
|
|
@@ -1920,12 +2092,14 @@ var require_module_visitor = __commonJS({
|
|
|
1920
2092
|
"node_modules/eslint-plugin-import-x/lib/utils/module-visitor.js"(exports2) {
|
|
1921
2093
|
"use strict";
|
|
1922
2094
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1923
|
-
exports2.optionsSchema =
|
|
2095
|
+
exports2.optionsSchema = void 0;
|
|
2096
|
+
exports2.moduleVisitor = moduleVisitor;
|
|
2097
|
+
exports2.makeOptionsSchema = makeOptionsSchema;
|
|
1924
2098
|
function moduleVisitor(visitor, options) {
|
|
1925
|
-
const ignore = options
|
|
1926
|
-
const amd = !!
|
|
1927
|
-
const commonjs = !!
|
|
1928
|
-
const esmodule = !!
|
|
2099
|
+
const ignore = options?.ignore;
|
|
2100
|
+
const amd = !!options?.amd;
|
|
2101
|
+
const commonjs = !!options?.commonjs;
|
|
2102
|
+
const esmodule = !!{ esmodule: true, ...options }.esmodule;
|
|
1929
2103
|
const ignoreRegExps = ignore == null ? [] : ignore.map((p) => new RegExp(p));
|
|
1930
2104
|
function checkSourceValue(source, importer) {
|
|
1931
2105
|
if (source == null) {
|
|
@@ -2037,7 +2211,6 @@ var require_module_visitor = __commonJS({
|
|
|
2037
2211
|
}
|
|
2038
2212
|
return visitors;
|
|
2039
2213
|
}
|
|
2040
|
-
exports2.moduleVisitor = moduleVisitor;
|
|
2041
2214
|
function makeOptionsSchema(additionalProperties) {
|
|
2042
2215
|
const base = {
|
|
2043
2216
|
type: "object",
|
|
@@ -2061,7 +2234,6 @@ var require_module_visitor = __commonJS({
|
|
|
2061
2234
|
}
|
|
2062
2235
|
return base;
|
|
2063
2236
|
}
|
|
2064
|
-
exports2.makeOptionsSchema = makeOptionsSchema;
|
|
2065
2237
|
exports2.optionsSchema = makeOptionsSchema();
|
|
2066
2238
|
}
|
|
2067
2239
|
});
|
|
@@ -2071,11 +2243,10 @@ var require_static_require = __commonJS({
|
|
|
2071
2243
|
"node_modules/eslint-plugin-import-x/lib/utils/static-require.js"(exports2) {
|
|
2072
2244
|
"use strict";
|
|
2073
2245
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
2074
|
-
exports2.isStaticRequire =
|
|
2246
|
+
exports2.isStaticRequire = isStaticRequire;
|
|
2075
2247
|
function isStaticRequire(node) {
|
|
2076
2248
|
return node && node.callee && node.callee.type === "Identifier" && node.callee.name === "require" && node.arguments.length === 1 && node.arguments[0].type === "Literal" && typeof node.arguments[0].value === "string";
|
|
2077
2249
|
}
|
|
2078
|
-
exports2.isStaticRequire = isStaticRequire;
|
|
2079
2250
|
}
|
|
2080
2251
|
});
|
|
2081
2252
|
|
|
@@ -2410,7 +2581,7 @@ var require_dynamic_import_chunkname = __commonJS({
|
|
|
2410
2581
|
}
|
|
2411
2582
|
try {
|
|
2412
2583
|
node_vm_1.default.runInNewContext(`(function() {return {${comment.value}}})()`);
|
|
2413
|
-
} catch
|
|
2584
|
+
} catch {
|
|
2414
2585
|
context.report({
|
|
2415
2586
|
node,
|
|
2416
2587
|
messageId: "webpackComment"
|
|
@@ -2512,10 +2683,7 @@ var require_export = __commonJS({
|
|
|
2512
2683
|
var tsTypePrefix = "type:";
|
|
2513
2684
|
function isTypescriptFunctionOverloads(nodes) {
|
|
2514
2685
|
const nodesArr = [...nodes];
|
|
2515
|
-
const idents = nodesArr.flatMap((node) =>
|
|
2516
|
-
var _a;
|
|
2517
|
-
return "declaration" in node && ((_a = node.declaration) === null || _a === void 0 ? void 0 : _a.type) === "TSDeclareFunction" ? node.declaration.id.name : [];
|
|
2518
|
-
});
|
|
2686
|
+
const idents = nodesArr.flatMap((node) => "declaration" in node && node.declaration?.type === "TSDeclareFunction" ? node.declaration.id.name : []);
|
|
2519
2687
|
if (new Set(idents).size !== idents.length) {
|
|
2520
2688
|
return true;
|
|
2521
2689
|
}
|
|
@@ -2572,8 +2740,7 @@ var require_export = __commonJS({
|
|
|
2572
2740
|
nodes.add(node);
|
|
2573
2741
|
}
|
|
2574
2742
|
function getParent(node) {
|
|
2575
|
-
|
|
2576
|
-
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === "TSModuleBlock") {
|
|
2743
|
+
if (node.parent?.type === "TSModuleBlock") {
|
|
2577
2744
|
return node.parent.parent;
|
|
2578
2745
|
}
|
|
2579
2746
|
return rootProgram;
|
|
@@ -2932,7 +3099,7 @@ var require_first = __commonJS({
|
|
|
2932
3099
|
return {
|
|
2933
3100
|
Program(n) {
|
|
2934
3101
|
const body = n.body;
|
|
2935
|
-
if (!
|
|
3102
|
+
if (!body?.length) {
|
|
2936
3103
|
return;
|
|
2937
3104
|
}
|
|
2938
3105
|
const absoluteFirst = context.options[0] === "absolute-first";
|
|
@@ -3161,14 +3328,20 @@ var require_imports_first = __commonJS({
|
|
|
3161
3328
|
"node_modules/eslint-plugin-import-x/lib/rules/imports-first.js"(exports2, module2) {
|
|
3162
3329
|
"use strict";
|
|
3163
3330
|
var tslib_12 = require("tslib");
|
|
3164
|
-
var utils_1 =
|
|
3165
|
-
var docs_url_1 = require_docs_url();
|
|
3331
|
+
var utils_1 = require_utils();
|
|
3166
3332
|
var first_12 = tslib_12.__importDefault(require_first());
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3333
|
+
module2.exports = (0, utils_1.createRule)({
|
|
3334
|
+
...first_12.default,
|
|
3335
|
+
name: "imports-first",
|
|
3336
|
+
meta: {
|
|
3337
|
+
...first_12.default.meta,
|
|
3338
|
+
deprecated: true,
|
|
3339
|
+
docs: {
|
|
3340
|
+
category: "Style guide",
|
|
3341
|
+
description: "Replaced by `import-x/first`."
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
});
|
|
3172
3345
|
}
|
|
3173
3346
|
});
|
|
3174
3347
|
|
|
@@ -3202,26 +3375,29 @@ var require_max_dependencies = __commonJS({
|
|
|
3202
3375
|
defaultOptions: [],
|
|
3203
3376
|
create(context) {
|
|
3204
3377
|
const { ignoreTypeImports } = context.options[0] || {};
|
|
3205
|
-
const dependencies = /* @__PURE__ */ new Set();
|
|
3206
|
-
let lastNode;
|
|
3207
|
-
return
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
context.report({
|
|
3213
|
-
node: lastNode,
|
|
3214
|
-
messageId: "max",
|
|
3215
|
-
data: {
|
|
3216
|
-
max
|
|
3378
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
3379
|
+
let lastNode;
|
|
3380
|
+
return {
|
|
3381
|
+
"Program:exit"() {
|
|
3382
|
+
const { max = 10 } = context.options[0] || {};
|
|
3383
|
+
if (dependencies.size <= max) {
|
|
3384
|
+
return;
|
|
3217
3385
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3386
|
+
context.report({
|
|
3387
|
+
node: lastNode,
|
|
3388
|
+
messageId: "max",
|
|
3389
|
+
data: {
|
|
3390
|
+
max
|
|
3391
|
+
}
|
|
3392
|
+
});
|
|
3393
|
+
},
|
|
3394
|
+
...(0, utils_1.moduleVisitor)((source, node) => {
|
|
3395
|
+
if ("importKind" in node && node.importKind !== "type" || !ignoreTypeImports) {
|
|
3396
|
+
dependencies.add(source.value);
|
|
3397
|
+
}
|
|
3398
|
+
lastNode = source;
|
|
3399
|
+
}, { commonjs: true })
|
|
3400
|
+
};
|
|
3225
3401
|
}
|
|
3226
3402
|
});
|
|
3227
3403
|
}
|
|
@@ -3493,7 +3669,7 @@ var require_namespace = __commonJS({
|
|
|
3493
3669
|
return;
|
|
3494
3670
|
}
|
|
3495
3671
|
const parent = dereference.parent;
|
|
3496
|
-
if (
|
|
3672
|
+
if (parent?.type === "AssignmentExpression" && parent.left === dereference) {
|
|
3497
3673
|
context.report({
|
|
3498
3674
|
node: parent,
|
|
3499
3675
|
messageId: "namespaceMember",
|
|
@@ -3505,7 +3681,7 @@ var require_namespace = __commonJS({
|
|
|
3505
3681
|
let namespace = namespaces.get(dereference.object.name);
|
|
3506
3682
|
const namepath = [dereference.object.name];
|
|
3507
3683
|
let deref = dereference;
|
|
3508
|
-
while (namespace instanceof utils_1.ExportMap &&
|
|
3684
|
+
while (namespace instanceof utils_1.ExportMap && deref?.type === "MemberExpression") {
|
|
3509
3685
|
if (deref.computed) {
|
|
3510
3686
|
if (!allowComputed) {
|
|
3511
3687
|
context.report({
|
|
@@ -3622,15 +3798,13 @@ var require_newline_after_import = __commonJS({
|
|
|
3622
3798
|
return nextNode.loc.start.line - node.loc.end.line;
|
|
3623
3799
|
}
|
|
3624
3800
|
function isClassWithDecorator(node) {
|
|
3625
|
-
|
|
3626
|
-
return node.type === "ClassDeclaration" && !!((_a = node.decorators) === null || _a === void 0 ? void 0 : _a.length);
|
|
3801
|
+
return node.type === "ClassDeclaration" && !!node.decorators?.length;
|
|
3627
3802
|
}
|
|
3628
3803
|
function isExportDefaultClass(node) {
|
|
3629
3804
|
return node.type === "ExportDefaultDeclaration" && node.declaration.type === "ClassDeclaration";
|
|
3630
3805
|
}
|
|
3631
3806
|
function isExportNameClass(node) {
|
|
3632
|
-
|
|
3633
|
-
return node.type === "ExportNamedDeclaration" && ((_a = node.declaration) === null || _a === void 0 ? void 0 : _a.type) === "ClassDeclaration";
|
|
3807
|
+
return node.type === "ExportNamedDeclaration" && node.declaration?.type === "ClassDeclaration";
|
|
3634
3808
|
}
|
|
3635
3809
|
module2.exports = (0, utils_1.createRule)({
|
|
3636
3810
|
name: "newline-after-import",
|
|
@@ -3663,7 +3837,12 @@ var require_newline_after_import = __commonJS({
|
|
|
3663
3837
|
create(context) {
|
|
3664
3838
|
let level = 0;
|
|
3665
3839
|
const requireCalls = [];
|
|
3666
|
-
const options =
|
|
3840
|
+
const options = {
|
|
3841
|
+
count: 1,
|
|
3842
|
+
exactCount: false,
|
|
3843
|
+
considerComments: false,
|
|
3844
|
+
...context.options[0]
|
|
3845
|
+
};
|
|
3667
3846
|
function checkForNewLine(node, nextNode, type) {
|
|
3668
3847
|
if (isExportDefaultClass(nextNode) || isExportNameClass(nextNode)) {
|
|
3669
3848
|
const classNode = nextNode.declaration;
|
|
@@ -3695,7 +3874,7 @@ var require_newline_after_import = __commonJS({
|
|
|
3695
3874
|
});
|
|
3696
3875
|
}
|
|
3697
3876
|
}
|
|
3698
|
-
function commentAfterImport(node, nextComment) {
|
|
3877
|
+
function commentAfterImport(node, nextComment, type) {
|
|
3699
3878
|
const lineDifference = getLineDifference(node, nextComment);
|
|
3700
3879
|
const EXPECTED_LINE_DIFFERENCE = options.count + 1;
|
|
3701
3880
|
if (lineDifference < EXPECTED_LINE_DIFFERENCE) {
|
|
@@ -3712,7 +3891,7 @@ var require_newline_after_import = __commonJS({
|
|
|
3712
3891
|
data: {
|
|
3713
3892
|
count: options.count,
|
|
3714
3893
|
lineSuffix: options.count > 1 ? "s" : "",
|
|
3715
|
-
type
|
|
3894
|
+
type
|
|
3716
3895
|
},
|
|
3717
3896
|
fix: options.exactCount && EXPECTED_LINE_DIFFERENCE < lineDifference ? void 0 : (fixer) => fixer.insertTextAfter(node, "\n".repeat(EXPECTED_LINE_DIFFERENCE - lineDifference))
|
|
3718
3897
|
});
|
|
@@ -3741,7 +3920,7 @@ var require_newline_after_import = __commonJS({
|
|
|
3741
3920
|
return;
|
|
3742
3921
|
}
|
|
3743
3922
|
if (nextComment) {
|
|
3744
|
-
commentAfterImport(node, nextComment);
|
|
3923
|
+
commentAfterImport(node, nextComment, "import");
|
|
3745
3924
|
} else if (nextNode && nextNode.type !== "ImportDeclaration" && (nextNode.type !== "TSImportEqualsDeclaration" || nextNode.isExport)) {
|
|
3746
3925
|
checkForNewLine(node, nextNode, "import");
|
|
3747
3926
|
}
|
|
@@ -3768,7 +3947,16 @@ var require_newline_after_import = __commonJS({
|
|
|
3768
3947
|
continue;
|
|
3769
3948
|
}
|
|
3770
3949
|
if (nextStatement && (!nextRequireCall || !containsNodeOrEqual(nextStatement, nextRequireCall))) {
|
|
3771
|
-
|
|
3950
|
+
let nextComment;
|
|
3951
|
+
if ("comments" in statementWithRequireCall.parent && statementWithRequireCall.parent.comments !== void 0 && options.considerComments) {
|
|
3952
|
+
const endLine = node2.loc.end.line;
|
|
3953
|
+
nextComment = statementWithRequireCall.parent.comments.find((o) => o.loc.start.line >= endLine && o.loc.start.line <= endLine + options.count + 1);
|
|
3954
|
+
}
|
|
3955
|
+
if (nextComment && nextComment !== void 0) {
|
|
3956
|
+
commentAfterImport(statementWithRequireCall, nextComment, "require");
|
|
3957
|
+
} else {
|
|
3958
|
+
checkForNewLine(statementWithRequireCall, nextStatement, "require");
|
|
3959
|
+
}
|
|
3772
3960
|
}
|
|
3773
3961
|
}
|
|
3774
3962
|
},
|
|
@@ -3813,7 +4001,7 @@ var require_no_absolute_path = __commonJS({
|
|
|
3813
4001
|
},
|
|
3814
4002
|
defaultOptions: [],
|
|
3815
4003
|
create(context) {
|
|
3816
|
-
const options =
|
|
4004
|
+
const options = { esmodule: true, commonjs: true, ...context.options[0] };
|
|
3817
4005
|
return (0, utils_1.moduleVisitor)((source) => {
|
|
3818
4006
|
if (!(0, utils_1.isAbsolute)(source.value)) {
|
|
3819
4007
|
return;
|
|
@@ -4004,7 +4192,7 @@ var require_no_anonymous_default_export = __commonJS({
|
|
|
4004
4192
|
},
|
|
4005
4193
|
defaultOptions: [],
|
|
4006
4194
|
create(context) {
|
|
4007
|
-
const options =
|
|
4195
|
+
const options = { ...defaults, ...context.options[0] };
|
|
4008
4196
|
return {
|
|
4009
4197
|
ExportDefaultDeclaration(node) {
|
|
4010
4198
|
const type = node.declaration.type;
|
|
@@ -4211,67 +4399,70 @@ var require_no_cycle = __commonJS({
|
|
|
4211
4399
|
const options = context.options[0] || {};
|
|
4212
4400
|
const maxDepth = typeof options.maxDepth === "number" ? options.maxDepth : Number.POSITIVE_INFINITY;
|
|
4213
4401
|
const ignoreModule = options.ignoreExternal ? (name) => (0, utils_1.isExternalModule)(name, (0, utils_1.resolve)(name, context), context) : () => false;
|
|
4214
|
-
return
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
}
|
|
4218
|
-
if (options.allowUnsafeDynamicCyclicDependency && (importer.type === "ImportExpression" || importer.type === "CallExpression" && "name" in importer.callee && importer.callee.name !== "require")) {
|
|
4219
|
-
return;
|
|
4220
|
-
}
|
|
4221
|
-
if (importer.type === "ImportDeclaration" && (importer.importKind === "type" || importer.specifiers.every((s) => "importKind" in s && s.importKind === "type"))) {
|
|
4222
|
-
return;
|
|
4223
|
-
}
|
|
4224
|
-
const imported = utils_1.ExportMap.get(sourceNode.value, context);
|
|
4225
|
-
if (imported == null) {
|
|
4226
|
-
return;
|
|
4227
|
-
}
|
|
4228
|
-
if (imported.path === filename) {
|
|
4229
|
-
return;
|
|
4230
|
-
}
|
|
4231
|
-
const untraversed = [{ mget: () => imported, route: [] }];
|
|
4232
|
-
function detectCycle({ mget, route }) {
|
|
4233
|
-
const m = mget();
|
|
4234
|
-
if (m == null) {
|
|
4402
|
+
return {
|
|
4403
|
+
...(0, utils_1.moduleVisitor)(function checkSourceValue(sourceNode, importer) {
|
|
4404
|
+
if (ignoreModule(sourceNode.value)) {
|
|
4235
4405
|
return;
|
|
4236
4406
|
}
|
|
4237
|
-
if (
|
|
4407
|
+
if (options.allowUnsafeDynamicCyclicDependency && (importer.type === "ImportExpression" || importer.type === "CallExpression" && "name" in importer.callee && importer.callee.name !== "require")) {
|
|
4238
4408
|
return;
|
|
4239
4409
|
}
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4410
|
+
if (importer.type === "ImportDeclaration" && (importer.importKind === "type" || importer.specifiers.every((s) => "importKind" in s && s.importKind === "type"))) {
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
const imported = utils_1.ExportMap.get(sourceNode.value, context);
|
|
4414
|
+
if (imported == null) {
|
|
4415
|
+
return;
|
|
4416
|
+
}
|
|
4417
|
+
if (imported.path === filename) {
|
|
4418
|
+
return;
|
|
4419
|
+
}
|
|
4420
|
+
const untraversed = [{ mget: () => imported, route: [] }];
|
|
4421
|
+
function detectCycle({ mget, route }) {
|
|
4422
|
+
const m = mget();
|
|
4423
|
+
if (m == null) {
|
|
4247
4424
|
return;
|
|
4248
4425
|
}
|
|
4249
|
-
if (path
|
|
4250
|
-
return
|
|
4426
|
+
if (traversed.has(m.path)) {
|
|
4427
|
+
return;
|
|
4251
4428
|
}
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4429
|
+
traversed.add(m.path);
|
|
4430
|
+
for (const [path, { getter, declarations }] of m.imports) {
|
|
4431
|
+
if (traversed.has(path)) {
|
|
4432
|
+
continue;
|
|
4433
|
+
}
|
|
4434
|
+
const toTraverse = [...declarations].filter(({ source, isOnlyImportingTypes }) => !ignoreModule(source.value) && !isOnlyImportingTypes);
|
|
4435
|
+
if (options.allowUnsafeDynamicCyclicDependency && toTraverse.some((d) => d.dynamic)) {
|
|
4436
|
+
return;
|
|
4437
|
+
}
|
|
4438
|
+
if (path === filename && toTraverse.length > 0) {
|
|
4439
|
+
return true;
|
|
4440
|
+
}
|
|
4441
|
+
if (route.length + 1 < maxDepth) {
|
|
4442
|
+
for (const { source } of toTraverse) {
|
|
4443
|
+
untraversed.push({ mget: getter, route: [...route, source] });
|
|
4444
|
+
}
|
|
4255
4445
|
}
|
|
4256
4446
|
}
|
|
4257
4447
|
}
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
}
|
|
4268
|
-
|
|
4269
|
-
|
|
4448
|
+
while (untraversed.length > 0) {
|
|
4449
|
+
const next = untraversed.shift();
|
|
4450
|
+
if (detectCycle(next)) {
|
|
4451
|
+
context.report({
|
|
4452
|
+
node: importer,
|
|
4453
|
+
messageId: "cycle",
|
|
4454
|
+
data: {
|
|
4455
|
+
source: next.route.length > 0 ? `via ${routeString(next.route)}` : "detected."
|
|
4456
|
+
}
|
|
4457
|
+
});
|
|
4458
|
+
return;
|
|
4459
|
+
}
|
|
4270
4460
|
}
|
|
4461
|
+
}, context.options[0]),
|
|
4462
|
+
"Program:exit"() {
|
|
4463
|
+
traversed.clear();
|
|
4271
4464
|
}
|
|
4272
|
-
}
|
|
4273
|
-
traversed.clear();
|
|
4274
|
-
} });
|
|
4465
|
+
};
|
|
4275
4466
|
}
|
|
4276
4467
|
});
|
|
4277
4468
|
}
|
|
@@ -4376,7 +4567,6 @@ var require_no_deprecated = __commonJS({
|
|
|
4376
4567
|
const namespaces = /* @__PURE__ */ new Map();
|
|
4377
4568
|
return {
|
|
4378
4569
|
Program({ body }) {
|
|
4379
|
-
var _a;
|
|
4380
4570
|
for (const node of body) {
|
|
4381
4571
|
if (node.type !== "ImportDeclaration") {
|
|
4382
4572
|
continue;
|
|
@@ -4388,9 +4578,12 @@ var require_no_deprecated = __commonJS({
|
|
|
4388
4578
|
if (imports == null) {
|
|
4389
4579
|
continue;
|
|
4390
4580
|
}
|
|
4391
|
-
const moduleDeprecation =
|
|
4581
|
+
const moduleDeprecation = imports.doc?.tags.find((t) => t.title === "deprecated");
|
|
4392
4582
|
if (moduleDeprecation) {
|
|
4393
|
-
context.report(
|
|
4583
|
+
context.report({
|
|
4584
|
+
node,
|
|
4585
|
+
...message(moduleDeprecation)
|
|
4586
|
+
});
|
|
4394
4587
|
}
|
|
4395
4588
|
if (imports.errors.length > 0) {
|
|
4396
4589
|
imports.reportErrors(context, node);
|
|
@@ -4432,7 +4625,10 @@ var require_no_deprecated = __commonJS({
|
|
|
4432
4625
|
if (!deprecation) {
|
|
4433
4626
|
continue;
|
|
4434
4627
|
}
|
|
4435
|
-
context.report(
|
|
4628
|
+
context.report({
|
|
4629
|
+
node: im,
|
|
4630
|
+
...message(deprecation)
|
|
4631
|
+
});
|
|
4436
4632
|
deprecated.set(local, deprecation);
|
|
4437
4633
|
}
|
|
4438
4634
|
}
|
|
@@ -4450,7 +4646,10 @@ var require_no_deprecated = __commonJS({
|
|
|
4450
4646
|
if ((0, utils_1.declaredScope)(context, node, node.name) !== "module") {
|
|
4451
4647
|
return;
|
|
4452
4648
|
}
|
|
4453
|
-
context.report(
|
|
4649
|
+
context.report({
|
|
4650
|
+
node,
|
|
4651
|
+
...message(deprecated.get(node.name))
|
|
4652
|
+
});
|
|
4454
4653
|
},
|
|
4455
4654
|
MemberExpression(dereference) {
|
|
4456
4655
|
if (dereference.object.type !== "Identifier") {
|
|
@@ -4465,7 +4664,7 @@ var require_no_deprecated = __commonJS({
|
|
|
4465
4664
|
let namespace = namespaces.get(dereference.object.name);
|
|
4466
4665
|
const namepath = [dereference.object.name];
|
|
4467
4666
|
let node = dereference;
|
|
4468
|
-
while (namespace instanceof utils_1.ExportMap &&
|
|
4667
|
+
while (namespace instanceof utils_1.ExportMap && node?.type === "MemberExpression") {
|
|
4469
4668
|
if (node.computed) {
|
|
4470
4669
|
return;
|
|
4471
4670
|
}
|
|
@@ -4475,7 +4674,10 @@ var require_no_deprecated = __commonJS({
|
|
|
4475
4674
|
}
|
|
4476
4675
|
const deprecation = getDeprecation(metadata);
|
|
4477
4676
|
if (deprecation) {
|
|
4478
|
-
context.report(
|
|
4677
|
+
context.report({
|
|
4678
|
+
node: node.property,
|
|
4679
|
+
...message(deprecation)
|
|
4680
|
+
});
|
|
4479
4681
|
}
|
|
4480
4682
|
namepath.push(node.property.name);
|
|
4481
4683
|
namespace = metadata.namespace;
|
|
@@ -4500,7 +4702,7 @@ var require_no_duplicates = __commonJS({
|
|
|
4500
4702
|
let typescriptPkg;
|
|
4501
4703
|
try {
|
|
4502
4704
|
typescriptPkg = require("typescript/package.json");
|
|
4503
|
-
} catch
|
|
4705
|
+
} catch {
|
|
4504
4706
|
}
|
|
4505
4707
|
return !typescriptPkg || !semver_1.default.satisfies(typescriptPkg.version, ">= 4.5");
|
|
4506
4708
|
});
|
|
@@ -4588,6 +4790,18 @@ var require_no_duplicates = __commonJS({
|
|
|
4588
4790
|
];
|
|
4589
4791
|
}, ["", !firstHasTrailingComma && !firstIsEmpty, firstExistingIdentifiers]);
|
|
4590
4792
|
const fixes = [];
|
|
4793
|
+
if (shouldAddSpecifiers && preferInline && first.importKind === "type") {
|
|
4794
|
+
const typeIdentifierToken = tokens.find((token) => token.type === "Identifier" && token.value === "type");
|
|
4795
|
+
if (typeIdentifierToken) {
|
|
4796
|
+
fixes.push(fixer.removeRange([
|
|
4797
|
+
typeIdentifierToken.range[0],
|
|
4798
|
+
typeIdentifierToken.range[1] + 1
|
|
4799
|
+
]));
|
|
4800
|
+
}
|
|
4801
|
+
for (const identifier of tokens.filter((token) => firstExistingIdentifiers.has(token.value))) {
|
|
4802
|
+
fixes.push(fixer.replaceTextRange([identifier.range[0], identifier.range[1]], `type ${identifier.value}`));
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4591
4805
|
if (openBrace == null && shouldAddSpecifiers && shouldAddDefault()) {
|
|
4592
4806
|
fixes.push(fixer.insertTextAfter(firstToken, ` ${defaultImportName}, {${specifiersText}} from`));
|
|
4593
4807
|
} else if (openBrace == null && !shouldAddSpecifiers && shouldAddDefault()) {
|
|
@@ -4634,7 +4848,7 @@ var require_no_duplicates = __commonJS({
|
|
|
4634
4848
|
}
|
|
4635
4849
|
function getDefaultImportName(node) {
|
|
4636
4850
|
const defaultSpecifier = node.specifiers.find((specifier) => specifier.type === "ImportDefaultSpecifier");
|
|
4637
|
-
return defaultSpecifier
|
|
4851
|
+
return defaultSpecifier?.local.name;
|
|
4638
4852
|
}
|
|
4639
4853
|
function hasNamespace(node) {
|
|
4640
4854
|
return node.specifiers.some((specifier) => specifier.type === "ImportNamespaceSpecifier");
|
|
@@ -4690,9 +4904,8 @@ var require_no_duplicates = __commonJS({
|
|
|
4690
4904
|
},
|
|
4691
4905
|
defaultOptions: [],
|
|
4692
4906
|
create(context) {
|
|
4693
|
-
|
|
4694
|
-
const
|
|
4695
|
-
const considerQueryStringOption = (_b = context.options[0]) === null || _b === void 0 ? void 0 : _b.considerQueryString;
|
|
4907
|
+
const preferInline = context.options[0]?.["prefer-inline"];
|
|
4908
|
+
const considerQueryStringOption = context.options[0]?.considerQueryString;
|
|
4696
4909
|
const defaultResolver = (sourcePath) => (0, utils_1.resolve)(sourcePath, context) || sourcePath;
|
|
4697
4910
|
const resolver = considerQueryStringOption ? (sourcePath) => {
|
|
4698
4911
|
const parts = sourcePath.match(/^([^?]*)\?(.*)$/);
|
|
@@ -5057,7 +5270,7 @@ var require_no_extraneous_dependencies = __commonJS({
|
|
|
5057
5270
|
isInBundledDeps: result.isInBundledDeps || deps.bundledDependencies.includes(ancestorName)
|
|
5058
5271
|
}), newDeclarationStatus);
|
|
5059
5272
|
}
|
|
5060
|
-
function reportIfMissing(context, deps, depsOptions, node, name) {
|
|
5273
|
+
function reportIfMissing(context, deps, depsOptions, node, name, whitelist) {
|
|
5061
5274
|
if (!depsOptions.verifyTypeImports && ("importKind" in node && (node.importKind === "type" || node.importKind === "typeof") || "exportKind" in node && node.exportKind === "type" || "specifiers" in node && Array.isArray(node.specifiers) && node.specifiers.length > 0 && node.specifiers.every((specifier) => "importKind" in specifier && (specifier.importKind === "type" || specifier.importKind === "typeof")))) {
|
|
5062
5275
|
return;
|
|
5063
5276
|
}
|
|
@@ -5082,6 +5295,9 @@ var require_no_extraneous_dependencies = __commonJS({
|
|
|
5082
5295
|
}
|
|
5083
5296
|
}
|
|
5084
5297
|
const packageName = realPackageName || importPackageName;
|
|
5298
|
+
if (whitelist?.has(packageName)) {
|
|
5299
|
+
return;
|
|
5300
|
+
}
|
|
5085
5301
|
if (declarationStatus.isInDevDeps && !depsOptions.allowDevDeps) {
|
|
5086
5302
|
context.report({
|
|
5087
5303
|
node,
|
|
@@ -5134,7 +5350,8 @@ var require_no_extraneous_dependencies = __commonJS({
|
|
|
5134
5350
|
bundledDependencies: { type: ["boolean", "array"] },
|
|
5135
5351
|
packageDir: { type: ["string", "array"] },
|
|
5136
5352
|
includeInternal: { type: ["boolean"] },
|
|
5137
|
-
includeTypes: { type: ["boolean"] }
|
|
5353
|
+
includeTypes: { type: ["boolean"] },
|
|
5354
|
+
whitelist: { type: ["array"] }
|
|
5138
5355
|
},
|
|
5139
5356
|
additionalProperties: false
|
|
5140
5357
|
}
|
|
@@ -5160,11 +5377,14 @@ var require_no_extraneous_dependencies = __commonJS({
|
|
|
5160
5377
|
verifyInternalDeps: !!options.includeInternal,
|
|
5161
5378
|
verifyTypeImports: !!options.includeTypes
|
|
5162
5379
|
};
|
|
5163
|
-
return
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5380
|
+
return {
|
|
5381
|
+
...(0, utils_1.moduleVisitor)((source, node) => {
|
|
5382
|
+
reportIfMissing(context, deps, depsOptions, node, source.value, options.whitelist ? new Set(options.whitelist) : void 0);
|
|
5383
|
+
}, { commonjs: true }),
|
|
5384
|
+
"Program:exit"() {
|
|
5385
|
+
depFieldCache.clear();
|
|
5386
|
+
}
|
|
5387
|
+
};
|
|
5168
5388
|
}
|
|
5169
5389
|
});
|
|
5170
5390
|
}
|
|
@@ -5184,13 +5404,13 @@ var require_no_import_module_exports = __commonJS({
|
|
|
5184
5404
|
});
|
|
5185
5405
|
try {
|
|
5186
5406
|
return require.resolve(node_path_1.default.dirname(pkgPath));
|
|
5187
|
-
} catch
|
|
5407
|
+
} catch {
|
|
5188
5408
|
return null;
|
|
5189
5409
|
}
|
|
5190
5410
|
}
|
|
5191
5411
|
function findScope(context, identifier) {
|
|
5192
5412
|
const { scopeManager } = context.sourceCode;
|
|
5193
|
-
return scopeManager
|
|
5413
|
+
return scopeManager?.scopes.slice().reverse().find((scope) => scope.variables.some((variable) => variable.identifiers.some((node) => node.name === identifier)));
|
|
5194
5414
|
}
|
|
5195
5415
|
function findDefinition(objectScope, identifier) {
|
|
5196
5416
|
const variable = objectScope.variables.find((variable2) => variable2.name === identifier);
|
|
@@ -5230,7 +5450,6 @@ var require_no_import_module_exports = __commonJS({
|
|
|
5230
5450
|
importDeclarations.push(node);
|
|
5231
5451
|
},
|
|
5232
5452
|
MemberExpression(node) {
|
|
5233
|
-
var _a;
|
|
5234
5453
|
if (alreadyReported) {
|
|
5235
5454
|
return;
|
|
5236
5455
|
}
|
|
@@ -5243,9 +5462,9 @@ var require_no_import_module_exports = __commonJS({
|
|
|
5243
5462
|
const hasKeywords = /^(module|exports)$/.test(node.object.name);
|
|
5244
5463
|
const objectScope = hasKeywords ? findScope(context, node.object.name) : void 0;
|
|
5245
5464
|
const variableDefinition = objectScope && findDefinition(objectScope, node.object.name);
|
|
5246
|
-
const isImportBinding =
|
|
5465
|
+
const isImportBinding = variableDefinition?.type === "ImportBinding";
|
|
5247
5466
|
const hasCJSExportReference = hasKeywords && (!objectScope || objectScope.type === "module");
|
|
5248
|
-
const isException = !!
|
|
5467
|
+
const isException = !!options.exceptions?.some((glob) => (0, minimatch_1.minimatch)(filename, glob));
|
|
5249
5468
|
if (isIdentifier && hasCJSExportReference && !isEntryPoint && !isException && !isImportBinding) {
|
|
5250
5469
|
for (const importDeclaration of importDeclarations) {
|
|
5251
5470
|
context.report({
|
|
@@ -5470,33 +5689,35 @@ var require_no_named_as_default = __commonJS({
|
|
|
5470
5689
|
},
|
|
5471
5690
|
defaultOptions: [],
|
|
5472
5691
|
create(context) {
|
|
5473
|
-
function
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5692
|
+
function createCheckDefault(nameKey) {
|
|
5693
|
+
return function checkDefault(defaultSpecifier) {
|
|
5694
|
+
const nameValue = defaultSpecifier[nameKey].name;
|
|
5695
|
+
if (nameValue === "default") {
|
|
5696
|
+
return;
|
|
5697
|
+
}
|
|
5698
|
+
const declaration = (0, utils_1.importDeclaration)(context, defaultSpecifier);
|
|
5699
|
+
const exportMapOfImported = utils_1.ExportMap.get(declaration.source.value, context);
|
|
5700
|
+
if (exportMapOfImported == null) {
|
|
5701
|
+
return;
|
|
5702
|
+
}
|
|
5703
|
+
if (exportMapOfImported.errors.length > 0) {
|
|
5704
|
+
exportMapOfImported.reportErrors(context, declaration);
|
|
5705
|
+
return;
|
|
5706
|
+
}
|
|
5707
|
+
if (exportMapOfImported.exports.has("default") && exportMapOfImported.exports.has(nameValue)) {
|
|
5708
|
+
context.report({
|
|
5709
|
+
node: defaultSpecifier,
|
|
5710
|
+
messageId: "default",
|
|
5711
|
+
data: {
|
|
5712
|
+
name: nameValue
|
|
5713
|
+
}
|
|
5714
|
+
});
|
|
5715
|
+
}
|
|
5716
|
+
};
|
|
5496
5717
|
}
|
|
5497
5718
|
return {
|
|
5498
|
-
ImportDefaultSpecifier:
|
|
5499
|
-
ExportDefaultSpecifier:
|
|
5719
|
+
ImportDefaultSpecifier: createCheckDefault("local"),
|
|
5720
|
+
ExportDefaultSpecifier: createCheckDefault("exported")
|
|
5500
5721
|
};
|
|
5501
5722
|
}
|
|
5502
5723
|
});
|
|
@@ -5552,8 +5773,7 @@ var require_no_named_as_default_member = __commonJS({
|
|
|
5552
5773
|
}
|
|
5553
5774
|
},
|
|
5554
5775
|
VariableDeclarator(node) {
|
|
5555
|
-
|
|
5556
|
-
const isDestructure = node.id.type === "ObjectPattern" && ((_a = node.init) === null || _a === void 0 ? void 0 : _a.type) === "Identifier";
|
|
5776
|
+
const isDestructure = node.id.type === "ObjectPattern" && node.init?.type === "Identifier";
|
|
5557
5777
|
if (!isDestructure || !node.init || !("name" in node.init) || !("properties" in node.id)) {
|
|
5558
5778
|
return;
|
|
5559
5779
|
}
|
|
@@ -5758,7 +5978,7 @@ var require_no_namespace = __commonJS({
|
|
|
5758
5978
|
const ignoreGlobs = firstOption.ignore;
|
|
5759
5979
|
return {
|
|
5760
5980
|
ImportNamespaceSpecifier(node) {
|
|
5761
|
-
if (ignoreGlobs
|
|
5981
|
+
if (ignoreGlobs?.find((glob) => (0, minimatch_1.minimatch)(node.parent.source.value, glob, { matchBase: true }))) {
|
|
5762
5982
|
return;
|
|
5763
5983
|
}
|
|
5764
5984
|
const scopeVariables = context.sourceCode.getScope(node).variables;
|
|
@@ -5979,6 +6199,254 @@ var require_no_relative_parent_imports = __commonJS({
|
|
|
5979
6199
|
}
|
|
5980
6200
|
});
|
|
5981
6201
|
|
|
6202
|
+
// node_modules/eslint-plugin-import-x/lib/rules/no-rename-default.js
|
|
6203
|
+
var require_no_rename_default = __commonJS({
|
|
6204
|
+
"node_modules/eslint-plugin-import-x/lib/rules/no-rename-default.js"(exports2, module2) {
|
|
6205
|
+
"use strict";
|
|
6206
|
+
var tslib_12 = require("tslib");
|
|
6207
|
+
var node_path_1 = tslib_12.__importDefault(require("node:path"));
|
|
6208
|
+
var utils_1 = require_utils();
|
|
6209
|
+
function findDefaultDestructure(properties) {
|
|
6210
|
+
const found = properties.find((property) => {
|
|
6211
|
+
if ("key" in property && "name" in property.key && property.key.name === "default") {
|
|
6212
|
+
return property;
|
|
6213
|
+
}
|
|
6214
|
+
});
|
|
6215
|
+
return found;
|
|
6216
|
+
}
|
|
6217
|
+
function getDefaultExportNode(exportMap) {
|
|
6218
|
+
const defaultExportNode = exportMap.exports.get("default");
|
|
6219
|
+
if (defaultExportNode == null) {
|
|
6220
|
+
return;
|
|
6221
|
+
}
|
|
6222
|
+
switch (defaultExportNode.type) {
|
|
6223
|
+
case "ExportDefaultDeclaration": {
|
|
6224
|
+
return defaultExportNode.declaration;
|
|
6225
|
+
}
|
|
6226
|
+
case "ExportNamedDeclaration": {
|
|
6227
|
+
return defaultExportNode.specifiers.find((specifier) => specifier.exported.name === "default");
|
|
6228
|
+
}
|
|
6229
|
+
default: {
|
|
6230
|
+
return;
|
|
6231
|
+
}
|
|
6232
|
+
}
|
|
6233
|
+
}
|
|
6234
|
+
module2.exports = (0, utils_1.createRule)({
|
|
6235
|
+
name: "no-rename-default",
|
|
6236
|
+
meta: {
|
|
6237
|
+
type: "suggestion",
|
|
6238
|
+
docs: {
|
|
6239
|
+
category: "Helpful warnings",
|
|
6240
|
+
description: "Forbid importing a default export by a different name."
|
|
6241
|
+
},
|
|
6242
|
+
schema: [
|
|
6243
|
+
{
|
|
6244
|
+
type: "object",
|
|
6245
|
+
properties: {
|
|
6246
|
+
commonjs: {
|
|
6247
|
+
default: false,
|
|
6248
|
+
type: "boolean"
|
|
6249
|
+
},
|
|
6250
|
+
preventRenamingBindings: {
|
|
6251
|
+
default: true,
|
|
6252
|
+
type: "boolean"
|
|
6253
|
+
}
|
|
6254
|
+
},
|
|
6255
|
+
additionalProperties: false
|
|
6256
|
+
}
|
|
6257
|
+
],
|
|
6258
|
+
messages: {
|
|
6259
|
+
renameDefault: "Caution: `{{importBasename}}` has a default export `{{defaultExportName}}`. This {{requiresOrImports}} `{{defaultExportName}}` as `{{importName}}`. Check if you meant to write `{{suggestion}}` instead."
|
|
6260
|
+
}
|
|
6261
|
+
},
|
|
6262
|
+
defaultOptions: [],
|
|
6263
|
+
create(context) {
|
|
6264
|
+
const { commonjs = false, preventRenamingBindings = true } = context.options[0] || {};
|
|
6265
|
+
function getDefaultExportName(targetNode) {
|
|
6266
|
+
if (targetNode == null) {
|
|
6267
|
+
return;
|
|
6268
|
+
}
|
|
6269
|
+
switch (targetNode.type) {
|
|
6270
|
+
case "AssignmentExpression": {
|
|
6271
|
+
if (!preventRenamingBindings) {
|
|
6272
|
+
return;
|
|
6273
|
+
}
|
|
6274
|
+
if (targetNode.left.type !== "Identifier") {
|
|
6275
|
+
return;
|
|
6276
|
+
}
|
|
6277
|
+
return targetNode.left.name;
|
|
6278
|
+
}
|
|
6279
|
+
case "CallExpression": {
|
|
6280
|
+
const [argumentNode] = targetNode.arguments;
|
|
6281
|
+
return getDefaultExportName(argumentNode);
|
|
6282
|
+
}
|
|
6283
|
+
case "ClassDeclaration": {
|
|
6284
|
+
if (targetNode.id && typeof targetNode.id.name === "string") {
|
|
6285
|
+
return targetNode.id.name;
|
|
6286
|
+
}
|
|
6287
|
+
return;
|
|
6288
|
+
}
|
|
6289
|
+
case "ExportSpecifier": {
|
|
6290
|
+
return targetNode.local.name;
|
|
6291
|
+
}
|
|
6292
|
+
case "FunctionDeclaration": {
|
|
6293
|
+
return targetNode.id?.name;
|
|
6294
|
+
}
|
|
6295
|
+
case "Identifier": {
|
|
6296
|
+
if (!preventRenamingBindings) {
|
|
6297
|
+
return;
|
|
6298
|
+
}
|
|
6299
|
+
return targetNode.name;
|
|
6300
|
+
}
|
|
6301
|
+
default:
|
|
6302
|
+
}
|
|
6303
|
+
}
|
|
6304
|
+
function getExportMap(source) {
|
|
6305
|
+
if (!source) {
|
|
6306
|
+
return;
|
|
6307
|
+
}
|
|
6308
|
+
const exportMap = utils_1.ExportMap.get(source.value, context);
|
|
6309
|
+
if (exportMap == null) {
|
|
6310
|
+
return;
|
|
6311
|
+
}
|
|
6312
|
+
if (exportMap.errors.length > 0) {
|
|
6313
|
+
exportMap.reportErrors(context, { source });
|
|
6314
|
+
return;
|
|
6315
|
+
}
|
|
6316
|
+
return exportMap;
|
|
6317
|
+
}
|
|
6318
|
+
function handleImport(node) {
|
|
6319
|
+
const exportMap = getExportMap(node.parent.source);
|
|
6320
|
+
if (exportMap == null) {
|
|
6321
|
+
return;
|
|
6322
|
+
}
|
|
6323
|
+
const defaultExportNode = getDefaultExportNode(exportMap);
|
|
6324
|
+
if (defaultExportNode == null) {
|
|
6325
|
+
return;
|
|
6326
|
+
}
|
|
6327
|
+
const defaultExportName = getDefaultExportName(defaultExportNode);
|
|
6328
|
+
if (defaultExportName === void 0) {
|
|
6329
|
+
return;
|
|
6330
|
+
}
|
|
6331
|
+
const importTarget = node.parent.source?.value;
|
|
6332
|
+
const importBasename = node_path_1.default.basename(exportMap.path);
|
|
6333
|
+
if (node.type === "ImportDefaultSpecifier") {
|
|
6334
|
+
const importName = node.local.name;
|
|
6335
|
+
if (importName === defaultExportName) {
|
|
6336
|
+
return;
|
|
6337
|
+
}
|
|
6338
|
+
context.report({
|
|
6339
|
+
node,
|
|
6340
|
+
messageId: "renameDefault",
|
|
6341
|
+
data: {
|
|
6342
|
+
importBasename,
|
|
6343
|
+
defaultExportName,
|
|
6344
|
+
importName,
|
|
6345
|
+
requiresOrImports: "imports",
|
|
6346
|
+
suggestion: `import ${defaultExportName} from '${importTarget}'`
|
|
6347
|
+
}
|
|
6348
|
+
});
|
|
6349
|
+
return;
|
|
6350
|
+
}
|
|
6351
|
+
if (node.type !== "ImportSpecifier") {
|
|
6352
|
+
return;
|
|
6353
|
+
}
|
|
6354
|
+
if (node.imported.name !== "default") {
|
|
6355
|
+
return;
|
|
6356
|
+
}
|
|
6357
|
+
const actualImportedName = node.local.name;
|
|
6358
|
+
if (actualImportedName === defaultExportName) {
|
|
6359
|
+
return;
|
|
6360
|
+
}
|
|
6361
|
+
context.report({
|
|
6362
|
+
node,
|
|
6363
|
+
messageId: "renameDefault",
|
|
6364
|
+
data: {
|
|
6365
|
+
importBasename,
|
|
6366
|
+
defaultExportName,
|
|
6367
|
+
importName: actualImportedName,
|
|
6368
|
+
requiresOrImports: "imports",
|
|
6369
|
+
suggestion: `import { default as ${defaultExportName} } from '${importTarget}'`
|
|
6370
|
+
}
|
|
6371
|
+
});
|
|
6372
|
+
}
|
|
6373
|
+
function handleRequire(node) {
|
|
6374
|
+
if (!commonjs || node.type !== "VariableDeclarator" || !node.id || !(node.id.type === "Identifier" || node.id.type === "ObjectPattern") || !node.init || node.init.type !== "CallExpression") {
|
|
6375
|
+
return;
|
|
6376
|
+
}
|
|
6377
|
+
let defaultDestructure;
|
|
6378
|
+
if (node.id.type === "ObjectPattern") {
|
|
6379
|
+
defaultDestructure = findDefaultDestructure(node.id.properties);
|
|
6380
|
+
if (defaultDestructure === void 0) {
|
|
6381
|
+
return;
|
|
6382
|
+
}
|
|
6383
|
+
}
|
|
6384
|
+
const call = node.init;
|
|
6385
|
+
const [source] = call.arguments;
|
|
6386
|
+
if (call.callee.type !== "Identifier" || call.callee.name !== "require" || call.arguments.length !== 1 || source.type !== "Literal" || typeof source.value !== "string") {
|
|
6387
|
+
return;
|
|
6388
|
+
}
|
|
6389
|
+
const exportMap = getExportMap(source);
|
|
6390
|
+
if (exportMap == null) {
|
|
6391
|
+
return;
|
|
6392
|
+
}
|
|
6393
|
+
const defaultExportNode = getDefaultExportNode(exportMap);
|
|
6394
|
+
if (defaultExportNode == null) {
|
|
6395
|
+
return;
|
|
6396
|
+
}
|
|
6397
|
+
const defaultExportName = getDefaultExportName(defaultExportNode);
|
|
6398
|
+
const requireTarget = source.value;
|
|
6399
|
+
const requireBasename = node_path_1.default.basename(exportMap.path);
|
|
6400
|
+
let requireName;
|
|
6401
|
+
if (node.id.type === "Identifier") {
|
|
6402
|
+
requireName = node.id.name;
|
|
6403
|
+
} else if (defaultDestructure?.value?.type === "Identifier") {
|
|
6404
|
+
requireName = defaultDestructure.value.name;
|
|
6405
|
+
} else {
|
|
6406
|
+
requireName = "";
|
|
6407
|
+
}
|
|
6408
|
+
if (defaultExportName === void 0) {
|
|
6409
|
+
return;
|
|
6410
|
+
}
|
|
6411
|
+
if (requireName === defaultExportName) {
|
|
6412
|
+
return;
|
|
6413
|
+
}
|
|
6414
|
+
if (node.id.type === "Identifier") {
|
|
6415
|
+
context.report({
|
|
6416
|
+
node,
|
|
6417
|
+
messageId: "renameDefault",
|
|
6418
|
+
data: {
|
|
6419
|
+
importBasename: requireBasename,
|
|
6420
|
+
defaultExportName,
|
|
6421
|
+
importName: requireName,
|
|
6422
|
+
requiresOrImports: "requires",
|
|
6423
|
+
suggestion: `const ${defaultExportName} = require('${requireTarget}')`
|
|
6424
|
+
}
|
|
6425
|
+
});
|
|
6426
|
+
return;
|
|
6427
|
+
}
|
|
6428
|
+
context.report({
|
|
6429
|
+
node,
|
|
6430
|
+
messageId: "renameDefault",
|
|
6431
|
+
data: {
|
|
6432
|
+
importBasename: requireBasename,
|
|
6433
|
+
defaultExportName,
|
|
6434
|
+
importName: requireName,
|
|
6435
|
+
requiresOrImports: "requires",
|
|
6436
|
+
suggestion: `const { default: ${defaultExportName} } = require('${requireTarget}')`
|
|
6437
|
+
}
|
|
6438
|
+
});
|
|
6439
|
+
}
|
|
6440
|
+
return {
|
|
6441
|
+
ImportDefaultSpecifier: handleImport,
|
|
6442
|
+
ImportSpecifier: handleImport,
|
|
6443
|
+
VariableDeclarator: handleRequire
|
|
6444
|
+
};
|
|
6445
|
+
}
|
|
6446
|
+
});
|
|
6447
|
+
}
|
|
6448
|
+
});
|
|
6449
|
+
|
|
5982
6450
|
// node_modules/eslint-plugin-import-x/lib/rules/no-restricted-paths.js
|
|
5983
6451
|
var require_no_restricted_paths = __commonJS({
|
|
5984
6452
|
"node_modules/eslint-plugin-import-x/lib/rules/no-restricted-paths.js"(exports2, module2) {
|
|
@@ -6394,7 +6862,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6394
6862
|
});
|
|
6395
6863
|
} else if (id.type === AST_NODE_TYPES.ArrayPattern) {
|
|
6396
6864
|
for (const el of id.elements) {
|
|
6397
|
-
if (
|
|
6865
|
+
if (el?.type === AST_NODE_TYPES.Identifier) {
|
|
6398
6866
|
cb(el.name, false);
|
|
6399
6867
|
}
|
|
6400
6868
|
}
|
|
@@ -6525,15 +6993,9 @@ var require_no_unused_modules = __commonJS({
|
|
|
6525
6993
|
}
|
|
6526
6994
|
}
|
|
6527
6995
|
};
|
|
6528
|
-
var getSrc = (src) => {
|
|
6529
|
-
if (src) {
|
|
6530
|
-
return src;
|
|
6531
|
-
}
|
|
6532
|
-
return [process.cwd()];
|
|
6533
|
-
};
|
|
6534
6996
|
var srcFiles;
|
|
6535
6997
|
var lastPrepareKey;
|
|
6536
|
-
var doPreparation = (src
|
|
6998
|
+
var doPreparation = (src, ignoreExports, context) => {
|
|
6537
6999
|
const prepareKey = JSON.stringify({
|
|
6538
7000
|
src: src.sort(),
|
|
6539
7001
|
ignoreExports: (ignoreExports || []).sort(),
|
|
@@ -6546,7 +7008,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6546
7008
|
exportList.clear();
|
|
6547
7009
|
ignoredFiles.clear();
|
|
6548
7010
|
filesOutsideSrc.clear();
|
|
6549
|
-
srcFiles = resolveFiles(
|
|
7011
|
+
srcFiles = resolveFiles(src, ignoreExports, context);
|
|
6550
7012
|
prepareImportsAndExports(srcFiles, context);
|
|
6551
7013
|
determineUsage();
|
|
6552
7014
|
lastPrepareKey = prepareKey;
|
|
@@ -6670,13 +7132,12 @@ var require_no_unused_modules = __commonJS({
|
|
|
6670
7132
|
},
|
|
6671
7133
|
defaultOptions: [],
|
|
6672
7134
|
create(context) {
|
|
6673
|
-
const { src, ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports } = context.options[0] || {};
|
|
7135
|
+
const { src = [process.cwd()], ignoreExports = [], missingExports, unusedExports, ignoreUnusedTypeExports } = context.options[0] || {};
|
|
6674
7136
|
if (unusedExports) {
|
|
6675
7137
|
doPreparation(src, ignoreExports, context);
|
|
6676
7138
|
}
|
|
6677
7139
|
const filename = context.physicalFilename;
|
|
6678
7140
|
const checkExportPresence = (node) => {
|
|
6679
|
-
var _a;
|
|
6680
7141
|
if (!missingExports) {
|
|
6681
7142
|
return;
|
|
6682
7143
|
}
|
|
@@ -6693,7 +7154,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6693
7154
|
exportCount.delete(AST_NODE_TYPES.ImportNamespaceSpecifier);
|
|
6694
7155
|
if (exportCount.size === 0) {
|
|
6695
7156
|
context.report({
|
|
6696
|
-
node:
|
|
7157
|
+
node: node.body[0] ?? node,
|
|
6697
7158
|
messageId: "notFound"
|
|
6698
7159
|
});
|
|
6699
7160
|
}
|
|
@@ -6717,7 +7178,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6717
7178
|
return;
|
|
6718
7179
|
}
|
|
6719
7180
|
if (!srcFiles.has(filename)) {
|
|
6720
|
-
srcFiles = resolveFiles(
|
|
7181
|
+
srcFiles = resolveFiles(src, ignoreExports, context);
|
|
6721
7182
|
if (!srcFiles.has(filename)) {
|
|
6722
7183
|
filesOutsideSrc.add(filename);
|
|
6723
7184
|
return;
|
|
@@ -6760,11 +7221,10 @@ var require_no_unused_modules = __commonJS({
|
|
|
6760
7221
|
}
|
|
6761
7222
|
};
|
|
6762
7223
|
const updateExportUsage = (node) => {
|
|
6763
|
-
var _a, _b;
|
|
6764
7224
|
if (ignoredFiles.has(filename)) {
|
|
6765
7225
|
return;
|
|
6766
7226
|
}
|
|
6767
|
-
const exports3 =
|
|
7227
|
+
const exports3 = exportList.get(filename) ?? /* @__PURE__ */ new Map();
|
|
6768
7228
|
const newExports = /* @__PURE__ */ new Map();
|
|
6769
7229
|
const newExportIdentifiers = /* @__PURE__ */ new Set();
|
|
6770
7230
|
for (const s of node.body) {
|
|
@@ -6795,17 +7255,16 @@ var require_no_unused_modules = __commonJS({
|
|
|
6795
7255
|
}
|
|
6796
7256
|
}
|
|
6797
7257
|
const exportAll = exports3.get(AST_NODE_TYPES.ExportAllDeclaration);
|
|
6798
|
-
const namespaceImports =
|
|
7258
|
+
const namespaceImports = exports3.get(AST_NODE_TYPES.ImportNamespaceSpecifier) ?? { whereUsed: /* @__PURE__ */ new Set() };
|
|
6799
7259
|
newExports.set(AST_NODE_TYPES.ExportAllDeclaration, exportAll);
|
|
6800
7260
|
newExports.set(AST_NODE_TYPES.ImportNamespaceSpecifier, namespaceImports);
|
|
6801
7261
|
exportList.set(filename, newExports);
|
|
6802
7262
|
};
|
|
6803
7263
|
const updateImportUsage = (node) => {
|
|
6804
|
-
var _a, _b;
|
|
6805
7264
|
if (!unusedExports) {
|
|
6806
7265
|
return;
|
|
6807
7266
|
}
|
|
6808
|
-
const oldImportPaths =
|
|
7267
|
+
const oldImportPaths = importList.get(filename) ?? /* @__PURE__ */ new Map();
|
|
6809
7268
|
const oldNamespaceImports = /* @__PURE__ */ new Set();
|
|
6810
7269
|
const newNamespaceImports = /* @__PURE__ */ new Set();
|
|
6811
7270
|
const oldExportAll = /* @__PURE__ */ new Set();
|
|
@@ -6891,7 +7350,7 @@ var require_no_unused_modules = __commonJS({
|
|
|
6891
7350
|
}
|
|
6892
7351
|
for (const value of newExportAll) {
|
|
6893
7352
|
if (!oldExportAll.has(value)) {
|
|
6894
|
-
const imports =
|
|
7353
|
+
const imports = oldImportPaths.get(value) ?? /* @__PURE__ */ new Set();
|
|
6895
7354
|
imports.add(AST_NODE_TYPES.ExportAllDeclaration);
|
|
6896
7355
|
oldImportPaths.set(value, imports);
|
|
6897
7356
|
let exports3 = exportList.get(value);
|
|
@@ -7193,8 +7652,7 @@ var require_no_webpack_loader_syntax = __commonJS({
|
|
|
7193
7652
|
defaultOptions: [],
|
|
7194
7653
|
create(context) {
|
|
7195
7654
|
return (0, utils_1.moduleVisitor)((source, node) => {
|
|
7196
|
-
|
|
7197
|
-
if ((_a = source.value) === null || _a === void 0 ? void 0 : _a.includes("!")) {
|
|
7655
|
+
if (source.value?.includes("!")) {
|
|
7198
7656
|
context.report({
|
|
7199
7657
|
node,
|
|
7200
7658
|
messageId: "unexpected",
|
|
@@ -7217,7 +7675,7 @@ var require_order = __commonJS({
|
|
|
7217
7675
|
var utils_1 = require_utils();
|
|
7218
7676
|
var groupBy = (array, grouper) => array.reduce((acc, curr, index) => {
|
|
7219
7677
|
const key = grouper(curr, index);
|
|
7220
|
-
(acc[key]
|
|
7678
|
+
(acc[key] ||= []).push(curr);
|
|
7221
7679
|
return acc;
|
|
7222
7680
|
}, {});
|
|
7223
7681
|
var defaultGroups = [
|
|
@@ -7229,7 +7687,7 @@ var require_order = __commonJS({
|
|
|
7229
7687
|
];
|
|
7230
7688
|
function reverse(array) {
|
|
7231
7689
|
return array.map(function(v) {
|
|
7232
|
-
return
|
|
7690
|
+
return { ...v, rank: -v.rank };
|
|
7233
7691
|
}).reverse();
|
|
7234
7692
|
}
|
|
7235
7693
|
function getTokensOrCommentsAfter(sourceCode, node, count) {
|
|
@@ -7526,16 +7984,15 @@ var require_order = __commonJS({
|
|
|
7526
7984
|
function registerNode(context, importEntry, ranks, imported, excludedImportTypes) {
|
|
7527
7985
|
const rank = computeRank(context, ranks, importEntry, excludedImportTypes);
|
|
7528
7986
|
if (rank !== -1) {
|
|
7529
|
-
imported.push(
|
|
7987
|
+
imported.push({ ...importEntry, rank });
|
|
7530
7988
|
}
|
|
7531
7989
|
}
|
|
7532
7990
|
function getRequireBlock(node) {
|
|
7533
|
-
var _a, _b, _c;
|
|
7534
7991
|
let n = node;
|
|
7535
7992
|
while (n.parent && (n.parent.type === "MemberExpression" && n.parent.object === n || n.parent.type === "CallExpression" && n.parent.callee === n)) {
|
|
7536
7993
|
n = n.parent;
|
|
7537
7994
|
}
|
|
7538
|
-
if (
|
|
7995
|
+
if (n.parent?.type === "VariableDeclarator" && n.parent.parent?.type === "VariableDeclaration" && n.parent.parent.parent?.type === "Program") {
|
|
7539
7996
|
return n.parent.parent.parent;
|
|
7540
7997
|
}
|
|
7541
7998
|
}
|
|
@@ -7589,7 +8046,7 @@ var require_order = __commonJS({
|
|
|
7589
8046
|
}
|
|
7590
8047
|
before[group].push(index);
|
|
7591
8048
|
}
|
|
7592
|
-
return
|
|
8049
|
+
return { ...pathGroup, position };
|
|
7593
8050
|
});
|
|
7594
8051
|
let maxPosition = 1;
|
|
7595
8052
|
for (const group of Object.keys(before)) {
|
|
@@ -7910,11 +8367,11 @@ var require_prefer_default_export = __commonJS({
|
|
|
7910
8367
|
let namedExportNode;
|
|
7911
8368
|
const { target = "single" } = context.options[0] || {};
|
|
7912
8369
|
function captureDeclaration(identifierOrPattern) {
|
|
7913
|
-
if (
|
|
8370
|
+
if (identifierOrPattern?.type === "ObjectPattern") {
|
|
7914
8371
|
for (const property of identifierOrPattern.properties) {
|
|
7915
8372
|
captureDeclaration(property.value);
|
|
7916
8373
|
}
|
|
7917
|
-
} else if (
|
|
8374
|
+
} else if (identifierOrPattern?.type === "ArrayPattern") {
|
|
7918
8375
|
for (const el of identifierOrPattern.elements) {
|
|
7919
8376
|
captureDeclaration(el);
|
|
7920
8377
|
}
|
|
@@ -8021,14 +8478,23 @@ var require_unambiguous2 = __commonJS({
|
|
|
8021
8478
|
|
|
8022
8479
|
// node_modules/eslint-plugin-import-x/lib/index.js
|
|
8023
8480
|
var tslib_1 = require("tslib");
|
|
8481
|
+
var package_json_1 = require_package();
|
|
8024
8482
|
var electron_1 = tslib_1.__importDefault(require_electron());
|
|
8025
8483
|
var errors_1 = tslib_1.__importDefault(require_errors());
|
|
8484
|
+
var electron_2 = tslib_1.__importDefault(require_electron2());
|
|
8485
|
+
var errors_2 = tslib_1.__importDefault(require_errors2());
|
|
8026
8486
|
var react_1 = tslib_1.__importDefault(require_react());
|
|
8027
8487
|
var react_native_1 = tslib_1.__importDefault(require_react_native());
|
|
8028
8488
|
var recommended_1 = tslib_1.__importDefault(require_recommended());
|
|
8029
8489
|
var stage_0_1 = tslib_1.__importDefault(require_stage_0());
|
|
8030
8490
|
var typescript_1 = tslib_1.__importDefault(require_typescript());
|
|
8031
8491
|
var warnings_1 = tslib_1.__importDefault(require_warnings());
|
|
8492
|
+
var react_2 = tslib_1.__importDefault(require_react2());
|
|
8493
|
+
var react_native_2 = tslib_1.__importDefault(require_react_native2());
|
|
8494
|
+
var recommended_2 = tslib_1.__importDefault(require_recommended2());
|
|
8495
|
+
var stage_0_2 = tslib_1.__importDefault(require_stage_02());
|
|
8496
|
+
var typescript_2 = tslib_1.__importDefault(require_typescript2());
|
|
8497
|
+
var warnings_2 = tslib_1.__importDefault(require_warnings2());
|
|
8032
8498
|
var consistent_type_specifier_style_1 = tslib_1.__importDefault(require_consistent_type_specifier_style());
|
|
8033
8499
|
var default_1 = tslib_1.__importDefault(require_default());
|
|
8034
8500
|
var dynamic_import_chunkname_1 = tslib_1.__importDefault(require_dynamic_import_chunkname());
|
|
@@ -8064,6 +8530,7 @@ var no_namespace_1 = tslib_1.__importDefault(require_no_namespace());
|
|
|
8064
8530
|
var no_nodejs_modules_1 = tslib_1.__importDefault(require_no_nodejs_modules());
|
|
8065
8531
|
var no_relative_packages_1 = tslib_1.__importDefault(require_no_relative_packages());
|
|
8066
8532
|
var no_relative_parent_imports_1 = tslib_1.__importDefault(require_no_relative_parent_imports());
|
|
8533
|
+
var no_rename_default_1 = tslib_1.__importDefault(require_no_rename_default());
|
|
8067
8534
|
var no_restricted_paths_1 = tslib_1.__importDefault(require_no_restricted_paths());
|
|
8068
8535
|
var no_self_import_1 = tslib_1.__importDefault(require_no_self_import());
|
|
8069
8536
|
var no_unassigned_import_1 = tslib_1.__importDefault(require_no_unassigned_import());
|
|
@@ -8074,16 +8541,6 @@ var no_webpack_loader_syntax_1 = tslib_1.__importDefault(require_no_webpack_load
|
|
|
8074
8541
|
var order_1 = tslib_1.__importDefault(require_order());
|
|
8075
8542
|
var prefer_default_export_1 = tslib_1.__importDefault(require_prefer_default_export());
|
|
8076
8543
|
var unambiguous_1 = tslib_1.__importDefault(require_unambiguous2());
|
|
8077
|
-
var configs = {
|
|
8078
|
-
recommended: recommended_1.default,
|
|
8079
|
-
errors: errors_1.default,
|
|
8080
|
-
warnings: warnings_1.default,
|
|
8081
|
-
"stage-0": stage_0_1.default,
|
|
8082
|
-
react: react_1.default,
|
|
8083
|
-
"react-native": react_native_1.default,
|
|
8084
|
-
electron: electron_1.default,
|
|
8085
|
-
typescript: typescript_1.default
|
|
8086
|
-
};
|
|
8087
8544
|
var rules = {
|
|
8088
8545
|
"no-unresolved": no_unresolved_1.default,
|
|
8089
8546
|
named: named_1.default,
|
|
@@ -8105,6 +8562,7 @@ var rules = {
|
|
|
8105
8562
|
"no-named-as-default": no_named_as_default_1.default,
|
|
8106
8563
|
"no-named-as-default-member": no_named_as_default_member_1.default,
|
|
8107
8564
|
"no-anonymous-default-export": no_anonymous_default_export_1.default,
|
|
8565
|
+
"no-rename-default": no_rename_default_1.default,
|
|
8108
8566
|
"no-unused-modules": no_unused_modules_1.default,
|
|
8109
8567
|
"no-commonjs": no_commonjs_1.default,
|
|
8110
8568
|
"no-amd": no_amd_1.default,
|
|
@@ -8131,7 +8589,37 @@ var rules = {
|
|
|
8131
8589
|
"no-deprecated": no_deprecated_1.default,
|
|
8132
8590
|
"imports-first": imports_first_1.default
|
|
8133
8591
|
};
|
|
8592
|
+
var configs = {
|
|
8593
|
+
recommended: recommended_2.default,
|
|
8594
|
+
errors: errors_1.default,
|
|
8595
|
+
warnings: warnings_2.default,
|
|
8596
|
+
"stage-0": stage_0_2.default,
|
|
8597
|
+
react: react_2.default,
|
|
8598
|
+
"react-native": react_native_2.default,
|
|
8599
|
+
electron: electron_1.default,
|
|
8600
|
+
typescript: typescript_2.default
|
|
8601
|
+
};
|
|
8602
|
+
var plugin = {
|
|
8603
|
+
meta: { name: package_json_1.name, version: package_json_1.version },
|
|
8604
|
+
rules
|
|
8605
|
+
};
|
|
8606
|
+
var createFlatConfig = (baseConfig, configName) => ({
|
|
8607
|
+
...baseConfig,
|
|
8608
|
+
name: `import-x/${configName}`,
|
|
8609
|
+
plugins: { "import-x": plugin }
|
|
8610
|
+
});
|
|
8611
|
+
var flatConfigs = {
|
|
8612
|
+
recommended: createFlatConfig(recommended_1.default, "recommended"),
|
|
8613
|
+
errors: createFlatConfig(errors_2.default, "errors"),
|
|
8614
|
+
warnings: createFlatConfig(warnings_1.default, "warnings"),
|
|
8615
|
+
"stage-0": createFlatConfig(stage_0_1.default, "stage-0"),
|
|
8616
|
+
react: react_1.default,
|
|
8617
|
+
"react-native": react_native_1.default,
|
|
8618
|
+
electron: electron_2.default,
|
|
8619
|
+
typescript: typescript_1.default
|
|
8620
|
+
};
|
|
8134
8621
|
module.exports = {
|
|
8135
8622
|
configs,
|
|
8623
|
+
flatConfigs,
|
|
8136
8624
|
rules
|
|
8137
8625
|
};
|