Skip to content

lefthook: the format pre-commit job fails on docs-only commits #126

Closed

Description

@V3RON

What happens

.oxfmtrc.json sets ignorePatterns: ["docs/**"], but the format job in lefthook.yml runs pnpm exec oxfmt --check {staged_files} on whatever is staged. A commit that stages only files under docs/ hands oxfmt zero targets after the ignore pattern is applied, oxfmt exits 2 with "Expected at least one target file", and the hook rejects a perfectly formatted change.

Found while landing #122: every earlier commit there happened to also stage CHANGELOG.md or README.md, so the first docs-only commit was the first to hit it and had to go in with --no-verify.

Fix

Either skip_empty: true on the format job, or narrow its glob so docs/** is excluded to match .oxfmtrc.json. One line in lefthook.yml.

Activity

  1. 4 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions