Tools: Improve configuration for formatting files - #40994
Merged
Conversation
gziolo
requested review from
TimothyBJacobs,
ajitbohra,
ajlende,
dmsnell,
ellatrix,
juanmaguitar,
nerrad,
ntwb,
ryanwelcher and
spacedmonkey
as code owners
May 11, 2022 10:06
|
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
gziolo
force-pushed
the
update/formatting-improvements
branch
from
May 11, 2022 10:40
2266722 to
10e44ae
Compare
ntwb
requested changes
May 11, 2022
ntwb
left a comment
Member
There was a problem hiding this comment.
Nice, just 1 comment,maybe it's unicode, unsure
gziolo
commented
May 11, 2022
gziolo
force-pushed
the
update/formatting-improvements
branch
from
May 11, 2022 12:35
45c0646 to
efe5f04
Compare
gziolo
force-pushed
the
update/formatting-improvements
branch
3 times, most recently
from
May 11, 2022 12:49
4337b6c to
1d788d3
Compare
Member
Author
|
I think it's ready for final review now. |
gziolo
force-pushed
the
update/formatting-improvements
branch
from
May 11, 2022 20:18
1d788d3 to
5860e60
Compare
dmsnell
approved these changes
May 11, 2022
dmsnell
left a comment
Member
There was a problem hiding this comment.
No need for review from me so I'm lending my approval (please defer to others), nothing here looks risky to the parts I work in. Thanks for normalizing the formatting.
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?
I run into some issues with YAML file formatting when working on #40976 because my IDE was entering tabs instead of spaces. I also noticed that we don't run formatting on JSON files despite having all of them formatted with Prettier in the past.
Why?
It turns out that YAML doesn't allow tabs, see https://yaml.org/faq.html:
I figured out I contributed to that when I removed overrides for YAML in
.editorconfigfiles in #30794 😓I also discovered that
@wordpress/scriptsformats YAML but not JSON. So I thought we should add it to the list since we formatted all JSON files with Prettier in the past in #30714.How?
Enables code formatting for all JSON files in
@wordpress/scriptsand theformatcommand.I executed
npm run formatfor the Gutenberg repository to ensure that formatting for JSON and YAML files is fixed.I updated the pre-commit hook to ensure that formatting triggers correctly for JSON and YAML files. I updated
lint-stagedto v10 which by default automatically adds modified (formatted) files to the current commit.Testing Instructions
npm run formatand make sure there are no changes applied.npm run formatfixes them.