Compare commits

...
Author SHA1 Message Date
rusackasandClaude 93ebe38504 fix(pre-commit): exclude lockfiles from oxfmt-frontend to avoid hard-erroring on lockfile-only diffs
The oxfmt-frontend hook's `files:` regex matches `.json`, which includes
package-lock.json. oxfmt itself internally treats lockfiles as generated
files and filters them out of its target list, so when a diff touches
only a lockfile, pre-commit hands oxfmt a target list that resolves to
zero real files. Unlike prettier (which no-ops cleanly on an empty
target set), oxfmt hard-errors with "Expected at least one target
file. All matched files may have been excluded by ignore rules." and
exits 2.

This masqueraded as a red CI check on any lockfile-only PR, most
immediately dependabot bump #42718, and will recur on every future
lockfile-only dependency bump until fixed on master.

Add an `exclude:` pattern for package-lock.json, yarn.lock, and
pnpm-lock.yaml so pre-commit never hands oxfmt a target set doomed to
be empty. Real frontend source files are unaffected - verified with
`pre-commit run oxfmt-frontend --files <path>` against a lockfile-only
target (now skips cleanly), a real .ts file (still formats), and a
mixed lockfile + real file target (still formats the real file).

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-03 12:49:21 -07:00
+7
View File
@@ -68,6 +68,13 @@ repos:
language: system
pass_filenames: true
files: ^superset-frontend/.*\.(js|jsx|ts|tsx|css|scss|sass|json)$
# oxfmt treats lockfiles as generated files and internally filters them
# out of its target list. If a diff only touches a lockfile, pre-commit
# still hands it to oxfmt as the sole target, and oxfmt hard-errors with
# "Expected at least one target file" once its internal filtering leaves
# zero files to format. Excluding lockfiles here keeps pre-commit from
# ever invoking oxfmt on a target set that's guaranteed to end up empty.
exclude: ^superset-frontend/(package-lock\.json|yarn\.lock|pnpm-lock\.yaml)$
- repo: local
hooks:
- id: oxlint-frontend