Skip to content

Commit 11544ff

Browse files
committed
chore: 添加 lint-staged
1 parent f910b5f commit 11544ff

File tree

7 files changed

+1122
-7
lines changed

7 files changed

+1122
-7
lines changed

.commitlintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["@commitlint/config-conventional"]
3+
}

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm exec commitlint --config .commitlintrc.json --edit "${1}"

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm exec lint-staged

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
strict-peer-dependencies=false

.vscode/settings.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"axios",
2424
"bumpp",
2525
"chatgpt",
26+
"commitlint",
2627
"esno",
2728
"GPTAPI",
2829
"iconify",

package.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,41 @@
1414
"dev": "vite",
1515
"build": "run-p type-check build-only",
1616
"preview": "vite preview",
17-
"build-only": "vite build",
1817
"type-check": "vue-tsc --noEmit",
19-
"lint": "eslint . --fix --ignore-path .gitignore",
20-
"release": "bumpp package.json --commit --push --tag"
18+
"lint": "eslint .",
19+
"lint:fix": "eslint . --fix",
20+
"release": "bumpp package.json --commit --push --tag",
21+
"prepare": "husky install"
2122
},
2223
"dependencies": {
2324
"naive-ui": "^2.34.3",
2425
"vue": "^3.2.47"
2526
},
2627
"devDependencies": {
2728
"@antfu/eslint-config": "^0.35.2",
29+
"@commitlint/cli": "^17.4.2",
30+
"@commitlint/config-conventional": "^17.4.2",
2831
"@iconify/vue": "^4.1.0",
2932
"@types/node": "^18.13.0",
3033
"@vitejs/plugin-vue": "^4.0.0",
3134
"autoprefixer": "^10.4.13",
3235
"axios": "^1.3.2",
3336
"bumpp": "^8.2.1",
3437
"eslint": "^8.34.0",
38+
"husky": "^8.0.3",
39+
"lint-staged": "^13.1.1",
3540
"npm-run-all": "^4.1.5",
3641
"postcss": "^8.4.21",
42+
"rimraf": "^4.1.2",
3743
"tailwindcss": "^3.2.6",
3844
"typescript": "~4.9.5",
3945
"vite": "^4.1.1",
4046
"vue-tsc": "^1.0.24"
47+
},
48+
"lint-staged": {
49+
"*.{js,ts,jsx,tsx,vue}": [
50+
"pnpm run lint:fix",
51+
"pnpm run type-check"
52+
]
4153
}
4254
}

0 commit comments

Comments
 (0)