Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note about pre-commit mirror versions to docs/precommit.md #14775

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/precommit.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ Copy the following config into your `.pre-commit-config.yaml` file:
- id: prettier
```

Note that the pre-commit mirror for prettier does not support the concept of multiple npm dist-tags and as such only mirrors version numbers that increase monotonically. As a result the mirror will stop mirroring tags for stable releases if a higher versioned pre-release has been posted to npm in the meantime.
This is important to keep in mind when using `pre-commit autoupdate` as this behaviour may lead to a pre-release version being selected if one is available.
To install a version with a tag that is unavailable from the mirror you can use a `.pre-commit-config.yaml` file like this:

```yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "" # Can be ignored
hooks:
- id: prettier
additional_dependencies:
- prettier@2.8.8 # Set the version tag to your desired version number
```

This effectively disables auto updates for the prettier portion of your pre-commit config but also ensures that a selected stable version is not overwritten by a pre-release version from the mirror.
Read more at [mirror of prettier package for pre-commit](https://github.com/pre-commit/mirrors-prettier) and the [pre-commit](https://pre-commit.com) website.

## Option 4. [Husky.Net](https://github.com/alirezanet/Husky.Net)
Expand Down