eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

Docs: Documentation should be more verbose about the recommended config

Open dca123 opened this issue 3 years ago • 10 comments

Hi,

I was trying to figure why a certain rule wasn't working even though I had enabled plugin:import/recommended. I eventually realised that the recommended config actually doesn't enable that rule. I think it would be super useful to have as https://typescript-eslint.io/rules/ or https://eslint.org/docs/latest/rules/

If there isn't already work in progress about this topic, I would like to implement it ! I was hoping to get some initial feedback / ideas from the maintainers before I get started.

Cheers, Dev

dca123 avatar Jul 31 '22 07:07 dca123

This would be fine if it autogenerated the list using markdown magic; however, people really shouldn’t be using the recommended config - the Airbnb config has the best default config for this plugin.

ljharb avatar Jul 31 '22 09:07 ljharb

the Airbnb config has the best default config for this plugin

Airbnb config seems not using TypeScript.

JounQin avatar Jul 31 '22 10:07 JounQin

however, people really shouldn’t be using the recommended config - the Airbnb config has the best default config for this plugin.

Could you expound a bit on this please ? Should i be using the airbnb config instead ? Would it be ok, if we used only the import config from airbnb ?

dca123 avatar Jul 31 '22 10:07 dca123

Yes, you should start with the Airbnb config and modify on top of it, including with TS stuff.

@jounqin neither is this plugin’s recommended config.

ljharb avatar Jul 31 '22 10:07 ljharb

The airbnb import is indeed way more extensive. I'm relatively new to configuring eslint in depth, so would it make sense to do somthing like extends: [ ..., "airbnb-base:imports"]. If this works, I think it we should mention in the docs that this package works well with airbnb, discourage the use of recommended & maybe create a link to that file ?

I'm also open to the idea of using markdown magic to showcase what errors are enabled in which configs too.

dca123 avatar Jul 31 '22 10:07 dca123

Not everyone uses Airbnb's config.

JounQin avatar Jul 31 '22 10:07 JounQin

I think both is probably a good idea.

(In practice it turns out to be a very bad idea for plugins to also provide configs, because of semver constraints)

ljharb avatar Jul 31 '22 10:07 ljharb

@JounQin while that’s true, that’s not the same thing as saying they shouldn’t be.

ljharb avatar Jul 31 '22 11:07 ljharb

I think i agree with @ljharb here. While not everyone uses airbnb's config (me included), it appears to me that this plugin was built as a part of the airbnb linting (I might be wrong here lol).

Having looked at the airbnb config, it seems like the current recommended barely utilizes the power of this awesome plugin. To make this plugin easier to digest for newer users, I would have found it beneficial if there was a small table that explained what each of these configs did. So I will start there, and work up from there !

@ljharb I would like to understand why

In practice it turns out to be a very bad idea for plugins to also provide configs, because of semver constraints

If this all sounds good, could you assign the issue to me ?

dca123 avatar Jul 31 '22 11:07 dca123

The reason the recommended config isn’t useful anymore is because adding anything to it would be a semver-major change.

You’re welcome to submit a PR; issue assignment isn’t significant :-)

ljharb avatar Jul 31 '22 18:07 ljharb