Skip to content

Commit

Permalink
if != null and
Browse files Browse the repository at this point in the history
  • Loading branch information
rambleraptor committed Aug 12, 2019
1 parent 3f3919a commit 0b89e0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rules/at-if-no-null/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ testRule(rule, {
@if not $x {}
}`,
description: "does not use the == null format"
},
{
code: `a {
@if $x != null and $x > 1 {}
}`,
description: "does not use the == null format"
}
],

Expand Down
5 changes: 5 additions & 0 deletions src/rules/at-if-no-null/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export default function(expectation) {
return;
}

// If rule != null and (expr), skip
if (atrule.params.match(/\(?[ \t]*.* != null and .*\)?/)) {
return;
}

if (atrule.params.match(/\(?[ \t]*.* == null[ \t]*\)?/)) {
utils.report({
message: messages.equals_null,
Expand Down

0 comments on commit 0b89e0e

Please sign in to comment.