-
Notifications
You must be signed in to change notification settings - Fork 99
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
Formats json and yml files using npm run format #1605
base: trunk
Are you sure you want to change the base?
Changes from all commits
f101786
3fed57a
eaaa59d
a3ae0e1
d336d2a
90ac758
1d13a44
a565773
afc3339
4a9d135
f9a6838
6773f8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,24 @@ | ||
# This file is for unifying the coding style for different editors and IDEs | ||
# editorconfig.org | ||
|
||
# WordPress Coding Standards | ||
# https://make.wordpress.org/core/handbook/best-practices/coding-standards/ | ||
# https://developer.wordpress.org/coding-standards/wordpress-coding-standards/ | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_size = 4 | ||
tab_width = 4 | ||
indent_style = tab | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
[*.yml] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.txt] | ||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[.*rc] | ||
insert_final_newline = false | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.yml] | ||
insert_final_newline = false | ||
quote_type = single | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[.github/CODEOWNERS] | ||
indent_style = space | ||
[*.txt] | ||
end_of_line = crlf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Files and folders related to build | ||
/build | ||
/node_modules | ||
/vendor | ||
/dist | ||
|
||
# Minified files | ||
/*.min.js | ||
|
||
# Ignore Composer lock file | ||
composer.lock | ||
|
||
# Ignore npm package lock file | ||
package-lock.json |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Import the default config file and expose it in the project root. | ||
// Useful for editor integrations. | ||
const wpPrettierConfig = require( '@wordpress/prettier-config' ); | ||
|
||
module.exports = { | ||
...wpPrettierConfig, | ||
overrides: [ | ||
{ | ||
files: '*.yml', | ||
options: { | ||
useTabs: false, | ||
tabWidth: 2, | ||
}, | ||
}, | ||
], | ||
}; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{ | ||
"core": null, | ||
"plugins": [ | ||
"./plugins/optimization-detective", | ||
"./plugins/auto-sizes", | ||
"./plugins/dominant-color-images", | ||
"./plugins/embed-optimizer", | ||
"./plugins/image-prioritizer", | ||
"./plugins/performance-lab", | ||
"./plugins/speculation-rules", | ||
"./plugins/web-worker-offloading", | ||
"./plugins/webp-uploads" | ||
], | ||
"env": { | ||
"tests": { | ||
"config": { | ||
"FS_METHOD": "direct" | ||
}, | ||
"mappings": { | ||
"/wp-content/plugins/performance": "." | ||
} | ||
} | ||
} | ||
"core": null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per https://github.com/WordPress/performance/blob/trunk/.editorconfig#L23-L25 the json config it should use two space not tab 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that when running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems strange that we have to apply a manual override for the default Prettier configuration used by wp-scripts, as that is the de facto standard. Our So I think we should rather update our There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I noticed that too the other week. FWIW the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have updated the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. Can we then remove this |
||
"plugins": [ | ||
"./plugins/optimization-detective", | ||
"./plugins/auto-sizes", | ||
"./plugins/dominant-color-images", | ||
"./plugins/embed-optimizer", | ||
"./plugins/image-prioritizer", | ||
"./plugins/performance-lab", | ||
"./plugins/speculation-rules", | ||
"./plugins/web-worker-offloading", | ||
"./plugins/webp-uploads" | ||
], | ||
"env": { | ||
"tests": { | ||
"config": { | ||
"FS_METHOD": "direct" | ||
}, | ||
"mappings": { | ||
"/wp-content/plugins/performance": "." | ||
} | ||
} | ||
} | ||
} |
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.
Why do we need this override?
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.
@swissspidy When both
.editorconfig
and.prettierrc
are present, Prettier gives precedence to.prettierrc
. Further the recommended indentation for YAML files is two spaces per level, so we override it here.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.
But the default Prettier config should be correct for our needs, and the editorconfig should match the Prettier config 🤔