-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
If eslint can auto fix/format code why to use Prettier? #101
Comments
Take this code and format it with eslint alone, then format it with prettier: foo(reallyLongArg(), omgSoManyParameters(), IShouldRefactorThis(), isThereSeriouslyAnotherOne(), noWayYouGottaBeKiddingMe()); ESLint will just give you a warning that it's too wide (depending on your foo(
reallyLongArg(),
omgSoManyParameters(),
IShouldRefactorThis(),
isThereSeriouslyAnotherOne(),
noWayYouGottaBeKiddingMe()
); That's just one of many instances where prettier is a more powerful formatter than eslint. But there are some things that eslint can do that prettier can't, so I built this to combine them :) I hope that helps. |
Ok but then What does Prettier-ESlint do which people can't achieve by installing and setup Prettier and ESLint separately? |
|
After the fork and all the possible solutions ... I'm confused... I'm trying to install this for Atom what packages I need in order to get the ESlint like red warnings, etc in Atom,?
|
@kentcdodds Thanks for giving this example! Do you have some more precise examples where Prettier is superior to ESLint? There is a discussion to use Prettier within the Bootstrap project and we are looking for pros and cons: twbs/bootstrap#24323 |
I suggest you try it on a less important project for a day and you'll be hooked. It's hard to explain, easy to try. |
@kentcdodds I have been using it in a smaller project of mine and I got quite unhappy with it (prettier/prettier#2716 (comment)). That's why I am looking for facts why Prettier is better than ESLint (or should be combined with ESLint) because maybe I am seeing it from the wrong perspective. |
tbh, I don't see prettier being better than eslint. I use both in my projects. That's why I'm using this package. Format my code with |
@zimme Thanks for giving your input! 😃 Running Prettier in the first place and overriding it's configuration with ESLint sounds like a very good compromise. Do you have a public example on GitHub where you do it? I would like to override Prettier's breakup of 3 or more chained calls. For this purpose I am using prettier-eslint-cli, but it fails telling me:
|
@bennyn Weird, I've never run into that problem actually. Anyhow, I'm not sure that eslint has a rule with a fix that would put chained calls on a single line if it finds chained calls in multiple lines. I found this rule, https://eslint.org/docs/rules/newline-per-chained-call, which has a fix and can fix some of the errors. I do believe that eslint --fix could fix that each chained call always gets it's own line, but not the other way around. |
This is also my experience. 😢 So I need to use an older version of Prettier, where this formatting rule hasn't been included. 😁 I will move the discussion to prettier/prettier-eslint-cli#109. Thanks for your help! |
I don't believe there is anything we can do with The only thing I believe |
I want to point out that if the eslint's Some people did request this functionality but it appears to not have got much attention. eslint/eslint#12794 |
That was just one example. Prettier is definitely not only valuable of that one thing over ESLint. |
I didn't get this part
What does it mean "prettier is a more powerful automatic formatter" ?
The text was updated successfully, but these errors were encountered: