Skip to content

Commit 6126a03

Browse files
authored
Merge pull request #29 from increments/add-lint-staged
Add lint-staged
2 parents d8db9a0 + 7412351 commit 6126a03

File tree

3 files changed

+276
-11
lines changed

3 files changed

+276
-11
lines changed

.husky/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
yarn run format
5-
yarn run lint
4+
yarn run lint-staged

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"html-webpack-plugin": "^5.5.0",
4141
"husky": "^8.0.3",
4242
"jest": "^29.4.3",
43+
"lint-staged": "^13.2.3",
4344
"npm-run-all": "^4.1.5",
4445
"prettier": "^2.8.4",
4546
"react": "^18.2.0",
@@ -59,9 +60,11 @@
5960
"dev:client": "webpack --watch",
6061
"dev:server": "tsc --build --watch",
6162
"dev": "run-p dev:*",
62-
"format": "eslint --fix . && prettier --write .",
63+
"format": "eslint --fix . && prettier --list-different --write .",
6364
"lint": "run-p lint:*",
65+
"lint:prettier:fix": "prettier --list-different --ignore-unknown --write",
6466
"lint:prettier": "prettier --check .",
67+
"lint:eslint:fix": "eslint --fix",
6568
"lint:eslint": "eslint .",
6669
"lint:typecheck": "tsc --noEmit",
6770
"prepare": "husky install",
@@ -82,5 +85,13 @@
8285
"packageManager": "yarn@1.22.19",
8386
"engines": {
8487
"node": ">=18.0.0"
88+
},
89+
"lint-staged": {
90+
"*.{js,ts,tsx}": [
91+
"yarn run lint:eslint:fix"
92+
],
93+
"*": [
94+
"yarn run lint:prettier:fix"
95+
]
8596
}
8697
}

0 commit comments

Comments
 (0)