Skip to content

Commit 27a8241

Browse files
authored
Fix/format (#945)
* build: add husky hook for pre-commit * fix: code format * fix: change lint-staged only used by prettier * revert: code format * build: remove script husky-hook * ci: fix npm7 run scripts bug
1 parent 275374e commit 27a8241

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
key: lock-${{ github.sha }}
2525

2626
- name: create package-lock.json
27-
run: npm i --package-lock-only
27+
run: npm i --package-lock-only --ignore-scripts
2828

2929
- name: hack for singe file
3030
run: |

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
4646
"lint": "eslint src/ --ext .tsx,.ts",
4747
"lint:tsc": "tsc -p tsconfig.json --noEmit",
48-
"now-build": "npm run docs:build"
48+
"now-build": "npm run docs:build",
49+
"prepare": "husky install"
4950
},
5051
"peerDependencies": {
5152
"react": ">=16.9.0",
@@ -74,8 +75,10 @@
7475
"father": "^4.0.0",
7576
"gh-pages": "^3.1.0",
7677
"glob": "^7.1.6",
78+
"husky": "^8.0.3",
7779
"immutability-helper": "^3.0.0",
7880
"less": "^3.10.3",
81+
"lint-staged": "^13.1.0",
7982
"np": "^7.0.0",
8083
"prettier": "^2.0.1",
8184
"rc-animate": "^3.0.0",
@@ -93,5 +96,11 @@
9396
"regenerator-runtime": "^0.13.7",
9497
"styled-components": "^5.0.1",
9598
"typescript": "^4.8.4"
99+
},
100+
"lint-staged": {
101+
"**/*.{js,jsx,tsx,ts,md,json}": [
102+
"prettier --write",
103+
"git add"
104+
]
96105
}
97-
}
106+
}

0 commit comments

Comments
 (0)