chore: husky hook for eslint and prettier

This commit is contained in:
Aaron Liu 2025-06-22 11:09:43 +08:00
parent 27de5db3e7
commit 8598a56148
6 changed files with 854 additions and 152 deletions

1
.husky/pre-commit Normal file
View File

@ -0,0 +1 @@
npx lint-staged

1
.prettierignore Normal file
View File

@ -0,0 +1 @@

View File

@ -1,3 +1,3 @@
{
"printWidth": 120
}
}

18
eslint.config.js Normal file
View File

@ -0,0 +1,18 @@
import pluginReact from "eslint-plugin-react";
import { defineConfig } from "eslint/config";
import globals from "globals";
import tseslint from "typescript-eslint";
export default defineConfig([
{
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
languageOptions: { globals: globals.browser },
settings: {
react: {
version: "detect",
},
},
},
tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
]);

View File

@ -8,7 +8,10 @@
"build": "vite build",
"build-prod": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
"preview": "vite preview",
"format": "prettier --write .",
"format:check": "prettier --check .",
"prepare": "husky"
},
"dependencies": {
"@emotion/react": "^11.11.1",
@ -88,15 +91,28 @@
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^8.55.0",
"eslint": "^9.29.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"globals": "^16.2.0",
"husky": "^9.1.7",
"less": "^4.2.0",
"lint-staged": "^16.1.2",
"prettier": "3.1.1",
"typescript": "^5.2.2",
"typescript-eslint": "^8.34.1",
"vite": "5.4.6",
"vite-plugin-mkcert": "^1.17.6",
"vite-plugin-pwa": "^0.21.1",
"vite-plugin-static-copy": "^2.2.0"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write"
],
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
}
}

964
yarn.lock

File diff suppressed because it is too large Load Diff