Closed lunelson closed 5 years ago
They have different meanings. Here’s what plugin:prettier/recommended
looks like:
recommended: {
extends: ['prettier'],
plugins: ['prettier'],
rules: {
'prettier/prettier': 'error'
}
Do you have any specific suggestions on how this could be clarified?
See also https://prettier.io/docs/en/next/integrating-with-linters.html#eslint
Well, after cross-referencing these READMEs multiple times I must say I find the recommended
config option is itself the problem. The eslint-plugin-prettier
README says to do the following:
{
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
...and then says in order to integrate eslint-config-prettier
you install it and then ADD the following:
{
"extends": ["plugin:prettier/recommended"]
}
But that single line actually replaces the previous configurations, because it's equivalent to this:
{
"extends": ["prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
...which is stated, but IMO not easily understood because the user is told to ADD the plugin:prettier/recommended
line, not to REPLACE the previous config with it.
What would be simpler, more explicit and easier to follow is simply tell the user to install eslint-config-prettier
and add the following line to the configuration they've already written:
{
"extends": ["prettier"]
}
...which has the benefit of also agreeing with the README of the eslint-config-prettier
package.
I honestly think you should deprecate plugin:prettier/recommended
config. It is well-intended but it obscures more than it helps. Moreover, a plugin exporting a config which just re-adds that same plugin is IMO an anti-pattern. If it added a complex list of obscure dependencies in a specific order it might be worthwhile but here the full explicit config is actually easier to read and understand than the "recommended" convenience option.
Thanks. Feel free to open an issue over at the eslint-plugin-prettier repo.
In this repo's README it is stated that the
"extends"
rule should list"prettier"
, but in the README for eslint-plugin-prettier it states that when using this config the"extends"
rule should list"plugin:prettier/recommended"
. Which one of the following is correct, or do they have different meanings? The READMEs of one or both of these packages should be updated.eslint-plugin-prettier + eslint-config-prettier
eslint-config-prettier