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
Migrate prettier/prettier to prettier/pre-commit #33
Conversation
@sbidoul is there a tool for propagating this change to all repos (13.0 and 14.0)? Is this the problem mentioned in other threads? |
For 14.0 yes, based on For 13.0 it's more difficult. I see @yajo is involved in the linked prettier issues. Let's wait to see what comes out of it. @lmignon had a similar issue on one of our private repos this morning and he could resolve it by pinning the node version like we do on the 14.0 branches. That might be enough as a workaround? |
Thanks for the response. Indeed, seems like this issue can be fixed by pinning the npm version: prettier/prettier#9459 (comment) and pre-commit/pre-commit#1655 However, as I mentioned above, there seems to be plans to completely migrate prettier/prettier to prettier/pre-commit. In that case, it would be necessary to make this change anyway. WDYT @yajo? |
Pinning the npm version means also to change all OCA repos? |
I just noticed #17 |
But if it needs the same propagation, I prefer the definitive patch. |
Yes, that would be better, indeed. |
- repo: https://github.com/prettier/prettier | ||
- repo: https://github.com/prettier/pre-commit | ||
rev: {{ repo_rev.prettier }} | ||
hooks: | ||
- id: prettier | ||
name: prettier + plugin-xml | ||
additional_dependencies: | ||
- prettier@2.1.2 | ||
- "@prettier/plugin-xml@{{ repo_rev.prettier_xml }}" | ||
args: | ||
- --write | ||
- --list-different | ||
- --ignore-unknown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that we don't know what will be the outcome of prettier/pre-commit#18 and prettier/pre-commit#17, so maybe it's better to stick to just changing language version and let these things evolve a bit before we do this change.
Below v13 there's no pre-commit, so it doesn't affect. It's just v13.
Indeed that's the definitive minimal fix. I just tested locally. |
Ok, then what would be the best way to propagate it? |
Probably a handcrafted script. |
Given what I said above in #33 (comment) and that #17 was already merged and prevents prettier/prettier#9459 from happening, my vote goes for closing this PR. When we prepare the new templates for v15, we'll see if prettier/pre-commit#18 and prettier/pre-commit#17 are fixed and what to do about it. Do you agree? Thanks for the patch anyway 😊 |
Well, fine by me 😄 |
@sbidoul knows better... |
@yajo what needs to be done exactly? Pin the node version in the 13.0 branches? |
That change can be done with OCA/maintainer-tools#442 |
Yes, that's it. |
This is now applied on all 13.0 branches. |
Thank you @sbidoul ! |
Prettier installation is currently broken. See prettier/prettier#9459
Steps to reproduce
Locally
If you have prettier cached, clean with
pre-commit uninstall
, and run pre-commit again. You will get an error like:On a CI
If you have a CI system that dynamically pulls and installs prettier in each run, it will happen every time.
Solution
Migrating from https://github.com/prettier/prettier/ to https://github.com/prettier/pre-commit/ (a mirror specifically for pre-commit) solves the problem.
Even if this is a temporary problem, there are plans to fully migrate to prettier/pre-commit in the future (prettier/prettier#8937)
We also need to add extra
args
andadditional_dependencies
from upstream prettier in this case (prettier/pre-commit#16 (comment)) and add the "v" in theref
because the repo structure is different.ping @pedrobaeza @sbidoul @yajo