Use Prettier as a codeformatter for all* files#300
Open
DrRataplan wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
Since this touches all files there are many conflicts. The first commit needs to be rebased on main, followed by a |
Not for templates, and not for HTML files because they either do not parse, or give errors.
Contributor
|
I'm missing the instructions how to use in practice. Is the intent that a developer calls (exactly what?) - format or prettier - once in a while ? But ideally we make it a pre-commit hook that would be called without explicit action by developers - It's just too easy to forget and then you run into the same issue you wanted to avoid. |
JoernT
approved these changes
Apr 21, 2026
JoernT
left a comment
Contributor
There was a problem hiding this comment.
looks good to me and certainly help avoid senseless diffs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This enables prettier for all JS, CSS, XQuery, Markdown and JSON files.
All editors have some kind of prettier plugin, often even enabled by default. They usually format on save. Otherwise,
npm run formatjust before committing.Why
At least for me, autoformatting makes my life easier. I do not have to guess codestyle in this file and adhere to it. This is especially nice when working in JS, Cypress tests, XQuery modules and CSS at the same time.
TODO:
*.htmlis excluded for nowFor these we need a new prettier plugin that actually works with jinks-templating files. I'll see what I can come up with.
Discussion
Adding a lot of reviewers because this is kind-of the time to choose options. The following config options are available:
") vs apostrophies (')") here because that seems to be the most used throughout the codebaseIf anyone has feelings with any of these rules let's talk. Let's discuss this once and enforce it for the future.
I do not recommend you to go through all the files. Just pick a few. This PR just changed the whole codebase. I will make git ignore the big commit for blaming, but only after merging