-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Tools: Improve configuration for formatting files #40994
Conversation
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
2266722
to
10e44ae
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.
Nice, just 1 comment,maybe it's unicode, unsure
45c0646
to
efe5f04
Compare
4337b6c
to
1d788d3
Compare
I think it's ready for final review now. |
1d788d3
to
5860e60
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.
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.
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.
Looks good 👌🏼
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
.editorconfig
files in #30794 😓I also discovered that
@wordpress/scripts
formats 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/scripts
and theformat
command.I executed
npm run format
for 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-staged
to v10 which by default automatically adds modified (formatted) files to the current commit.Testing Instructions
npm run format
and make sure there are no changes applied.npm run format
fixes them.