Skip to content

Commit 786def9

Browse files
committed
chore(linting): add prettier, husky, lint-staged
1 parent d77f261 commit 786def9

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.prettierignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
dist
2+
build
3+
coverage
4+
.husky
5+
.huskyrc
6+
*.lockb
7+
8+
*.png
9+
*.jpg
10+
*.jpeg
11+
*.webp
12+
*.ico
13+
14+
.gitignore
15+
.prettierignore
16+
LICENSE
17+
18+
19+
.next
20+
.cache
21+
package-lock.json
22+
public
23+
node_modules
24+
next-env.d.ts
25+
next.config.ts
26+
yarn.lock

.prettierrc.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
bracketSpacing: true
2+
endOfLine: lf
3+
printWidth: 80
4+
semi: false
5+
singleQuote: false
6+
trailingComma: all
7+
8+
overrides:
9+
- files: "*.svg"
10+
options:
11+
parser: "html"
12+
- files: "*.xml"
13+
options:
14+
parser: "html"

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
"scripts": {
77
"dev": "vite",
88
"build": "vite build",
9-
"upload" : "gh-pages -d dist",
109
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
11-
"preview": "vite preview"
10+
"preview": "vite preview",
11+
"check": "prettier --check \"**/*\"",
12+
"format": "prettier --write \"**/*\"",
13+
"prepare": "husky"
1214
},
1315
"dependencies": {
1416
"gh-pages": "^6.0.0",
@@ -23,6 +25,19 @@
2325
"eslint-plugin-react": "^7.32.2",
2426
"eslint-plugin-react-hooks": "^4.6.0",
2527
"eslint-plugin-react-refresh": "^0.4.3",
28+
"eslint-config-prettier": "^9.1.0",
29+
"eslint-plugin-prettier": "^5.1.3",
30+
"husky": "^9.0.11",
31+
"lint-staged": "^15.2.2",
32+
"prettier": "^3.2.5",
2633
"vite": "^4.4.5"
34+
},
35+
"husky": {
36+
"hooks": {
37+
"pre-commit": "lint-staged"
38+
}
39+
},
40+
"lint-staged": {
41+
"**/*": "prettier --write --ignore-unknown"
2742
}
2843
}

0 commit comments

Comments
 (0)