chore: add lint-staged & husky

This commit is contained in:
鲁树人 2023-05-18 00:39:50 +01:00
parent 3b26584f4d
commit 604eb6f939
4 changed files with 1947 additions and 932 deletions

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm exec lint-staged

4
.husky/pre-push Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
pnpm test

View File

@ -12,7 +12,8 @@
"test:ui": "vitest --ui", "test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",
"preview": "vite preview", "preview": "vite preview",
"preview:coverage": "vite preview --outDir coverage --port 5175" "preview:coverage": "vite preview --outDir coverage --port 5175",
"prepare": "husky install"
}, },
"dependencies": { "dependencies": {
"@chakra-ui/icons": "^2.0.19", "@chakra-ui/icons": "^2.0.19",
@ -46,7 +47,9 @@
"eslint-config-prettier": "^8.8.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4", "eslint-plugin-react-refresh": "^0.3.4",
"husky": "^8.0.3",
"jsdom": "^22.0.0", "jsdom": "^22.0.0",
"lint-staged": "^13.2.2",
"prettier": "^2.8.8", "prettier": "^2.8.8",
"typescript": "^5.0.2", "typescript": "^5.0.2",
"vite": "^4.3.2", "vite": "^4.3.2",
@ -54,6 +57,10 @@
"vite-plugin-wasm": "^3.2.2", "vite-plugin-wasm": "^3.2.2",
"vitest": "^0.31.0" "vitest": "^0.31.0"
}, },
"lint-staged": {
"*": "prettier --write --ignore-unknown",
"*.{js,jsx,ts,tsx}": "eslint --fix --report-unused-disable-directives --max-warnings 0"
},
"prettier": { "prettier": {
"singleQuote": true, "singleQuote": true,
"printWidth": 120, "printWidth": 120,

File diff suppressed because it is too large Load Diff