Closed satazor closed 4 years ago
Probably also related: we should lax newline-per-chained-call
, which is has a max depth of just 2
.
Agreed 👌
Would also do it for SwitchCase
, but maybe that's less standard.
Please do, the newline-per-chained-call
is a pain in the *** as it is at the moment and it becomes strange when you have just 3 calls for example because one will be going to the next line. Either we define it as 1 and it all goes in a new line or we make it bigger
Yep, not only it becomes more readable but also seems more inline with what we are used to do and what our current rules are enforcing.
Please do, the newline-per-chained-call is a pain in the *** as it is at the moment and it becomes strange when you have just 3 calls for example because one will be going to the next line. Either we define it as 1 and it all goes in a new line or we make it bigger
Yeah, I must admit the above is quite annoying in my opinion...
Please do, the newline-per-chained-call is a pain in the *** as it is at the moment and it becomes strange when you have just 3 calls for example because one will be going to the next line. Either we define it as 1 and it all goes in a new line or we make it bigger
@ruipneves but you can put all of them inline still right? (https://eslint.org/docs/rules/newline-per-chained-call) Or you mean it sucks because the autofix puts it 2 (first lines) + 1 (next line)? Do agree that max depth of 2 is weird - only one or everything in each new line sounds better @ruipneves 👌
It sucks because of the new line 😛
array.filter().map()
.filter()
@ruipneves yeah, what I mean is you can still put them in each line right?
array
.filter()
.map()
.filter()
this would be valid right? (a part from indentation)
Yes, at the moment that is valid as well. The real problem is when you want everything in a one liner having 3 calls
Wouldn't prettier solve all the formatting issues and simplify the config. Feel free to ignore me as I'm not very familiar with the repo.
@hugomrdias Prettier does have have an overlap with eslint in regards to formatting, especially now that eslint has autofix. Still, eslint does much more than just formatting, which is *linting.* As an example, it detects errors based on static analysis that prettier doesn't do.
@ritazoliveira do you want to take on this? So overall, we need to:
indent
(SwitchCase
and MemberExpression
) and update testsnewline-per-chained-call
into a larger depth or completely disable itThis is a breaking change, so the commits should reflect that. It might be worth making these as separate PRs.
@satazor yes I know all that, just saying leave the formatting to prettier and linting to eslint. This setup is pretty standard even with styles (prettier/style lint).
I'm not familiar with prettier, but if eslint does as much as prettier and even more, what would be the point to maintain a prettier config as well?
Both PR's are now open for review.
Addressed by #83 and #82
Currently, our indentation is 4 spaces, with a few exceptions:
Re-evaluate these exceptions to see if we can remove them. As an example, because we are forcing
MemberExpression
to0
, the following code becomes unreadable:which would be much more readable like so:
To circumvent the above issue, I would have to write it like so: