standard / eslint-config-standard-jsx

ESLint Shareable Config for JSX support in JavaScript Standard Style
http://standardjs.com
MIT License
102 stars 28 forks source link

Ambiguous script in usage guidelines #20

Closed ghost closed 7 years ago

ghost commented 7 years ago

https://github.com/feross/eslint-config-standard-jsx#usage

Here's how to install everything you need:

npm install --save-dev eslint-config-standard eslint-config-standard-jsx eslint-plugin-promise eslint-plugin-react eslint-plugin-standard

What does that even mean? It makes me feel like I should just grab stuff and run it without fully understanding it.

feross commented 7 years ago

Sorry that this isn't very clear. This package is intended for experienced ESLint users, so the docs don't go into very much detail.

Basically, you're creating an ESLint config file that references two configurations:

{
  "extends": ["standard", "standard-jsx"]
}

Those are shorthands for eslint-config-standard and eslint-config-standard-jsx. The first provides most of the rules that make up standard, and the second provides a few additional JSX-specific rules. They're split up so users who don't use JSX can omit the latter.

These configuration files reference rules that are part of ESLint itself, as well as rules that didn't make it into ESLint core, but that are still really useful to have. These rules live in third-party plugins. You can see a few of these rules here, for example.

eslint-config-standard uses several plugins:

eslint-config-standard-jsx uses only one:

I know that's a lot of things to install, but unfortunately, that's how ESLint shareable configs work. It would be great if we could include the above plugins as dependencies of the shareable configs since they really are an implementation detail, IMO. But unfortunately, the ESLint team was against this idea. Full issue with context here: https://github.com/eslint/eslint/issues/3458 Maybe this will happen in a future version and we can simplify the install instructions.

feross commented 7 years ago

In the future, I expect to deprecate this package (eslint-config-standard-jsx) and just put the JSX rules into the main eslint-config-standard file, so there's only one config to install to get the complete standard rule-set.

The main reason that we split these JSX rules out was because it felt weird to have everyone install eslint-plugin-react when they didn't necessarily even use React. We don't actually enforce any rules that are React-specific, but the plugin name implies otherwise. We thought this was less confusing.

However, we now bundle several plugins for Node, import, promises, etc. in the main config and not all users necessarily use Node, import statements, or promises. So, that bridge has already been crossed and there's not much reason for this package to continue to exist.

rstacruz commented 7 years ago

<aside> would it be easier to understand if we formatted it this way?

npm install --save-dev \
  eslint-config-standard \
  eslint-config-standard-jsx \
  eslint-plugin-promise \
  eslint-plugin-react \
  eslint-plugin-standard
feross commented 7 years ago

@rstacruz Yeah, I think so :)

prateekrastogi commented 7 years ago

@feross Any further progress in the plan to include it in standard package for having a singular style for both client and backend.