-
Notifications
You must be signed in to change notification settings - Fork 6
Add a lint rule for unnecessary parentheses in conditionals #15
Comments
I could tackle this in the future, but for now I just need help getting the project running. 🤷♂️ |
Hi @nex3 , this one is pretty tricky, as |
That's possible, but it would add a lot of boilerplate to the parsing code. Could you use something like |
The parens are actually not included in the expression's span either. Here's a little debug print:
Since nested parethesized expressions also don't include their parens, I can't do some hack where I just subtract one from the leftmost character or something. I ran into this when I was writing the formatter as well. |
Oh, that's not good. I've filed sass/dart-sass#503 to fix it, which should also make detecting parens much easier. |
@mik01aj Want to tackle this one? I've got the project fixed up for Dart 2. This should be a fairly straight-forward rule; the existing ones would make fine examples, like use_falsey_null. |
Sorry for the late reply - only now I had the time to setup the project, learn some Dart basics, and make a PR (#30). Please have a look :) |
Sometimes users who are familiar with other languages forget that Sass doesn't need parentheses around its conditionals (as in,
@if (...) {
, or@else if (...) {
, or@while (...) {
). The linter should suggest that these parentheses be removed.The text was updated successfully, but these errors were encountered: