Add husky/lint-staged

This commit is contained in:
Krzysztof Wolski 2022-07-20 16:27:07 +02:00
parent 88d1dc6322
commit ebb0cfa01a
3 changed files with 19 additions and 1 deletions

4
.husky/pre-commit Executable file
View file

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

View file

@ -10,6 +10,7 @@
"build": "tsup-node src/* --format esm,cjs --dts && clear-package-json package.json -o dist/package.json --fields publishConfig", "build": "tsup-node src/* --format esm,cjs --dts && clear-package-json package.json -o dist/package.json --fields publishConfig",
"test": "uvu -r tsm spec", "test": "uvu -r tsm spec",
"test-watch": "watchlist src spec -- pnpm test", "test-watch": "watchlist src spec -- pnpm test",
"prepare": "husky install",
"lint": "prettier --loglevel warn --write . && eslint --fix ." "lint": "prettier --loglevel warn --write . && eslint --fix ."
}, },
"keywords": [], "keywords": [],
@ -35,6 +36,7 @@
"eslint-plugin-react": "^7.30.1", "eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0", "eslint-plugin-simple-import-sort": "^7.0.0",
"husky": "^8.0.1",
"prettier": "2.6.2", "prettier": "2.6.2",
"tsm": "^2.2.1", "tsm": "^2.2.1",
"tsup": "^6.1.3", "tsup": "^6.1.3",
@ -42,6 +44,10 @@
"uvu": "^0.5.6", "uvu": "^0.5.6",
"watchlist": "^0.3.1" "watchlist": "^0.3.1"
}, },
"lint-staged": {
"*.{js,ts,tsx}": "eslint --cache --fix",
"*.{js,ts,tsx,css,md,json}": "prettier --write"
},
"exports": { "exports": {
"./package.json": "./package.json", "./package.json": "./package.json",
"./const": { "./const": {

View file

@ -16,6 +16,7 @@ specifiers:
eslint-plugin-simple-import-sort: ^7.0.0 eslint-plugin-simple-import-sort: ^7.0.0
fast-glob: ^3.2.11 fast-glob: ^3.2.11
graphql: ^16.5.0 graphql: ^16.5.0
husky: ^8.0.1
jose: ^4.8.3 jose: ^4.8.3
prettier: 2.6.2 prettier: 2.6.2
retes: ^0.29.4 retes: ^0.29.4
@ -45,6 +46,7 @@ devDependencies:
eslint-plugin-react: 7.30.1_eslint@8.15.0 eslint-plugin-react: 7.30.1_eslint@8.15.0
eslint-plugin-react-hooks: 4.6.0_eslint@8.15.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.15.0
eslint-plugin-simple-import-sort: 7.0.0_eslint@8.15.0 eslint-plugin-simple-import-sort: 7.0.0_eslint@8.15.0
husky: 8.0.1
prettier: 2.6.2 prettier: 2.6.2
tsm: 2.2.1 tsm: 2.2.1
tsup: 6.1.3_typescript@4.7.4 tsup: 6.1.3_typescript@4.7.4
@ -1425,6 +1427,12 @@ packages:
engines: {node: '>=10.17.0'} engines: {node: '>=10.17.0'}
dev: true dev: true
/husky/8.0.1:
resolution: {integrity: sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==}
engines: {node: '>=14'}
hasBin: true
dev: true
/ignore/5.2.0: /ignore/5.2.0:
resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==} resolution: {integrity: sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==}
engines: {node: '>= 4'} engines: {node: '>= 4'}