[CONFIG] Add PostCSS support to prettier css overrides#349
[CONFIG] Add PostCSS support to prettier css overrides#349
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the project’s Prettier configuration so PostCSS (.pcss) files receive the same CSS-specific formatting overrides as other stylesheet files, and documents the change in the changelog.
Changes:
- Updated
.prettierrc.jsto extend@wordpress/prettier-configand include.pcssin the CSS override file matching. - Added a
2026.04changelog entry noting the Prettier.pcsssupport update. - Normalized indentation/trailing whitespace for a few existing changelog bullets.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.prettierrc.js |
Extends the WordPress Prettier config and modifies the CSS override to include .pcss. |
CHANGELOG.md |
Adds a release note for the Prettier config update and cleans up a few formatting inconsistencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I'm going to let @dpellenwood have the final say here. Personally, I haven't had this issue, but it's possible I've configured my iDE to do this and haven't needed specific project configuration to do so. If this is indeed happening, I agree with what Copilot is saying here in terms of just making sure we're overriding the correct thing by checking against stuff. Entirely possible |
|
@spadilha , I've not experienced this issue. By default prettier (via If you run What scenarios are you seeing where the WP Scripts format command is processing style files? |
|
@dpellenwood my local setup uses Prettier as the default formatter for style files. I like it because it removes parenSpacing, switches single quotes to double quotes, cleans up spacing, and most importantly fixes indentation. Stylelint does not handle those things. How are you usually formatting CSS files? I did not run into this in the GUQ or Mediavine projects because they do not have a In ModernPress, when I format a .pcss file locally with Prettier, it gets JS style formatting, which is the opposite of what I need. @GeoffDusome I changed the approach and now I am just adding a dedicated override for This got me thinking, has no one else run into this with the WordPress Prettier config and |
What does this do/fix?
This pull request updates the project’s Prettier configuration to properly support PostCSS files. It extends the WordPress Prettier config and adds
.pcssto the files that should use CSS formatting rules, ensuring consistent styling across all CSS-related files.This builds on the Prettier setup introduced in #276. The default
@wordpress/prettier-configdoes not include.pcssin its CSS overrides, so PostCSS files were being formatted with JavaScript rules. This change addresses that gap at the project level.Prettier configuration improvements:
.prettierrc.js: Now extends the WordPress Prettier config and adds.pcssto the list of files receiving CSS formatting rules, so PostCSS files are formatted consistently with other CSS files.QA
Pull request checklist