Skip to content

Commit 25aa26a

Browse files
committed
chore: add strong lint before commit
1 parent c025c77 commit 25aa26a

File tree

5 files changed

+456
-91
lines changed

5 files changed

+456
-91
lines changed

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx --no -- commitlint --edit
4+
pnpm commitlint --edit

.husky/pre-commit

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

.npmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
shamefully-hoist=true
2-
engine-strict = true
2+
engine-strict=true

package.json

+17-23
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
"README.md"
2727
],
2828
"scripts": {
29+
"prepare": "husky install",
30+
"preinstall": "npx only-allow pnpm",
2931
"clean": "rimraf es dist",
3032
"dev": "rollup -c --environment NODE_ENV:production && rollup -c ./scripts/build-package.js -w",
3133
"build": "pnpm clean && vue-tsc && rollup -c --environment NODE_ENV:production && rollup -c ./scripts/build-package.js && rimraf *.tsbuildinfo && pnpm gen-volar-dts",
@@ -38,7 +40,9 @@
3840
"format": "prettier -w types/* packages/*",
3941
"release-major": "standard-version --release-as major --tag-prefix v && pnpm run build",
4042
"release-minor": "standard-version --release-as minor --tag-prefix v && pnpm run build",
41-
"release-patch": "standard-version --release-as patch --tag-prefix v && pnpm run build"
43+
"release-patch": "standard-version --release-as patch --tag-prefix v && pnpm run build",
44+
"lint": "eslint --ext .js,.ts,.tsx,.vue",
45+
"lint:fix": "eslint --ext .js,.ts,.tsx,.vue --fix"
4246
},
4347
"dependencies": {
4448
"mitt": "^3.0.0",
@@ -66,6 +70,8 @@
6670
"eslint-plugin-vue": "^9.6.0",
6771
"fast-glob": "^3.2.12",
6872
"husky": "^7.0.4",
73+
"lint-staged": "^13.2.2",
74+
"pre-commit": "^1.2.2",
6975
"prettier": "^2.7.1",
7076
"rimraf": "^3.0.2",
7177
"rollup": "^2.70.1",
@@ -77,7 +83,7 @@
7783
"tslib": "^2.4.0",
7884
"typescript": "^4.6.3",
7985
"vite": "^4.0.0",
80-
"vue-tsc": "^1.0.0"
86+
"vue-tsc": "^1.6.5"
8187
},
8288
"sideEffects": false,
8389
"pnpm": {
@@ -100,35 +106,23 @@
100106
"vue3-baidu-map-gl",
101107
"vue3-bmap-gl"
102108
],
103-
"husky": {
104-
"hooks": {
105-
"pre-commit": "echo commit",
106-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
107-
}
108-
},
109109
"lint-staged": {
110-
"*.js": [
111-
"prettier --write",
112-
"eslint --fix"
113-
],
114-
"*.ts": [
115-
"prettier --write",
116-
"eslint --fix"
117-
],
118-
"*.tsx": [
110+
"*.{js,ts?(x)}": [
119111
"prettier --write",
120-
"eslint --fix"
112+
"eslint --fix",
113+
"git add"
121114
],
122115
"*.vue": [
123-
"prettier --parser=vue --write",
124-
"eslint --fix"
116+
"eslint --fix",
117+
"git add"
125118
],
126-
"*.css": [
119+
"**/*.css": [
127120
"prettier --write"
128121
],
129-
"*.md": [
122+
"**/*.md": [
130123
"prettier --write --parser markdown --prose-wrap never",
131-
"eslint --fix"
124+
"eslint --fix",
125+
"git add"
132126
]
133127
}
134128
}

0 commit comments

Comments
 (0)