Skip to content

Conversation

@GaryJones
Copy link

Summary

  • Moves prettier (npm:wp-prettier@3.0.3) from devDependencies to dependencies

Problem

Projects using this plugin need wp-prettier (not regular prettier) to correctly handle WordPress-specific formatting options like parenSpacing: true.

When wp-prettier was only in devDependencies, eslint-plugin-prettier would resolve its peer dependency to regular prettier, causing eslint --fix to incorrectly remove spaces inside parentheses:

// WordPress style (correct)
$( this ).addClass( 'hidden' )

// Gets incorrectly "fixed" to:
$(this).addClass('hidden')

Test plan

  • npm test passes
  • npm run lint passes
  • Verify in a consuming project that npm ls prettier shows wp-prettier under eslint-plugin-prettier

Fixes #235

🤖 Generated with Claude Code

Projects using this plugin need wp-prettier (not regular prettier) to
correctly handle WordPress-specific formatting options like parenSpacing.

When wp-prettier was only in devDependencies, eslint-plugin-prettier would
resolve its peer dependency to regular prettier, causing eslint --fix to
incorrectly remove spaces inside parentheses.

Fixes #235

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@GaryJones
Copy link
Author

Workaround until this is merged

Projects can use npm overrides in their package.json to force the correct prettier version:

{
  "overrides": {
    "@automattic/eslint-plugin-wpvip": {
      "eslint-plugin-prettier": {
        "prettier": "npm:wp-prettier@3.0.3"
      }
    }
  }
}

After adding this, run rm -rf node_modules package-lock.json && npm install to regenerate the lock file.

You can verify it worked with npm ls prettier — you should see wp-prettier@3.0.3 under eslint-plugin-prettier instead of regular prettier@3.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp-prettier should be a dependency, not devDependency

2 participants