After reading the docs for EsLint, I'm using the rule curly set to warning for multiple or nested rows of statements at conditionals.
"rules": {
"curly":["warn", "multi-or-nest"],
"quotes":"warn"
}
It works as expected but when the code is to my satisfaction, Prettier gives me an error suggesting that the statement after the conditional should be put on a single line, which isn't what I want (nor do I want to use the unnecessary curlies).
// Preferred style
if(condition)
doSomething();
if(condition) {
doSomething();
doSomethingElse();
}
// Prettier style
if(condition) doSomeSome();
if(condition) {
doSomething();
doSomethingElse();
}
I've checked the docs for Prettier but the closest thing to what I look for is bracketSpacing, which isn't what I want at all. There's nothing else about multiline bracketting as far I could see.
How can I make Prettier behave to my liking? (Secondary question: where can I find more info about other rules, except in the official docs?)
NB. A somewhat similar question asked a while ago got no answers and the comments suggested the poster to accept the way Prettier wants it to be (i.e. enforcing superfluous curlies). It seems wrong to me that the computer tells me what to like instead of me telling it my an some_rc.json file.
I also found a lengthy discussion proving that there's been a need for such an option since 2017, so I'm inclined to assume that it's been implemented (as I find it hard to believe that the designers simply disregarded the wishes). Am I mistaken?