SRVOCF-946: Add Husky pre-commit hook#6
Conversation
|
@Cragsmann: This pull request references SRVOCF-946 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
Have you used our commit message standard as Stas requested on original PR? |
|
Commit message of b390478 doesn't say much. |
Without local checks, lint errors, type failures, and unformatted Go code only surface in CI or code review. This adds a Husky pre-commit hook that catches these before they leave the developer's machine. The hook runs three checks in sequence, failing fast on the first error: eslint/stylelint via "yarn lint:fix", TypeScript type-check via "tsc --noEmit", and Go vet/gofmt on the backend directory. Also adds skipLibCheck to tsconfig.json to avoid type errors from third-party declaration files during the new type-check step. Co-Authored-By: Claude <noreply@anthropic.com>
b390478 to
4315f56
Compare
updated commit message |
|
Where is |
I wonder if this validation won't prevent us/claude from creating verbose commit messages. |
lint:fix modifies files on disk but the changes are not automatically re-staged. The commit would contain the unfixed version while the fix is left as an unstaged working tree change. Plain lint fails fast and lets the developer fix and re-stage intentionally. Co-Authored-By: Claude <noreply@anthropic.com>
Isn't that only for the "title/first line"? The rest of the message can be pretty descriptive still. |
|
Is Commit-msg in this PR? |
It will be in the follow up PR #10 |
|
/uncc |
Without set -e, failures from yarn lint, yarn type-check, and go vet were silently ignored. The hook would exit 0 and allow the commit through. Also deduplicates the gofmt call and switches shebang to bash for pipefail compatibility. Co-Authored-By: Claude <noreply@anthropic.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Cragsmann, matejvasek The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@Cragsmann: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
yarn lint:fix,tsc --noEmit, andgo vet/gofmton backend/type-checkandpreparescripts to package.jsonskipLibCheck: trueto tsconfig.json (prevents false positives from third-party type declarations)yarn installvia thepreparescriptTest plan
yarn lint:fixpassesyarn type-checkpasses