Skip to content

Commit 8afcc54

Browse files
committed
build(eslint-config-fluid): migrate from eslint-plugin-import to eslint-plugin-import-x
Migrate to eslint-plugin-import-x as eslint-plugin-import is no longer maintained. Updated all references in config files and dependencies.
1 parent 51d4808 commit 8afcc54

File tree

12 files changed

+294
-278
lines changed

12 files changed

+294
-278
lines changed

common/build/eslint-config-fluid/base.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ module.exports = {
1919
"plugin:@typescript-eslint/eslint-recommended",
2020
"plugin:@typescript-eslint/recommended-type-checked",
2121
"plugin:@typescript-eslint/stylistic-type-checked",
22-
// import/recommended is the combination of import/errors and import/warnings
23-
"plugin:import/recommended",
24-
"plugin:import/typescript",
22+
// import-x/recommended is the combination of import-x/errors and import-x/warnings
23+
"plugin:import-x/recommended",
24+
"plugin:import-x/typescript",
2525
],
2626
globals: {
2727
Atomics: "readonly",
@@ -36,7 +36,7 @@ module.exports = {
3636
sourceType: "module",
3737
project: "./tsconfig.json",
3838
},
39-
plugins: ["import", "unicorn"],
39+
plugins: ["import-x", "unicorn"],
4040
reportUnusedDisableDirectives: true,
4141
rules: {
4242
// These rules were deprecated, then removed in `@typescript-eslint/eslint-plugin` v8.
@@ -167,21 +167,21 @@ module.exports = {
167167
},
168168
],
169169

170-
// #region eslint-plugin-import
170+
// #region eslint-plugin-import-x
171171

172-
"import/no-default-export": "error",
173-
"import/no-deprecated": "off",
174-
"import/no-extraneous-dependencies": "error",
175-
"import/no-internal-modules": "error",
176-
"import/no-unassigned-import": "error",
177-
"import/no-unresolved": [
172+
"import-x/no-default-export": "error",
173+
"import-x/no-deprecated": "off",
174+
"import-x/no-extraneous-dependencies": "error",
175+
"import-x/no-internal-modules": "error",
176+
"import-x/no-unassigned-import": "error",
177+
"import-x/no-unresolved": [
178178
"error",
179179
{
180180
caseSensitive: true,
181181
},
182182
],
183-
"import/no-unused-modules": "error",
184-
"import/order": [
183+
"import-x/no-unused-modules": "error",
184+
"import-x/order": [
185185
"error",
186186
{
187187
"newlines-between": "always",
@@ -372,12 +372,12 @@ module.exports = {
372372
},
373373
],
374374
settings: {
375-
"import/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
376-
"import/parsers": {
375+
"import-x/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
376+
"import-x/parsers": {
377377
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
378378
},
379-
"import/resolver": {
380-
// See remark in minimal-deprecated.js on the importance of import/resolver key order.
379+
"import-x/resolver": {
380+
// See remark in minimal-deprecated.js on the importance of import-x/resolver key order.
381381
node: {
382382
extensions: [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
383383
},

common/build/eslint-config-fluid/minimal-deprecated.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ module.exports = {
7272
extends: [
7373
"./base",
7474
"plugin:eslint-comments/recommended",
75-
"plugin:import/errors",
76-
"plugin:import/warnings",
77-
"plugin:import/typescript",
75+
"plugin:import-x/errors",
76+
"plugin:import-x/warnings",
77+
"plugin:import-x/typescript",
7878
"prettier",
7979
],
8080
globals: {
@@ -181,7 +181,7 @@ module.exports = {
181181
],
182182

183183
"eqeqeq": ["error", "smart"],
184-
"import/no-deprecated": "error",
184+
"import-x/no-deprecated": "error",
185185
"max-len": [
186186
"error",
187187
{
@@ -411,13 +411,13 @@ module.exports = {
411411
* By default, libraries should not take dependencies on node libraries.
412412
* This rule can be disabled at the project level for libraries that are intended to be used only in node.
413413
*/
414-
"import/no-nodejs-modules": ["error"],
414+
"import-x/no-nodejs-modules": ["error"],
415415

416416
/**
417417
* Allow Fluid Framework to import from its own internal packages.
418-
* https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-internal-modules.md
418+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/docs/rules/no-internal-modules.md
419419
*/
420-
"import/no-internal-modules": [
420+
"import-x/no-internal-modules": [
421421
"error",
422422
{
423423
allow: permittedImports,
@@ -467,8 +467,8 @@ module.exports = {
467467
rules: {
468468
"@typescript-eslint/no-invalid-this": "off",
469469
"@typescript-eslint/unbound-method": "off", // This rule has false positives in many of our test projects.
470-
"import/no-nodejs-modules": "off", // Node libraries are OK for test files.
471-
"import/no-deprecated": "off", // Deprecated APIs are OK to use in test files.
470+
"import-x/no-nodejs-modules": "off", // Node libraries are OK for test files.
471+
"import-x/no-deprecated": "off", // Deprecated APIs are OK to use in test files.
472472

473473
// Disabled for test files
474474
"@typescript-eslint/consistent-type-exports": "off",
@@ -482,7 +482,7 @@ module.exports = {
482482
],
483483

484484
// For test files only, additionally allow import of '/test*' and '/internal/test*' exports.
485-
"import/no-internal-modules": [
485+
"import-x/no-internal-modules": [
486486
"error",
487487
{
488488
allow: ["@fluid*/*/test*", "@fluid*/*/internal/test*"].concat(
@@ -492,23 +492,23 @@ module.exports = {
492492
],
493493

494494
// Test code may leverage dev dependencies
495-
"import/no-extraneous-dependencies": ["error", { devDependencies: true }],
495+
"import-x/no-extraneous-dependencies": ["error", { devDependencies: true }],
496496
},
497497
},
498498
],
499499
settings: {
500-
"import/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
501-
"import/parsers": {
500+
"import-x/extensions": [".ts", ".tsx", ".d.ts", ".js", ".jsx"],
501+
"import-x/parsers": {
502502
"@typescript-eslint/parser": [".ts", ".tsx", ".d.ts"],
503503
},
504-
"import/resolver": {
504+
"import-x/resolver": {
505505
/**
506-
* Note: the key order of import/resolver is relevant in the completely resolved eslint config (see ./printed-configs).
506+
* Note: the key order of import-x/resolver is relevant in the completely resolved eslint config (see ./printed-configs).
507507
* Resolvers are tried in key order, and the first one to successfully resolve the import wins. See:
508-
* https://github.com/import-js/eslint-plugin-import/blob/c0ac54b8a721c2b1c9048838acc4d6282f4fe7a7/utils/resolve.js#L196
508+
* https://github.com/un-ts/eslint-plugin-import-x/blob/master/src/utils/resolve.ts
509509
*
510510
* It's important that the typescript resolver is first, as the node resolver legitimately resolves some imports to modules
511-
* with stripped type information, which can cause silent negatives in lint rules. For example, import/no-deprecated fails
511+
* with stripped type information, which can cause silent negatives in lint rules. For example, import-x/no-deprecated fails
512512
* to lint against import and usage of deprecated types when the import is resolvable and resolved using the node resolver.
513513
*/
514514
typescript: {

common/build/eslint-config-fluid/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"eslint-config-prettier": "~10.1.8",
4040
"eslint-import-resolver-typescript": "~4.4.4",
4141
"eslint-plugin-eslint-comments": "~3.2.0",
42-
"eslint-plugin-import": "npm:eslint-plugin-i@~2.29.1",
42+
"eslint-plugin-import-x": "~4.16.1",
4343
"eslint-plugin-jsdoc": "~55.0.2",
4444
"eslint-plugin-promise": "~7.2.1",
4545
"eslint-plugin-react": "~7.37.5",

common/build/eslint-config-fluid/pnpm-lock.yaml

Lines changed: 29 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)