Skip to content

Commit

Permalink
feat(deps): migrate from eslint-import-plugin to eslint-plugin-import…
Browse files Browse the repository at this point in the history
…-x (#52)
  • Loading branch information
noahnu authored May 31, 2024
1 parent e659db9 commit ed5898c
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 37 deletions.
4 changes: 4 additions & 0 deletions .monoweave/303f42b9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@noahnu/eslint-config": major
---
Migrate from eslint-plugin-import to eslint-plugin-import-x
4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ npmRegistries:
npmAuthToken: "${NPM_PUBLISH_TOKEN:-invalid}"

enableTransparentWorkspaces: false

logFilters:
- pattern: "doesn't provide eslint-plugin-import (*), requested by eslint-import-resolver-typescript"
level: discard
4 changes: 2 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import-x": "^0.5.1",
"eslint-plugin-jest": "^28.5.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5"
Expand All @@ -80,7 +80,7 @@
"eslint-config-prettier": ">=9.1.0",
"eslint-import-resolver-node": ">=0.3.9",
"eslint-import-resolver-typescript": ">=3.6.1",
"eslint-plugin-import": ">=2.29.1",
"eslint-plugin-import-x": ">=0.5.1",
"eslint-plugin-jest": ">=28.5.0",
"eslint-plugin-prettier": ">=5.1.3",
"prettier": ">=3.2.5",
Expand Down
39 changes: 13 additions & 26 deletions packages/eslint-config/src/base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,14 @@ const rules: ESLint.ConfigData['rules'] = {
ignoreDeclarationSort: true,
},
],
'import/default': 'error',
'import/export': 'error',
'import/named': 'error',
'import/newline-after-import': 'error',
'import/no-absolute-path': 'error',
'import/no-duplicates': 'error',
'import/no-mutable-exports': 'error',
'import/no-self-import': 'error',
'import/no-useless-path-segments': 'error',
'import/no-unresolved': 'error',
'import/order': [
'import-x/newline-after-import': 'error',
'import-x/no-absolute-path': 'error',
'import-x/no-duplicates': 'error',
'import-x/no-mutable-exports': 'error',
'import-x/no-self-import': 'error',
'import-x/no-useless-path-segments': 'error',
'import-x/no-unresolved': 'error',
'import-x/order': [
'error',
{
alphabetize: { order: 'asc' },
Expand Down Expand Up @@ -134,11 +131,13 @@ const config: ESLint.ConfigData = {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['import', 'prettier', '@typescript-eslint'],
plugins: ['import-x', 'prettier', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
'plugin:import-x/recommended',
'plugin:import-x/typescript',
// prettier must be the last item in this list to prevent conflicts
'prettier',
],
Expand All @@ -154,20 +153,8 @@ const config: ESLint.ConfigData = {
},
],
settings: {
'import/external-module-folders': ['node_modules', '.yarn'],
'import/parsers': {
'@typescript-eslint/parser': [
'.ts',
'.tsx',
'.mts',
'.cts',
'.js',
'.mjs',
'.cjs',
'.jsx',
],
},
'import/resolver': [
'import-x/external-module-folders': ['node_modules', '.yarn'],
'import-x/resolver': [
{
[require.resolve('eslint-import-resolver-typescript')]: {
alwaysTryTypes: true,
Expand Down
97 changes: 88 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ __metadata:
eslint-config-prettier: "npm:^9.1.0"
eslint-import-resolver-node: "npm:^0.3.9"
eslint-import-resolver-typescript: "npm:^3.6.1"
eslint-plugin-import: "npm:^2.29.1"
eslint-plugin-import-x: "npm:^0.5.1"
eslint-plugin-jest: "npm:^28.5.0"
eslint-plugin-prettier: "npm:^5.1.3"
prettier: "npm:^3.2.5"
Expand All @@ -1418,7 +1418,7 @@ __metadata:
eslint-config-prettier: ">=9.1.0"
eslint-import-resolver-node: ">=0.3.9"
eslint-import-resolver-typescript: ">=3.6.1"
eslint-plugin-import: ">=2.29.1"
eslint-plugin-import-x: ">=0.5.1"
eslint-plugin-jest: ">=28.5.0"
eslint-plugin-prettier: ">=5.1.3"
prettier: ">=3.2.5"
Expand Down Expand Up @@ -2149,6 +2149,16 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/scope-manager@npm:7.11.0":
version: 7.11.0
resolution: "@typescript-eslint/scope-manager@npm:7.11.0"
dependencies:
"@typescript-eslint/types": "npm:7.11.0"
"@typescript-eslint/visitor-keys": "npm:7.11.0"
checksum: 10c0/35f9d88f38f2366017b15c9ee752f2605afa8009fa1eaf81c8b2b71fc22ddd2a33fff794a02015c8991a5fa99f315c3d6d76a5957d3fad1ccbb4cd46735c98b5
languageName: node
linkType: hard

"@typescript-eslint/type-utils@npm:7.10.0":
version: 7.10.0
resolution: "@typescript-eslint/type-utils@npm:7.10.0"
Expand All @@ -2173,7 +2183,14 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/typescript-estree@npm:7.10.0, @typescript-eslint/typescript-estree@npm:^7.8.0":
"@typescript-eslint/types@npm:7.11.0":
version: 7.11.0
resolution: "@typescript-eslint/types@npm:7.11.0"
checksum: 10c0/c5d6c517124017eb44aa180c8ea1fad26ec8e47502f92fd12245ba3141560e69d7f7e35b8aa160ddd5df63a2952af407e2f62cc58b663c86e1f778ffb5b01789
languageName: node
linkType: hard

"@typescript-eslint/typescript-estree@npm:7.10.0":
version: 7.10.0
resolution: "@typescript-eslint/typescript-estree@npm:7.10.0"
dependencies:
Expand All @@ -2192,7 +2209,26 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:7.10.0, @typescript-eslint/utils@npm:^6.0.0 || ^7.0.0, @typescript-eslint/utils@npm:^7.8.0":
"@typescript-eslint/typescript-estree@npm:7.11.0, @typescript-eslint/typescript-estree@npm:^7.8.0":
version: 7.11.0
resolution: "@typescript-eslint/typescript-estree@npm:7.11.0"
dependencies:
"@typescript-eslint/types": "npm:7.11.0"
"@typescript-eslint/visitor-keys": "npm:7.11.0"
debug: "npm:^4.3.4"
globby: "npm:^11.1.0"
is-glob: "npm:^4.0.3"
minimatch: "npm:^9.0.4"
semver: "npm:^7.6.0"
ts-api-utils: "npm:^1.3.0"
peerDependenciesMeta:
typescript:
optional: true
checksum: 10c0/a4eda43f352d20edebae0c1c221c4fd9de0673a94988cf1ae3f5e4917ef9cdb9ead8d3673ea8dd6e80d9cf3523a47c295be1326a3fae017b277233f4c4b4026b
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:7.10.0":
version: 7.10.0
resolution: "@typescript-eslint/utils@npm:7.10.0"
dependencies:
Expand All @@ -2206,6 +2242,20 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/utils@npm:^6.0.0 || ^7.0.0, @typescript-eslint/utils@npm:^7.4.0, @typescript-eslint/utils@npm:^7.8.0":
version: 7.11.0
resolution: "@typescript-eslint/utils@npm:7.11.0"
dependencies:
"@eslint-community/eslint-utils": "npm:^4.4.0"
"@typescript-eslint/scope-manager": "npm:7.11.0"
"@typescript-eslint/types": "npm:7.11.0"
"@typescript-eslint/typescript-estree": "npm:7.11.0"
peerDependencies:
eslint: ^8.56.0
checksum: 10c0/539a7ff8b825ad810fc59a80269094748df1a397a42cdbb212c493fc2486711c7d8fd6d75d4cd8a067822b8e6a11f42c50441977d51c183eec47992506d1cdf8
languageName: node
linkType: hard

"@typescript-eslint/visitor-keys@npm:7.10.0":
version: 7.10.0
resolution: "@typescript-eslint/visitor-keys@npm:7.10.0"
Expand All @@ -2216,6 +2266,16 @@ __metadata:
languageName: node
linkType: hard

"@typescript-eslint/visitor-keys@npm:7.11.0":
version: 7.11.0
resolution: "@typescript-eslint/visitor-keys@npm:7.11.0"
dependencies:
"@typescript-eslint/types": "npm:7.11.0"
eslint-visitor-keys: "npm:^3.4.3"
checksum: 10c0/664e558d9645896484b7ffc9381837f0d52443bf8d121a5586d02d42ca4d17dc35faf526768c4b1beb52c57c43fae555898eb087651eb1c7a3d60f1085effea1
languageName: node
linkType: hard

"@ungap/structured-clone@npm:^1.2.0":
version: 1.2.0
resolution: "@ungap/structured-clone@npm:1.2.0"
Expand Down Expand Up @@ -4520,6 +4580,25 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-import-x@npm:^0.5.1":
version: 0.5.1
resolution: "eslint-plugin-import-x@npm:0.5.1"
dependencies:
"@typescript-eslint/utils": "npm:^7.4.0"
debug: "npm:^4.3.4"
doctrine: "npm:^3.0.0"
eslint-import-resolver-node: "npm:^0.3.9"
get-tsconfig: "npm:^4.7.3"
is-glob: "npm:^4.0.3"
minimatch: "npm:^9.0.3"
semver: "npm:^7.6.0"
tslib: "npm:^2.6.2"
peerDependencies:
eslint: ^8.56.0 || ^9.0.0-0
checksum: 10c0/3e605970550afd6c8372da774de1ed5a86164d0d69190c532ef9caed4e882d4519f589683130122ba2d353fba15e96e3b49391f893139147c5d48a432eaa9945
languageName: node
linkType: hard

"eslint-plugin-import@npm:^2.29.1":
version: 2.29.1
resolution: "eslint-plugin-import@npm:2.29.1"
Expand Down Expand Up @@ -5160,12 +5239,12 @@ __metadata:
languageName: node
linkType: hard

"get-tsconfig@npm:^4.5.0":
version: 4.7.2
resolution: "get-tsconfig@npm:4.7.2"
"get-tsconfig@npm:^4.5.0, get-tsconfig@npm:^4.7.3":
version: 4.7.5
resolution: "get-tsconfig@npm:4.7.5"
dependencies:
resolve-pkg-maps: "npm:^1.0.0"
checksum: 10c0/169b2beababfbb16e8a0ae813ee59d3e14d4960231c816615161ab5be68ec07a394dce59695742ac84295e2efab8d9e89bcf3abaf5e253dfbec3496e01bb9a65
checksum: 10c0/a917dff2ba9ee187c41945736bf9bbab65de31ce5bc1effd76267be483a7340915cff232199406379f26517d2d0a4edcdbcda8cca599c2480a0f2cf1e1de3efa
languageName: node
linkType: hard

Expand Down Expand Up @@ -7209,7 +7288,7 @@ __metadata:
languageName: node
linkType: hard

"minimatch@npm:^9.0.1, minimatch@npm:^9.0.4":
"minimatch@npm:^9.0.1, minimatch@npm:^9.0.3, minimatch@npm:^9.0.4":
version: 9.0.4
resolution: "minimatch@npm:9.0.4"
dependencies:
Expand Down

0 comments on commit ed5898c

Please sign in to comment.