Skip to content

Commit e268e1a

Browse files
authored
Add lint pre-commit hook using husky & lint-staged (#1973)
1 parent 595b7bd commit e268e1a

File tree

5 files changed

+268
-5
lines changed

5 files changed

+268
-5
lines changed

.husky/pre-commit

+4
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 lint-staged --concurrent false

.lintstagedrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"*": "prettier --write",
3+
"*.(ts|tsx)": ["eslint --fix"]
4+
}

knip.ts

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default {
1212
"@types/yargs",
1313
// Required for `action-validator`
1414
"@action-validator/*",
15+
// Used for git pre-commit hooks
16+
"husky",
1517
],
1618
ignoreBinaries: ["jq", "scripts/in-docker.sh"],
1719
} satisfies KnipConfig;

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@
100100
"eslint-plugin-n": "^17.12.0",
101101
"eslint-plugin-unicorn": "^56.0.0",
102102
"glob": "^11.0.0",
103+
"husky": "^9.1.6",
103104
"knip": "^5.0.0",
105+
"lint-staged": "^15.2.10",
104106
"matrix-web-i18n": "^3.2.1",
105107
"mkdirp": "^3.0.0",
106108
"pacote": "^20.0.0",

0 commit comments

Comments
 (0)