Skip to content

Commit 9ad2359

Browse files
fix: scope the fix-prettier npm script to its arguments
`fix-prettier` was defined as `prettier --write "projects/**/*.*"`, so the glob was hardcoded into the script. lefthook's pre-push hook calls `npm run fix-prettier {staged_files}` expecting the staged files to be the target, but npm appends those arguments AFTER the existing glob — meaning prettier formatted every file under `projects/**/*.*` on every push, regardless of what was actually staged. A push touching a single test file could leave the working tree with ~200 unrelated modifications. Drop the hardcoded glob so the script only formats the files passed to it. lefthook can now do its `{staged_files}` substitution as intended, and a push that touches three files runs prettier on three files. For manual full-project formatting, use `npx prettier --write "projects/**/*.*"` directly.
1 parent fac26b0 commit 9ad2359

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"build-docs": "cd \"docs/site/angular-auth-oidc-client\" && npm run build",
2929
"check-prettier": "prettier --check \"projects/angular-auth-oidc-client/**/*.*\"",
3030
"check-blockwords": "node ./tools/check-blockwords.js",
31-
"fix-prettier": "prettier --write \"projects/**/*.*\"",
31+
"fix-prettier": "prettier --write",
3232
"coveralls": "cat ./coverage/angular-auth-oidc-client/lcov.info | coveralls",
3333
"start": "ng serve sample-code-flow-refresh-tokens --ssl -o",
3434
"start-sample-code-flow-auto-login": "ng serve sample-code-flow-auto-login --ssl -o",

0 commit comments

Comments
 (0)