Skip to content

Repo: Git hooks should run Prettier only on changed files in commits #5203

Closed
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Suggestion

Right now the pre-push hook in husky runs Prettier on everything, which takes many seconds:

$ git push
yarn run v1.22.19
$ yarn check-format
$ prettier --list-different "./**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}"
Done in 19.43s.
Everything up-to-date

The repository already has a pre-commit hook for formatting. It should be impossible for users to add poorly formatting code unless they manually --no-verify. Is there a reason to keep pre-push in addition to pre-commit?

Related: #445, #556, #5060

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issuerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions