-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
chore: enabled Prettier in Trunk #19354
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-eslint canceled.
|
13ed57d
to
efa7e1a
Compare
03e0e56
to
4dd2dc7
Compare
c77c923
to
1d067f1
Compare
9f0ed89
to
2fd4fc5
Compare
2fd4fc5
to
de09734
Compare
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.
Thanks for taking a look at this. Is your recommendation that this be merged first and then #19355?
And we should discuss what we want for Prettier options. We've started a new format in the rewrite repo, so maybe we want to stick with that here?
@@ -72,8 +72,7 @@ | |||
"pre-commit": "lint-staged" | |||
}, | |||
"lint-staged": { | |||
"*.js": "trunk check --fix --filter=eslint", | |||
"*.md": "trunk check --fix --filter=markdownlint", | |||
"*": "trunk check --fix", |
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.
This means every single file type will be run through Trunk, and I'm not sure we want that at this point.
Let's go slow and just stick with JS and Markdown. We can explore other file types later.
Note there are linting errors. |
Yes. The order isn't extremely important - in theory that one could be merged first, then this one have the OTOH, there's an argument that merging the formatting PR in first is friendlier. It's more likely of a PR to have unexpected delays. Minimizing the time when
👍 That'd be my vote: going with the defaults unless directed otherwise:
Just confirming: are you referring to the Verify job failure from Trunk? https://github.com/eslint/eslint/actions/runs/13081264060/job/36505118543:
If so: 👍 this is expected. Trunk is applying formatting concerns as configured in this PR but the files haven't been formatted yet.
|
Yes, that's the failure I'm referring to. That's part of why I was asking about the order of merging these PRs, as we don't want to merge something that will cause a CI failure. The Prettier defaults don't work well in all situations. Here's what we have in the new repos: @eslint/eslint-tsc do we want to go with that in this repo too? My vote is 👍 |
If we stick with two PRs then I don't think there's a way to avoid CI failures. This PR fails CI because it changes formatting & linting settings without changes code. The other PR fails because it changes code without changing formatting & linting settings. We could avoid a failure by sticking to one PR. We'd have to merge it carefully and not squash the commits. Alternately, we could go with three PRs:
|
No objections to enforcing that files are formatted with Prettier in this repo from my end, and I think that using the same settings as in other repos is a good idea. We'll end up with a mess of merge conflicts in other pull requests but that's a temporary effect. |
Ping @mdjermanovic |
I agree that we use the same Prettier settings as in other repos. |
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[ ] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofix to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain: internal tooling change
Fixes #17814 (part 1 of 2).
What changes did you make? (Give an overview)
Removes the disabling of
prettier
in Trunk and expandslint-staged
so that roughly all files will be formatted with Prettier.The
.markdownlint.yml
,docs/.stylelintrc.json
, andeslint.config.js
config files needed to be changed to exclude formatting rules that conflict with Prettier. This change additionally addsignore
entries totrunk.yaml
to exclude:_includes
in docsI chose to add
"trailingCommas": "none"
in the.prettierrc.json
because it seems to be the existing style. The line changes excluding inline config comments in #19355 came out to:"all"
(default):206012 insertions(+), 178431 deletions(-)
"none"
:178480 insertions(+), 151397 deletions(-)
I personally prefer the default for consistency and to remove a config file, though, and would be very up for changing it if requested. 🙂
Is there anything you'd like reviewers to focus on?
CI failures are expected. This PR does not include the actual formatting of files with Prettier. That would make for a huge nigh-unreviewable diff. Keeping the formatting application to a separate PR & commit also makes it much easier to
.git-blame-ignore-revs
them away.Subsequent formatting PR that includes these changes: #19355. If & when these two PRs are approved I would recommend merging this one first, then that one as a squash commit.