diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..466cbf4 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +cd web && npx lint-staged diff --git a/web/.lintstagedrc.json b/web/.lintstagedrc.json new file mode 100644 index 0000000..a89dec5 --- /dev/null +++ b/web/.lintstagedrc.json @@ -0,0 +1,9 @@ +{ + "*.{js,vue,ts,jsx,tsx}": [ + "eslint --fix", + "prettier --write" + ], + "*.{css,scss,vue}": [ + "prettier --write" + ] +} diff --git a/web/package.json b/web/package.json index 815e2e0..b34579a 100644 --- a/web/package.json +++ b/web/package.json @@ -9,6 +9,7 @@ "build": "vite build", "build:local": "vite build --mode local_prod", "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/", + "prepare": "cd .. && husky install", "build:flowH5": "vite build --config flowH5.config.ts" }, "dependencies": { @@ -83,6 +84,8 @@ "baseline-browser-mapping": "^2.9.19", "eslint": "^8.57.1", "eslint-plugin-vue": "^9.27.0", + "husky": "^9.1.7", + "lint-staged": "^16.4.0", "prettier": "^2.8.1", "sass": "^1.56.2", "typescript": "^4.9.4",