Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts: format has unknown option parenSpacing #34622

Closed
TobiasBg opened this issue Sep 7, 2021 · 4 comments
Closed

Scripts: format has unknown option parenSpacing #34622

TobiasBg opened this issue Sep 7, 2021 · 4 comments
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Tool] WP Scripts /packages/scripts

Comments

@TobiasBg
Copy link
Contributor

TobiasBg commented Sep 7, 2021

Description

I'm trying to use @wordpress/scripts for my plugin's JS code.
Calling wp-scripts format src/index.js results in warning like

[warn] Ignored unknown option { parenSpacing: true }.
src/index.js 57ms

and spaces after/before parentheses are removed, contrary to WP Coding Standards.

Step-by-step reproduction instructions

  1. In some project, run npm install @wordpress/scripts --save-dev.
  2. Run wp-scripts format src/index.js (with src/index.js being a JS file).
  3. A warning [warn] Ignored unknown option { parenSpacing: true }. is shown, and spaces are wrong.

Screenshots, screen recording, code snippet

No response

Environment info

node v16.8.0
npm 7.21.0
@wordpress/scripts 18.0.0

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@TobiasBg
Copy link
Contributor Author

TobiasBg commented Sep 7, 2021

Ok, after some research, I found that
npm install "prettier@npm:wp-prettier@latest" --save-dev
is necessary in the project folder.
For some reason the declared dependency to this in the package.jsons of @wordpress/scripts and @wordpress/eslint-plugin is not sufficient?

@gziolo gziolo added [Tool] WP Scripts /packages/scripts [Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed labels Sep 10, 2021
@gziolo
Copy link
Member

gziolo commented Sep 10, 2021

It looks like it's exactly the same issue as reported in #21872. It's just the context is different. { parenSpacing: true } is a custom config from the Prettier's fork we use to follow WordPress coding standards.

The best way to move forward is to stop using the fork and use what the official Prettier has to offer. This is where it is heading, we just need to go through the formal standard of changing coding conventions.

Let's close this issue as a duplicate of #21872. Thank you for reporting back your findings and documentation of all the issues you had. It's a good reminder why using an npm alias doesn't scale well 👍🏻

@TobiasBg
Copy link
Contributor Author

Thanks for finding the duplicate, @gziolo! Indeed, this seems to be the same underlying issue. Too bad that a custom fork of Prettier is needed. However, changing the WP JS coding standards doesn't sound too intriguiing either, as it would quite differ much from the WP PHP coding standards. But that's not for this thread :-)

@gziolo
Copy link
Member

gziolo commented Sep 10, 2021

changing the WP JS coding standards doesn't sound too intriguiing either

Couldn't agree more 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Duplicate Used to indicate that a current issue matches an existing one and can be closed [Tool] WP Scripts /packages/scripts
Projects
None yet
Development

No branches or pull requests

2 participants