Skip to content

Commit

Permalink
fix: extensions list into settings field of import rules (#78)
Browse files Browse the repository at this point in the history
* fix extensions list

* update snapshot
  • Loading branch information
wakamsha authored Aug 22, 2024
1 parent c1a52c8 commit 65b4018
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 23 deletions.
6 changes: 3 additions & 3 deletions rules/imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export default {
settings: {
'import/resolver': {
node: {
extensions: ['.mjs', '.js', '.json', '.ts'],
extensions: ['.js', '.mjs', '.json', '.ts', '.mts'],
},
// Resolve the problem of incorrect recognition of alias paths by TypeScript compiler options.
// https://github.com/import-js/eslint-plugin-import/issues/1485#issuecomment-535351922
typescript: {},
},
'import/extensions': ['.js', '.mjs', '.jsx', 'ts', 'tsx'],
'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.mts', '.tsx'],
'import/core-modules': [],
'import/ignore': [
'node_modules',
Expand All @@ -39,7 +39,7 @@ export default {
// TODO: Remove this once eslint-plugin-import supports Flat Config completely.
// https://github.com/import-js/eslint-plugin-import/issues/2556#issuecomment-1419518561
'import/parsers': {
espree: ['.js', '.mjs', '.jsx', 'ts', 'tsx'],
espree: ['.js', '.mjs', '.jsx', '.ts', '.mts', '.tsx'],
},
},

Expand Down
13 changes: 8 additions & 5 deletions test/node/__snapshots__/snapshot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1939,8 +1939,9 @@ exports[`should match ESLint Configuration snapshot: node 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
"import/ignore": [
"node_modules",
Expand All @@ -1951,17 +1952,19 @@ exports[`should match ESLint Configuration snapshot: node 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
},
"import/resolver": {
"node": {
"extensions": [
".mjs",
".js",
".mjs",
".json",
".ts",
".mts",
],
},
"typescript": {},
Expand Down
13 changes: 8 additions & 5 deletions test/react/__snapshots__/snapshot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3147,8 +3147,9 @@ exports[`should match ESLint Configuration snapshot: react 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
"import/ignore": [
"node_modules",
Expand All @@ -3159,17 +3160,19 @@ exports[`should match ESLint Configuration snapshot: react 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
},
"import/resolver": {
"node": {
"extensions": [
".mjs",
".js",
".mjs",
".json",
".ts",
".mts",
],
},
"typescript": {},
Expand Down
13 changes: 8 additions & 5 deletions test/storybook/__snapshots__/snapshot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2949,8 +2949,9 @@ exports[`should match ESLint Configuration snapshot: storybook 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
"import/ignore": [
"node_modules",
Expand All @@ -2961,17 +2962,19 @@ exports[`should match ESLint Configuration snapshot: storybook 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
},
"import/resolver": {
"node": {
"extensions": [
".mjs",
".js",
".mjs",
".json",
".ts",
".mts",
],
},
"typescript": {},
Expand Down
13 changes: 8 additions & 5 deletions test/test/__snapshots__/snapshot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2346,8 +2346,9 @@ exports[`should match ESLint Configuration snapshot: test 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
"import/ignore": [
"node_modules",
Expand All @@ -2358,17 +2359,19 @@ exports[`should match ESLint Configuration snapshot: test 1`] = `
".js",
".mjs",
".jsx",
"ts",
"tsx",
".ts",
".mts",
".tsx",
],
},
"import/resolver": {
"node": {
"extensions": [
".mjs",
".js",
".mjs",
".json",
".ts",
".mts",
],
},
"typescript": {},
Expand Down

0 comments on commit 65b4018

Please sign in to comment.