prettier / eslint-config-prettier

Turns off all rules that are unnecessary or might conflict with Prettier.
MIT License
5.46k stars 255 forks source link

One config to rule them all #175

Closed lydell closed 3 years ago

lydell commented 3 years ago

Fixes #173.

This PR combines all configs into one. This means you can just add "prettier" to "extends" and it’ll disable rules from all plugins without you having to think about which you use!

I’ve wanted this behavior from the start, but thought that it wasn’t possible. Turns out I have been wrong the whole time and disabling unknown rules is perfectly fine! There’s even a test for that in ESLint:

https://github.com/eslint/eslint/blob/9d6063add931f0803cae1676d5df307baf114360/tests/lib/linter/linter.js#L1738-L1742

I also check with nzakas on Discord, and got a 👍 about doing this change.


Fixes #174.

The "prettier/prettier" config is still separate, since only eslint-plugin-prettier users need it. Doing the above change, I either had to write special case code to keep the behavior for prettier/prettier. Instead of doing that, it felt easier to write special case code for #174 instead.

The CLI helper tool now only warns about the rules specific to eslint-plugin-prettier, instead of failing with a non-zero exit code. This is similar to how other “special rules” are handled (if only special rules are found, that’s printed but not considered an error). After all, the CLI tool cannot know your decision – if you want to disable the rules because of the potential problems, or if you’d rather live with occasional errors but cleaner code.