WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.34k stars 4.13k forks source link

Project scaffolded by @wordpress/create-block does not enforce WordPress Coding Standards #44095

Open mburridge opened 2 years ago

mburridge commented 2 years ago

What problem does this address?

The project scaffolded by @wordpress/create-block is consistent with the WordPress Coding Standards, but it doesn't enforce them in subsequent development.

If you deviate from the WordPress Coding Standards the linter will adapt, e.g. if you put double quotes around a string in a .js file in a newly scaffolded project and then save the file the linter will put double quotes around all the strings.

What is your proposed solution?

I think simply adding:

"prettier": "@wordpress/prettier-config"

to the package.json file generated in the project will enforce the WordPress Coding Standards when a file in the project is saved.

gziolo commented 2 years ago

The issue is more nuanced and tracked in https://github.com/WordPress/gutenberg/issues/21872. One of the motivations of the proposal to change WordPress Coding Standards for JavaScript was the ability to use the original Prettier that would resolve this issue. Unfortunately, this attempt failed because of the lack of consensus from WordPress core committers. The alternative approach to convenience Prettier's maintainers to add exception for the WordPress project https://github.com/prettier/prettier/issues/13107 has also stalled.