Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.77 KB

operator-no-newline-after.md

File metadata and controls

62 lines (45 loc) · 1.77 KB

Pattern: Use of newline after Sass operator

Issue: -

Description

Disallow newlines after Sass operators.

a { width: 10px + $n; }
/**             ↑
 * newline after this */

This rule checks math operators (+, -, /, *, %) and comparison operators (>, <, !=, ==, >=, <=).

Not all symbols that correspond to math operators are actually considered operators by Sass. Some of the exceptions are:

For more details refer to Sass official documentation. An online Sass compiler - Sassmeister - could also come in handy.

The following patterns are considered warnings:

a { width: 10 +
1; }
a {
  width: 10 +
    1;
}

The following patterns are not considered warnings:

a {
  width: str- // not a math operator, ignored
    some;
}
a { width: 10px     -    1; }
a {
  width: 10px * 1.7 // the newline is not right after the operator
    + 1;
}

Further Reading