Skip to content

fix: let the pre-commit hook handle generated-only commits - #37

Merged
QuanticPotatoes merged 1 commit into
masterfrom
fix/lintstaged-generated-files
Sep 1, 2026
Merged

fix: let the pre-commit hook handle generated-only commits#37
QuanticPotatoes merged 1 commit into
masterfrom
fix/lintstaged-generated-files

Conversation

@QuanticPotatoes

@QuanticPotatoes QuanticPotatoes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

With the codegen repaired (#36), the Generate SDK workflow got past generate/build/test for the first time since 2026-08-27 — and died one step later, at the commit:

oxlint --fix
  No files found to lint. Please check your paths and ignore patterns.
husky - pre-commit script failed (code 1)

Cause

lint-staged hands oxlint the staged *.ts files. On an SDK-update commit those are exactly the 5 regenerated files under src/client/, which .oxlintrc.json lists in ignorePatterns. oxlint filters all of them out and then exits 1 on the empty set.

So any commit touching only the generated client is impossible — which is the shape of every single SDK-update commit. Latent since the eslint → oxlint migration (0443560); unreachable until the codegen started running again, so it surfaced only now.

Fix

--no-error-on-unmatched-pattern turns the empty set into a no-op.

Checked that it does not buy the green cheaply:

Case Exit
only ignored paths (src/client/sdk.gen.ts) 0
a real finding (unused variable in src/) 1
pnpm run lint (oxlint src test) unchanged, no flag

Reproduced the full failure locally before and after: regenerate from the live 1.114.0 spec, stage src/client + public-openapi.json, run pnpm lint-staged. Fails on master, passes here.


Note

Low Risk
Tooling-only change to lint-staged; does not alter application logic or how full-repo lint runs.

Overview
Adds --no-error-on-unmatched-pattern to the oxlint --fix step in .lintstagedrc.json.

On SDK/codegen commits, lint-staged only stages regenerated files under src/client/, which .oxlintrc.json already ignores. oxlint then linted nothing and exited 1, so husky blocked commits that touch only generated client output.

With the flag, an empty matched set is a no-op (exit 0); real issues elsewhere and pnpm run lint behavior are unchanged.

Reviewed by Cursor Bugbot for commit a5a04bd. Bugbot is set up for automated code reviews on this repo. Configure here.

The Generate SDK workflow reached the commit step for the first time since
the codegen was repaired, and died there:

    oxlint --fix
      No files found to lint. Please check your paths and ignore patterns.
    husky - pre-commit script failed (code 1)

lint-staged hands oxlint the 5 staged files, all under src/client/, which
.oxlintrc.json lists in ignorePatterns. oxlint filters every path out and
then exits 1 on the empty set, so any commit touching only the generated
client is impossible — which is exactly the shape of every SDK-update
commit. Latent since the eslint -> oxlint move; unreachable until the
codegen ran again.

--no-error-on-unmatched-pattern makes the empty set a no-op. Verified it
does not mask real findings: a file with an unused variable still exits 1,
and 'pnpm run lint' (oxlint src test) keeps the strict behaviour for CI.
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #37   +/-   ##
=======================================
  Coverage   90.75%   90.75%           
=======================================
  Files           1        1           
  Lines         119      119           
  Branches       30       30           
=======================================
  Hits          108      108           
  Misses         11       11           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuanticPotatoes
QuanticPotatoes merged commit 18f051f into master Sep 1, 2026
16 checks passed
@QuanticPotatoes
QuanticPotatoes deleted the fix/lintstaged-generated-files branch September 1, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant