-
Notifications
You must be signed in to change notification settings - Fork 1
wp-prettier should be a dependency, not devDependency #235
Copy link
Copy link
Labels
[Type] BugSomething isn't workingSomething isn't working
Description
Summary
The wp-prettier package is declared as a devDependency in package.json, but it should be a regular dependency (or peerDependency). This causes projects using @automattic/eslint-plugin-wpvip to get the wrong Prettier version.
Current behaviour
When a project installs @automattic/eslint-plugin-wpvip, npm installs:
eslint-plugin-prettier@5.5.4(from dependencies)prettier@3.7.4(regular Prettier, resolved by eslint-plugin-prettier)
But wp-prettier@3.0.3 is only in devDependencies, so it's not installed.
Expected behaviour
Projects should get wp-prettier (which supports parenSpacing: true for WordPress coding standards) instead of regular Prettier.
Impact
When running eslint --fix, the prettier plugin uses regular Prettier which:
- Ignores the
parenSpacing: trueoption from the providedprettierrc.js - Removes spaces inside parentheses, e.g.
$( this )becomes$(this)(example) - Produces output that doesn't match WordPress coding standards
Reproduction
- Create a project with:
{ "devDependencies": { "@automattic/eslint-plugin-wpvip": "^1.1.1", "eslint": "^9.7.0" } } - Run
npm install - Check
npm ls prettier- showsprettier@3.7.4, not wp-prettier - Run
eslint --fixon code with WordPress-style spacing - Spaces inside parentheses are removed
Suggested fix
Move prettier from devDependencies to dependencies:
"dependencies": {
+ "prettier": "npm:wp-prettier@3.0.3",
"eslint-plugin-prettier": "5.5.4",Or alternatively, add it as a peerDependency and document that users should install wp-prettier.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Type] BugSomething isn't workingSomething isn't working