Skip to content

Commit 0cf5a6d

Browse files
authored
ci: 🎡 update husky, lint-staged and commitlint (#596)
- fix git commit message linting - fix lint-staged (lint .ts files on commit)
1 parent 4038cb9 commit 0cf5a6d

File tree

4 files changed

+492
-316
lines changed

4 files changed

+492
-316
lines changed

.husky/commit-msg

+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+
yarn commitlint --edit $1

.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+
yarn lint-staged

package.json

+7-9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
},
1313
"scripts": {
1414
"postinstall": "ngcc",
15+
"prepare": "husky install",
1516
"ng": "ng",
1617
"build": "ng build --configuration production && yarn build:schematics && yarn copy:schematics && yarn copy:docs",
1718
"build:schematics": "tsc -p projects/spectator/schematics/tsconfig.json",
@@ -21,8 +22,6 @@
2122
"lint": "ng lint",
2223
"format": "prettier --write \"{projects,src}/**/*.ts\"",
2324
"commit": "git-cz",
24-
"commitmsg": "commitlint -e $GIT_PARAMS",
25-
"precommit": "lint-staged",
2625
"contributors:add": "all-contributors add",
2726
"contributors:generate": "all-contributors generate",
2827
"copy:docs": "cp *.md dist/spectator",
@@ -52,9 +51,9 @@
5251
"@angular/platform-browser": "^15.0.3",
5352
"@angular/platform-browser-dynamic": "^15.0.3",
5453
"@angular/router": "15.0.3",
55-
"@commitlint/cli": "12.0.1",
56-
"@commitlint/config-angular": "12.0.1",
57-
"@commitlint/config-conventional": "12.0.1",
54+
"@commitlint/cli": "17.3.0",
55+
"@commitlint/config-angular": "17.3.0",
56+
"@commitlint/config-conventional": "17.3.0",
5857
"@types/jasmine": "3.8.1",
5958
"@types/jest": "26.0.24",
6059
"@types/node": "16.3.1",
@@ -67,7 +66,7 @@
6766
"eslint": "^8.28.0",
6867
"git-cz": "^4.7.6",
6968
"helpful-decorators": "^2.1.0",
70-
"husky": "^4.3.8",
69+
"husky": "^8.0.2",
7170
"jasmine-core": "3.8.0",
7271
"jasmine-spec-reporter": "7.0.0",
7372
"jest": "28.0.0",
@@ -77,7 +76,7 @@
7776
"karma-coverage-istanbul-reporter": "3.0.3",
7877
"karma-jasmine": "4.0.1",
7978
"karma-jasmine-html-reporter": "1.7.0",
80-
"lint-staged": "^10.5.3",
79+
"lint-staged": "^13.1.0",
8180
"ng-packagr": "15.0.2",
8281
"prettier": "2.3.2",
8382
"rxjs": "6.6.3",
@@ -93,8 +92,7 @@
9392
},
9493
"lint-staged": {
9594
"*.ts": [
96-
"prettier --write",
97-
"git add"
95+
"prettier --write"
9896
]
9997
}
10098
}

0 commit comments

Comments
 (0)