Add Husky + lint-staged (#398)

* Add and setup husky

* Add lint-staged and configure with husky

* Remove eslint

* Remove prettier

* Remove typescript react/jsx and add vue extension

* Add stylelint calls

* Add eslintcache ignore

* Add eslint cache  in all eslint command

* Add config in stylelint

* Add cache option in remaining eslint scripts

* Remove cache option

Co-authored-by: Matt Cowley <me@mattcowley.co.uk>
This commit is contained in:
Amrit Timalsina 2022-11-21 15:37:14 +00:00 committed by GitHub
parent e2a95a5ed4
commit c026007a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1016 additions and 48 deletions

2
.gitignore vendored
View file

@ -7,3 +7,5 @@ node_modules
/build/
/dist/
/dev/
.eslintcache

4
.husky/pre-commit Executable file
View file

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

1043
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -23,10 +23,11 @@
"test": "npm run test:eslint && npm run test:stylelint && npm run test:i18n-packs && npm run test:jest",
"test:jest": "jest --env=jsdom /test/.*.js?$",
"test:fix": "npm run test:eslint:fix",
"test:eslint": "eslint 'src/**/*.{js,vue}'",
"test:eslint": "eslint 'src/**/*.{js,vue}' --cache",
"test:eslint:fix": "npm run test:eslint -- --fix",
"test:stylelint": "stylelint 'src/**/*.scss' --config node_modules/do-bulma/.stylelintrc.json",
"test:i18n-packs": "node --es-module-specifier-resolution=node src/nginxconfig/i18n/verify.js"
"test:i18n-packs": "node --es-module-specifier-resolution=node src/nginxconfig/i18n/verify.js",
"prepare": "husky install"
},
"jest": {
"testRegex": "/test/.*.js?$"
@ -76,8 +77,10 @@
"eslint": "^8.24.0",
"eslint-plugin-vue": "^9.5.1",
"esm": "^3.2.25",
"husky": "^7.0.0",
"jest": "^29.1.2",
"jest-environment-jsdom": "^29.1.2",
"lint-staged": "^13.0.3",
"node-fetch": "^3.2.10",
"postcss": "^8.4.17",
"sass": "^1.55.0",
@ -89,6 +92,14 @@
"webpack": "^5.74.0",
"webpack-bundle-analyzer": "^4.6.1"
},
"lint-staged": {
"*.{js,vue}": [
"eslint --quiet --cache --fix"
],
"*.{scss}": [
"stylelint --config node_modules/do-bulma/.stylelintrc.json --fix"
]
},
"overrides": {
"@vue/cli-service": {
"mini-css-extract-plugin": "^1.6.2"