Skip to content

Commit b1dec5a

Browse files
authored
chore(repo): run linter fix against staged files in pre-commit hook (#13349)
* chore(repo): run linter fix against staged files in pre-commit hook * exclude .husky from license header check
1 parent 2ce82f9 commit b1dec5a

File tree

5 files changed

+239
-9
lines changed

5 files changed

+239
-9
lines changed

.husky/pre-commit

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Run `eslint --fix` against staged files
2+
yarn lint-staged

.lintstagedrc.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
"*.{ts,tsx}": "eslint --fix"
3+
}

license_config.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"**/Gemfile",
3939
"**/.rollup.cache",
4040
"**/rollup.config.mjs",
41-
"rollup"
41+
"rollup",
42+
".husky"
4243
],
4344
"ignoreFile": ".gitignore",
4445
"license": "license_header.txt",

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"publish:v5-stable": "lerna publish --conventional-commits --yes --dist-tag=stable-5 --message 'chore(release): Publish [ci skip]' --no-verify-access",
3333
"publish:verdaccio": "lerna publish --canary --force-publish --no-push --dist-tag=unstable --preid=unstable --yes",
3434
"ts-coverage": "lerna run ts-coverage",
35-
"prepare": "./scripts/set-preid-versions.sh"
35+
"prepare": "husky && ./scripts/set-preid-versions.sh"
3636
},
3737
"workspaces": {
3838
"packages": [
@@ -103,11 +103,13 @@
103103
"eslint-plugin-promise": "^6.1.1",
104104
"eslint-plugin-unused-imports": "^3.0.0",
105105
"glob": "^10.3.10",
106+
"husky": "^9.0.11",
106107
"jest": "^29.7.0",
107108
"jest-environment-jsdom": "^29.7.0",
108109
"json-loader": "^0.5.7",
109110
"lerna": "^7.4.2",
110111
"license-check-and-add": "^4.0.5",
112+
"lint-staged": "^15.2.2",
111113
"mkdirp": "^3.0.1",
112114
"prettier": "^3.2.5",
113115
"rimraf": "^2.6.2",

0 commit comments

Comments
 (0)