Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#60316 closed enhancement (fixed)

Build Tools: Configure prettier properly.

Reported by: youknowriad's profile youknowriad Owned by: youknowriad's profile youknowriad
Milestone: 6.5 Priority: normal
Severity: trivial Version: 6.5
Component: Build/Test Tools Keywords: has-patch
Focuses: javascript Cc:

Description

When working on the package update ticket/PR I mistakenly overwrote the webpack config file styling by using prettier. It turns out that WordPress Core is not defining the right prettier config, even if it has prettier in its dependencies.

Change History (5)

This ticket was mentioned in PR #5923 on WordPress/wordpress-develop by @youknowriad.


6 months ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/60316

The config has just been copied from Gutenberg Repo.

Testing instructions

  • Open VSCore and have the prettier extension installed
  • Open any js file (like webpack.config.js)
  • Format the file
  • Prettier should use the right prettier config

#2 @swissspidy
6 months ago

Related: #31823

Does adding the Prettier config cause any accidental changes to existing files which may not yet 100% adhere to coding standards?

#3 @youknowriad
6 months ago

  • Owner set to youknowriad
  • Resolution set to fixed
  • Status changed from assigned to closed

In 57330:

Build Tools: Configure prettier properly.

Allows tools like prettier or VSCode to auto-format JS files propertly.
It pulls the prettier config that is used in the Gutenberg repository.

Props gziolo.
Fixes #60316.

This ticket was mentioned in Slack in #core by swissspidy. View the logs.


6 months ago

#5 @youknowriad
6 months ago

Does adding the Prettier config cause any accidental changes to existing files which may not yet 100% adhere to coding standards?

Well I added it because I had accidental changes caused by me formatting files in Core. So in that sense, Core already had a prettier config (as it had prettier as a dependency) but it was just using the default one. Adding this reduces the risk of accidental changes.

Note: See TracTickets for help on using tickets.