-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
The thing just doesnt work. #214
Comments
Hi! How can I reproduce what you mean by “it still doesn't do what it is supposed to do. (Disable eslint rules that conflict with prettier ones)”? |
when I try to format a javascript file that contains a switch (one of the things eslint and prettier argue about) with prettier, eslint will spam me with indenting errors, since it wants one tab less than prettier. Eslint-config-prettier is supposed to turn off the conflicting rules, and yet it doesnt. Just try formatting this piece of code with prettier, and eslint should start spamming you with indent errors. At least that's what it did to me. switch (args[0]) {
case '1':
msg.channel.send ('test1')
break
case '2':
msg.channel.send('test2')
break
case '3':
msg.channel.send('test3')
break
case '4':
msg.channel.send('test4')
break
} (for context this is code from a discord.js bot command) |
It doesn’t for me.
|
So the CLI helper tool shows that you have three conflicting rules. Remove those and all should be good! Remember:
(Regarding minimal repro repo: That’s something open source maintainers often ask for. It means creating a new repo, without all the things one cannot share, and without all the irrelevant things so that maintainers don’t need to spend time on figuring out where to look.) |
wait so.. the entire eslint-config-prettier plugin is just the CLI helper tool? Isn't it supposed to automatically disable the rules for you? Like, why do you add 'prettier' to the extends if you're going to do the work manually anyways? |
No, that’s not what I meant. You add 'prettier' to the extends so that it can win over other configs. However, ESLint doesn’t let configs win over you. (Imagine if you couldn’t override rules set by a config!) So there’s a little CLI tool on the side for helping with finding mistakes in your config. |
oh I see, but what I'm trying to say is that if i disable indent, semicolons, and linebreak in prettier then it's practically the same as not using it, as imo these are the most important features of it, along with the single quotes. |
That’s not possible. You can configure how much indent, whether you prefer semicolons or not and what linebreak to use, but you can’t disable those things in Prettier. What you should do is remove indent, semicolon and linebreak rules from ESLint and let Prettier take care of those things. |
oh ok, that clarifies things. But I have to do it manually, it cant auto-disable eslint rules that conflict, right? |
Correct – the CLI helper tool only lists the problematic rules but does not attempt to automatically update your config file (because that’s near impossible to do in general). |
the thing is, many of these are incorrect. For example, ESlint never has a problem with the way prettier uses semicolons. |
The description of this package is:
So it’s not only about conflicts. It’s a waste of time (it makes ESLint slower) to check things like semicolons twice. |
hmm I see. So as you said it suggests me rules that I should turn off because of conflict, and I disable whichever ones I want. Got it |
I installed this using
npm install --save-dev eslint-config-prettier
as the instructions said, then added 'prettier' to extends in my.eslintrc.js
and put it last,but it still doesn't do what it is supposed to do. (Disable eslint rules that conflict with prettier ones). You can see that it recognizes the plugin as installed since it doesnt redline
'prettier'
, but it seems to not do anything. The installation process is 2 steps, I don't think I've fucked it up.The text was updated successfully, but these errors were encountered: