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

ESLint plugin: Use the default WordPress Prettier config when no config found #20509

Closed
marekdedic opened this issue Feb 27, 2020 · 9 comments · Fixed by #21602
Closed

ESLint plugin: Use the default WordPress Prettier config when no config found #20509

marekdedic opened this issue Feb 27, 2020 · 9 comments · Fixed by #21602
Assignees
Labels
[Status] In Progress Tracking issues with work in progress [Tool] ESLint plugin /packages/eslint-plugin [Type] Bug An existing feature does not function as intended

Comments

@marekdedic
Copy link
Contributor

Describe the bug
Hi, I have recently upgraded @wordpress/eslint-plugin to version 4.0.0. After the update, eslint is telling me to remove spaces from inside parens, and replace ' with ". AFAIK this goes against WPC. I tried raising the issue at Automattic/wp-prettier#16 since I thought this was an issue with wp-prettier. From what I've been told, it's just that prettier isn't configured correctly for WPCS.

I haven't been using prettier before, so I would consider this a bug - using eslint-plugin, I would expect to get either no "stylistic" linting or linting in accordance with WPCS.

To reproduce
Steps to reproduce the behavior:
The exact build environment and result can be seen at https://circleci.com/gh/skaut/skaut-google-drive-gallery/3579

Expected behavior
I would expect to get either no "stylistic" linting or linting in accordance with WPCS.

Desktop (please complete the following information):

  • OS: Debian testing

Additional context

@gziolo
Copy link
Member

gziolo commented Feb 28, 2020

Have you tried to follow my comment in your project: skaut/skaut-google-drive-gallery#391 (comment)?

@marekdedic
Copy link
Contributor Author

Hi,
thanks, I noticed it on the phone, will try and report.

@swissspidy swissspidy added the [Tool] ESLint plugin /packages/eslint-plugin label Feb 29, 2020
@gziolo gziolo added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Mar 2, 2020
@gziolo
Copy link
Member

gziolo commented Mar 2, 2020

It seems like everything works as intended. It was an issue with configuration, the full discussion can be found in skaut/skaut-google-drive-gallery#391.

@gziolo gziolo closed this as completed Mar 2, 2020
@marekdedic
Copy link
Contributor Author

Hi,
well, if eslint-plugin isn't configuring prettier to lint according to WPCS, why is it using it in the first place?

I understand the current state as "We don't care how you style your code, but you have to use prettier to do it and configure it yourself" - if that isn't a misunderstanding on my part, I don't get why the plugin would do that? I would like it to either give me a style that is according to WPCS or not lint style at all and leave it up to me....

@gziolo
Copy link
Member

gziolo commented Mar 2, 2020

@marekdedic, I see your point. I'm sure we can add a fallback to use the default WordPress Prettier config once #20026 is in place. @ntwb, any plans to finish your PR or should I take it over?

In fact, when you use @wordpress/scripts, it's all handled properly. See:

if ( ! hasPrettierConfig() ) {
eslintConfig.rules = {
'prettier/prettier': [
'error',
defaultPrettierConfig,
{
usePrettierrc: false,
},
],
};
}

@gziolo gziolo reopened this Mar 2, 2020
@gziolo gziolo changed the title [eslint-plugin] Lint is not according to WPCS [eslint-plugin] Use the default WordPress Prettier config when no config found Mar 2, 2020
@gziolo gziolo added [Type] Bug An existing feature does not function as intended and removed [Type] Help Request Help with setup, implementation, or "How do I?" questions. labels Mar 2, 2020
@gziolo gziolo changed the title [eslint-plugin] Use the default WordPress Prettier config when no config found ESLint plugin: Use the default WordPress Prettier config when no config found Mar 2, 2020
@marekdedic
Copy link
Contributor Author

Hi,
yeah, that seems like a great idea 👍 That way, we get WPCS by default, with an option to change it if one desires to.

Thanks

@gziolo gziolo added the Needs Dev Ready for, and needs developer efforts label Mar 8, 2020
@gziolo
Copy link
Member

gziolo commented Mar 31, 2020

Noting that #20026 was merged so we have @wordpress/prettier-config that can be conditionally integrated with ESLint plugin.

@gziolo
Copy link
Member

gziolo commented Apr 9, 2020

#21503 tries to fix the issue.

@gziolo gziolo self-assigned this Apr 9, 2020
@gziolo gziolo added [Status] In Progress Tracking issues with work in progress and removed Needs Dev Ready for, and needs developer efforts labels Apr 9, 2020
@gziolo
Copy link
Member

gziolo commented Apr 15, 2020

#21503 tries to fix the issue.

#21602 is another try :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] In Progress Tracking issues with work in progress [Tool] ESLint plugin /packages/eslint-plugin [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants