Prettier alternatives
Prettier requires a full-blown node installation and is rather slow. Alternatives would be welcome.
Maybe we soon don't need prettier anymore: https://biomejs.dev/
It doesn't have yaml support yet though
Originally posted by @flying-sheep in https://github.com/scverse/cookiecutter-scverse/issues/277#issuecomment-2073522201
https://github.com/pre-commit/mirrors-prettier
is now archived completely
I can’t add anything to what @henryiii said in https://github.com/prettier/prettier/issues/15742#issuecomment-2118548722
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.
… and the following comment:
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.
pre-commit is just so damn convenient. If there was a trivial way to get auto-formatting of PRs working with just GitHub actions, maybe not using pre-commit would be a good path.
@g-plane @grst please use the issue for discussion.
dprint looks interesting too! But:
- They don’t have official pre-commit support (yet?): https://github.com/dprint/dprint/issues/442
- They don’t plan to support EditorConfig: https://github.com/dprint/dprint/issues/4
- edit: Also there is little tool support, e.g. the VS Code extensions can’t download it and will instead use a global binary in $PATH (which users would need to provide themselves) or load it “from node_modules” (which doesn’t even exist in every npm project because of yarn 2)
[...] will instead use a global binary in $PATH (which users would need to provide themselves) or load it “from node_modules” (which doesn’t even exist in every npm project because of yarn 2)
You can add "dprint.path": "node_modules/dprint/dprint" to your VSCode workspace settings
FWIW, the mirrors suggested in the issue work fine, I've been using https://github.com/rbubley/mirrors-prettier and it's been fine.
@henryiii Are you using a paid version of pre-commit.ci ? I thought that dprint downloading plugins at runtime would make it impossible to use with pre-commit.ci for free . https://github.com/dprint/dprint/issues/442#issuecomment-2219067045
Edit: sorry I completely misread and interpreted as you saying you're using the dprint mirror....
I'm using prettier, as you can see above. :)
Just got pointed to this: https://prettier.io/blog/2023/11/30/cli-deep-dive
Apparently prettier is working on a next-gen CLI that's faster
Biome has editorconfig support and a tagged pre-commit repo, so apart from YAML formatting, it does everything we could want now. I updated #304
What about markdown?
I don’t think it’s wise to use MyST together with a formatter that doesn’t understand MyST syntax and will therefore happily destroy meaningful syntactical constructs.
We could have mdformat as a dedicated hook for markdown formatting. Allegedly, it supports myst.
looks good, but that’d be a big PR reformatting everything. How about we merge #304 and then go for it before the next release?
yes... we can make the next release at the paris hackathon.
Actually, there’s a blocker for mdformat: https://github.com/executablebooks/mdformat-myst/issues/13
I guess we could disable colon fences in the myst configuration?
We could, but that would
- break things for people using cruft who use them.
- potentially break things for people using any myst extensions that aren’t part of the default list: https://github.com/executablebooks/mdformat-myst/issues/13#issuecomment-982142237
So I’ll go ahead with #304 anyway, because the same applies for prettier, and the question if we should have any markdown formatting together with MyST is out-of-scope for #304.
I filed https://github.com/scverse/cookiecutter-scverse/issues/353 for the MDFormat part of this