Skip to content

Commit 532c011

Browse files
authored
ci(eslint): add husky and commitlint to eslint code (#1021)
1 parent fa0c40a commit 532c011

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

.lintstagedrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*.{js,jsx,ts,tsx,vue}": ["prettier --write", "eslint --fix"],
3+
"*.md": ["prettier --write"]
4+
}

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = { extends: ['@commitlint/config-conventional'] }
1+
module.exports = { extends: ['@commitlint/config-conventional'] }

package.json

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"scripts": {
3434
"preinstall": "npx only-allow pnpm",
3535
"postinstall": "pnpm build:internals",
36+
"prepare": "husky install",
3637
"bootstrap": "pnpm --filter=\"!./packages/dist/**\" install",
3738
"dev": "pnpm build:entry && gulp themeConcat -w & pnpm -C examples/vue3 dev",
3839
"dev:saas": "pnpm create:icon-saas && pnpm build:entry && pnpm -C examples/vue3 dev:saas",
@@ -119,7 +120,8 @@
119120
"build:ui-react": "pnpm create:mapping-react && pnpm build:entry-react && pnpm build:react",
120121
"pub:react": "pnpm --filter=\"./packages/dist-react/**\" publish --no-git-checks --access=public",
121122
"dev:react-site": "pnpm --filter @opentiny/react-site start",
122-
"build:react-site": "pnpm --filter @opentiny/react-site build"
123+
"build:react-site": "pnpm --filter @opentiny/react-site build",
124+
"commit": "git-cz"
123125
},
124126
"dependencies": {
125127
"@vue/composition-api": "1.2.2",
@@ -135,8 +137,6 @@
135137
},
136138
"devDependencies": {
137139
"@antfu/eslint-config": "^0.38.6",
138-
"@commitlint/cli": "^17.3.0",
139-
"@commitlint/config-conventional": "^17.3.0",
140140
"@types/color": "^3.0.3",
141141
"@types/eslint": "^8.4.10",
142142
"@types/node": "^18.11.18",
@@ -159,7 +159,12 @@
159159
"gulp-svg-inline": "^1.0.1",
160160
"gulp-transform": "^3.0.5",
161161
"lerna": "^6.4.0",
162-
"lint-staged": "^13.0.3",
162+
"lint-staged": "^15.2.0",
163+
"husky": "^8.0.0",
164+
"commitlint": "^18.4.3",
165+
"@commitlint/config-conventional": "^18.4.3",
166+
"commitizen": "^4.3.0",
167+
"cz-conventional-changelog": "^3.3.0",
163168
"minimist": "^1.2.8",
164169
"node-xlsx": "^0.21.0",
165170
"prettier": "^3.0.0",
@@ -171,18 +176,6 @@
171176
"vue": "^3.3.9",
172177
"vue-tsc": "^1.6.5"
173178
},
174-
"husky": {
175-
"hooks": {
176-
"pre-commit": "lint-staged",
177-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
178-
}
179-
},
180-
"lint-staged": {
181-
"*.{js,ts,jsx,tsx,vue}": [
182-
"prettier --write",
183-
"eslint --fix"
184-
]
185-
},
186179
"config": {
187180
"commitizen": {
188181
"path": "cz-conventional-changelog"

0 commit comments

Comments
 (0)