-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Issue with pretier 4.0.0@alpha3 and pre-commit #15742
Comments
For anyone else hitting this, adding |
For anyone that uses
|
PRETTIER_LEGACY_CLI=1 isn't working for me. It changes error behavior and now I have dozens of: [error] No parser could be inferred for file ..... |
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.3](pre-commit/mirrors-prettier@v3.1.0...v4.0.0-alpha.3) * Work around prettier/prettier#15742 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris Markiewicz <markiewicz@stanford.edu>
The issue lie with the prettier mirror env, here. pre-commit already fails when a file is modified by a hook, so
(Note however that |
* ⬆️🪝 update pre-commit hooks updates: - [github.com/pre-commit/mirrors-clang-format: v17.0.5 → v17.0.6](pre-commit/mirrors-clang-format@v17.0.5...v17.0.6) - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.3](pre-commit/mirrors-prettier@v3.1.0...v4.0.0-alpha.3) * Workaround for error message See prettier/prettier#15742 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Stefan Engels <112686201+sengels-tum@users.noreply.github.com>
* cf. prettier/prettier#15742 * this doesn't work locally for me, testing it in CI. Otherwise changing to prettier/pre-commit
* 🔧 添加editorconfig * ⬆️ set prettier to v4.0.0-alpha8 to avoid prettier/prettier#15742 * 👷 更改ci发版方式
I just opened a related issue #16076, which points out https://github.com/pre-commit/mirrors-prettier stopped supporting |
it appears that mirrors-prettier is deprecated and no longer in use but it's still the recommended setup in the official prettier docs: https://prettier.io/docs/en/precommit.html could someone update the recommended configuration using prettier and pre-commit now that this repo is deprecated? |
this is what we are using now in our pre commit config with prettier version - id: prettier
name: Prettier
language: node
entry: yarn
args: [run, prettier, --write, --ignore-unknown]
types: [file] i think this is doing what we need where it's only running prettier against files that are staged. and has the added benefit of our |
Not just deprecated: the mirror was archived at 4.0.0-alpha.8. Without any notice on how to replace it, just the notice "prettier made some changes that breaks plugins entirely". 6,500 projects use this hook, including more than a dozen of mine. |
The prettier website also refers to the mirror for pre-commit usage here |
the mirrors-prettier plugin seems to work perfectly fine for me without having to change anything from the example in the docs. i have no idea why asottile would archive the repo with such a useless, unhelpful message like "prettier made some changes that breaks plugins entirely" without any information as to what exactly the issue was, but that's to be expected considering how rude he is to anybody who tries to raise an issue on any of his projects. as far as i can tell, the issue seems to be resolved in the latest beta (4.0.0@alpha8, the version it was archived at). |
It was fixed in pre-commit/mirrors-prettier#51 (so for It would be nice if prettier had this pre-commit config directly in the main repository so a mirror is not required, but I can understand if they don't want to do it. Edit after digging: I think the easier fix is to use the for of the mirror by rbubley , but you really need some digging before finding it atm :) |
Hi there,
Updating the
pre-commit
hook to the latest version causes the following error:This has been the case since 4.0.0@alpha1.
The text was updated successfully, but these errors were encountered: