Skip to content

Commit 18c8b4c

Browse files
wiirhanourai
authored andcommitted
chore: enhance ESLint and Prettier configurations for consistent code style and add linting scripts
1 parent a0a32ad commit 18c8b4c

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

.eslintrc.json

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
{
2-
"extends": [
3-
"next/core-web-vitals" // Use next/core-web-vitals for best Next.js defaults
4-
],
2+
"extends": ["next/core-web-vitals"],
53
"rules": {
64
"unused-imports/no-unused-imports": "error",
7-
"no-empty-function": "off", // Only if absolutely necessary
5+
"no-empty-function": "error",
86
"object-shorthand": ["error", "always"],
97
"quotes": ["error", "single"],
10-
"no-unused-vars": "warn", // Use "warn" instead of turning off completely
8+
"no-unused-vars": "error",
9+
"semi": ["warn", "always"],
10+
"indent": ["error", 2],
11+
"comma-dangle": ["warn", "always-multiline"],
12+
"prefer-const": "error",
13+
"arrow-parens": ["error", "as-needed"],
14+
"eol-last": ["error", "always"],
1115
"react/display-name": "off",
12-
"react/no-unknown-property": "off",
13-
"react/prop-types": "off"
16+
"react/no-unknown-property": "off",
17+
"react/prop-types": "off",
18+
"jsx-quotes": ["error", "prefer-double"],
19+
"react/self-closing-comp": [
20+
"error",
21+
{
22+
"component": true,
23+
"html": true
24+
}
25+
]
1426
},
1527
"plugins": ["unused-imports"],
1628
"settings": {
1729
"react": {
18-
"version": "detect" // Automatically detect React version
30+
"version": "detect"
1931
}
2032
}
21-
}
33+
}

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"semi": true,
5+
"tabWidth": 2,
6+
"printWidth": 120,
7+
"bracketSpacing": true,
8+
"arrowParens": "avoid",
9+
"endOfLine": "lf"
10+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"analyze:browser": "cross-env BUNDLE_ANALYZE=browser next build",
1616
"license": "node .knosys/scripts license add",
1717
"doc": "node .knosys/scripts site",
18+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
19+
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
1820
"prepare": "husky"
1921
},
2022
"dependencies": {

0 commit comments

Comments
 (0)