diff --git a/.husky/note.md b/.husky/note.md new file mode 100644 index 0000000..984c9c2 --- /dev/null +++ b/.husky/note.md @@ -0,0 +1 @@ +try to run `chmod +x ./.husky/pre-commit` if pre-commit doesn't work. \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..a8e1bbf --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx eslint ./src --ext .js,.vue \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 464d9f9..006cbe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,6 +20,7 @@ "eslint": "^8.14.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-vue": "^8.7.1", + "husky": "^7.0.4", "less": "^4.1.2", "less-loader": "^10.2.0", "mockjs": "^1.1.0", @@ -2390,6 +2391,18 @@ "node": ">= 12" } }, + "node_modules/husky": { + "version": "7.0.4", + "resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -6037,6 +6050,12 @@ } } }, + "husky": { + "version": "7.0.4", + "resolved": "https://registry.npmmirror.com/husky/-/husky-7.0.4.tgz", + "integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==", + "dev": true + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/package.json b/package.json index b48d3fa..428e1ad 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "preview": "npm run build && vite preview", "preview:staging": "npm run build:staging && vite preview --mode=staging", "lint": "eslint ./src --ext .js,.vue", - "lint:fix": "eslint ./src --ext .js,.vue --fix" + "lint:fix": "eslint ./src --ext .js,.vue --fix", + "prepare": "husky install" }, "dependencies": { "axios": "^0.27.0", @@ -25,6 +26,7 @@ "eslint": "^8.14.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-plugin-vue": "^8.7.1", + "husky": "^7.0.4", "less": "^4.1.2", "less-loader": "^10.2.0", "mockjs": "^1.1.0",