Skip to content

Commit 686bd39

Browse files
chore: add lint-staged
1 parent 25c3b9c commit 686bd39

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ yarn.lock
55
.DS_Store
66
dist
77
.idea
8+
9+
# Linters cache
10+
.eslintcache
11+
.stylelintcache

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

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

4-
npm run lint
4+
npx lint-staged

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,21 @@
4747
"eslint-plugin-n": "15.3.0",
4848
"eslint-plugin-promise": "6.0.1",
4949
"husky": "8.0.1",
50+
"lint-staged": "13.0.3",
5051
"prettier": "2.7.1",
5152
"prettier-plugin-astro": "0.5.5",
52-
"stylelint": "^14.13.0",
53-
"stylelint-config-prettier": "^9.0.3",
54-
"stylelint-config-standard": "^28.0.0"
53+
"stylelint": "14.13.0",
54+
"stylelint-config-prettier": "9.0.3",
55+
"stylelint-config-standard": "28.0.0"
5556
},
5657
"config": {
5758
"commitizen": {
5859
"path": "./node_modules/cz-conventional-changelog"
5960
}
61+
},
62+
"lint-staged": {
63+
"*.{astro,cjs,js,jsx,mjs,ts,tsx}": "eslint --cache --fix",
64+
"*.css": "stylelint --cache --fix",
65+
"*": "prettier --cache --ignore-unknown --write"
6066
}
6167
}

0 commit comments

Comments
 (0)