Skip to content

Commit ab0d0a4

Browse files
committed
lint: add eslint plugin for organizing and validating whole import statements
1 parent 4f586c9 commit ab0d0a4

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.eslintrc.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
{
22
"extends": [
33
"next/core-web-vitals",
4-
"next/typescript"
4+
"next/typescript",
5+
"plugin:prettier/recommended",
6+
"plugin:import/errors",
7+
"plugin:import/warnings",
8+
"plugin:import/typescript"
59
],
10+
"plugins": ["prettier", "import"],
611
"rules": {
712
// Code quality
813
"no-console": "warn",
914
"no-debugger": "error",
1015
// "no-unused-vars": "off", // Handled by TS version above
1116

17+
// Import sorting and cleanliness
18+
"import/order": [
19+
"error",
20+
{
21+
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
22+
"newlines-between": "always",
23+
"alphabetize": { "order": "asc", "caseInsensitive": true }
24+
}
25+
],
26+
"import/newline-after-import": "error",
27+
"import/no-duplicates": "error",
28+
1229
// Prettier takes over formatting rules now
1330
"prettier/prettier": "error"
1431
}

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"eslint": "9.14.0",
3838
"eslint-config-next": "15.0.3",
3939
"eslint-config-prettier": "^10.1.1",
40+
"eslint-plugin-import": "^2.31.0",
4041
"eslint-plugin-prettier": "^5.2.6",
4142
"postcss": "^8",
4243
"prettier": "^3.5.3",

0 commit comments

Comments
 (0)