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
New rule: at-if-no-null
#344
New rule: at-if-no-null
#344
Conversation
}`, | ||
description: "does not use the == null format" | ||
} | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There could be some more tests with calculations and other conditions inside @if
to make sure that there are no false positives/negatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nex3 any ideas on good tests or language constructs that users might be using in these if/else statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I'm looking for realistic examples, I often look through big open-source corpuses like https://github.com/angular/components/tree/master/src/material or https://github.com/carbon-design-system/carbon/tree/master/packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! I didn't know of any large Sass codebases.
I grepped through carbon-design and came across a common pattern (if $x != null and expr). I made adjustments to the rule for that pattern.
f2fd9f9
to
3f3919a
Compare
The sass/linter project had a rule to check for using
== null
or!= null
inside @if statements.This rule replicates that.