Set up husky and lint-staged

This commit is contained in:
Chi-Hsuan Huang 2022-04-15 11:34:20 +08:00
parent 0b3d2ae09f
commit ee3eb2db95
3 changed files with 2057 additions and 1376 deletions

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

3412
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,13 +19,16 @@
"test:e2e": "wp-scripts test-e2e",
"test:unit": "wp-scripts test-unit-js",
"zip": "./bin/build-zip.sh",
"release": "./bin/release-to-github.sh"
"release": "./bin/release-to-github.sh",
"prepare": "husky install"
},
"devDependencies": {
"@woocommerce/dependency-extraction-webpack-plugin": "1.4.0",
"@woocommerce/eslint-plugin": "1.1.0",
"@wordpress/prettier-config": "^1.0.1",
"@wordpress/scripts": "^13.0.3",
"husky": "^7.0.4",
"lint-staged": "^12.3.7",
"prettier": "npm:wp-prettier@^2.2.1-beta-1"
},
"dependencies": {
@ -37,5 +40,17 @@
"@wordpress/data-controls": "^1.20.7",
"@wordpress/element": "^2.19.1",
"@wordpress/hooks": "^2.11.1"
},
"lint-staged": {
"*.(t|j)s?(x)": [
"npm run format:js",
"npm run lint:js"
],
"*.scss": [
"npm run lint:css"
],
"*.md": [
"npm run lint:md:docs"
]
}
}