Skip to content

Commit ca77974

Browse files
authored
chore: add lint-staged to run prettier against git-staged files (#104)
* chore: add lint-staged * chore: match all files
1 parent e34deb7 commit ca77974

File tree

4 files changed

+273
-4
lines changed

4 files changed

+273
-4
lines changed

.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-
pnpm format
4+
pnpm lint-staged

.prettierignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ packages/playground-temp
66
doc-site/dist
77
doc-site/node_modules
88

9-
playground-report
9+
playground-report
10+
11+
pnpm-lock.yaml
12+
pnpm-workspace.yaml
13+
14+
LICENSE

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "pnpm -r --filter='./packages/*' run build",
99
"dev": "pnpm -r --parallel --filter='./packages/*' run dev",
10-
"format": "prettier --write ./**/*.{js,ts,tsx}",
10+
"format": "prettier --write * --ignore-unknown",
1111
"ver": "pnpm recursive --filter create-vite-pages --filter vite-plugin-react-pages --filter vite-pages-theme-doc exec -- npm version",
1212
"ver:p": "npm run ver -- patch",
1313
"ver:mi": "npm run ver -- minor",
@@ -23,8 +23,14 @@
2323
"test-debug": "pnpm test -- --debug",
2424
"build:docs": "pnpm --filter doc-site run ssr-for-deploy",
2525
"install-test-deps": "playwright install --with-deps chromium",
26+
"lint-staged": "lint-staged -q",
2627
"prepare": "husky install"
2728
},
29+
"lint-staged": {
30+
"*": [
31+
"prettier --write --cache --ignore-unknown"
32+
]
33+
},
2834
"devDependencies": {
2935
"@playwright/test": "~1.29.0",
3036
"@pnpm/link-bins": "^8.0.4",
@@ -35,6 +41,7 @@
3541
"execa": "^5.1.1",
3642
"get-port": "^5.1.1",
3743
"husky": "^8.0.2",
44+
"lint-staged": "^13.1.0",
3845
"prettier": "^2.8.1",
3946
"sirv": "^2.0.2",
4047
"slash": "^3.0.0",

0 commit comments

Comments
 (0)