ci: run lint-staged on changed files instead of full format/lint checks - #44
Closed
titan-ron wants to merge 3 commits into
Closed
ci: run lint-staged on changed files instead of full format/lint checks#44titan-ron wants to merge 3 commits into
titan-ron wants to merge 3 commits into
Conversation
Add a dedicated lint-staged workflow that lints/formats only the files changed in a PR (or push) via 'lint-staged --diff', and fail if any fix is needed. Remove the whole-tree Lint and Format steps from ci.yml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/jestThe overall coverage in commit eaed853 in the Updated |
The shallow (--depth=1) fetch of the base branch left no merge-base for the 'origin/<base>...HEAD' range, so lint-staged failed to resolve changed files. Fetch the base ref to full depth instead. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fold the standalone lint-staged workflow into ci.yml as a job named 'sca' and gate 'release' on it, restoring lint/format as a release prerequisite. Remove the now-redundant lint-staged.yml. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a dedicated
🧹 Lint (staged)workflow (.github/workflows/lint-staged.yml) that runslint-stagedagainst only the files changed in a PR (or push), and removes the whole-treeLintandFormatsteps fromci.yml.Why
PR #35 (Dependabot bumping
prettier3.8.4 → 3.9.5) failed CI because the new prettier reformatted an untouched line insrc/lib/types.ts. The fullformat:checkflags files no one edited in the PR. Runninglint-stagedscoped to changed files mirrors the local pre-commit hook and avoids failures on unrelated files.How it works
origin/<base>...HEADfor PRs,before...HEADfor pushes (with a fallback for the initial-push / missing-base case).npx lint-staged --diff=<range>, which applieseslint --fix+prettier --writeto the changed files and exits non-zero on unfixable lint errors.git diff --quiet HEADdetects them; if fixes were needed the job prints the diff and fails.Notes
npm run lint:check/format:checkremain available for local/manual use.releasejob no longer transitively waits on lint/format; those are enforced on the PR before merge.