Skip to content

Commit ddd8c45

Browse files
authored
chore: 🤖 prevent import statements from declaring extensions #770
1 parent 0856104 commit ddd8c45

File tree

3 files changed

+1246
-39
lines changed

3 files changed

+1246
-39
lines changed

eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import reactHooks from "eslint-plugin-react-hooks";
44
import reactRefresh from "eslint-plugin-react-refresh";
55
import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
66
import storybook from "eslint-plugin-storybook";
7+
import importPlugin from "eslint-plugin-import";
78
import globals from "globals";
89

910
export default tseslint.config(
@@ -33,10 +34,17 @@ export default tseslint.config(
3334
"react-refresh": reactRefresh,
3435
"prefer-arrow-functions": preferArrowFunctions,
3536
storybook: storybook,
37+
import: importPlugin,
38+
},
39+
settings: {
40+
"import/resolver": {
41+
typescript: true,
42+
node: true,
43+
},
3644
},
3745
rules: {
3846
...reactHooks.configs.recommended.rules,
39-
curly: ['error', 'all'],
47+
curly: ["error", "all"],
4048
"react-refresh/only-export-components": "warn",
4149
"no-multiple-empty-lines": "error",
4250
quotes: ["error", "double", { avoidEscape: true }],
@@ -57,6 +65,16 @@ export default tseslint.config(
5765
},
5866
],
5967
"@typescript-eslint/no-empty-object-type": "off",
68+
"import/extensions": [
69+
"error",
70+
"ignorePackages",
71+
{
72+
js: "never",
73+
jsx: "never",
74+
ts: "never",
75+
tsx: "never",
76+
},
77+
],
6078
},
6179
},
6280
// Special config for test files

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"@testing-library/react": "^15.0.7",
9595
"@testing-library/user-event": "^14.5.2",
9696
"@tokens-studio/sd-transforms": "^1.2.0",
97+
"@types/eslint-plugin-react-refresh": "^0.4.0",
9798
"@types/lodash-es": "^4.17.7",
9899
"@types/node": "^24.10.1",
99100
"@types/react": "18.3.2",
@@ -109,6 +110,8 @@
109110
"date-fns": "4.1.0",
110111
"dayjs": "1.11.13",
111112
"eslint": "^9",
113+
"eslint-import-resolver-typescript": "^4.4.4",
114+
"eslint-plugin-import": "^2.32.0",
112115
"eslint-plugin-prefer-arrow-functions": "^3.3.2",
113116
"eslint-plugin-react-hooks": "^5",
114117
"eslint-plugin-react-refresh": "0.4.7",

0 commit comments

Comments
 (0)