sass / linter

An experimental Sass linter written using the Dart Sass AST
MIT License
39 stars 6 forks source link

Add a lint rule for suspicious variable interpolation #35

Open gopherkhan opened 5 years ago

gopherkhan commented 5 years ago

Add a lint rule for CSS variables defined using un-interpolated Sass variables. Recent versions of Sass require that you to use interpolation when including Sass variables to maintain maximal CSS compatibility.

$n: 255;
--color: $n, $n, $n; // LINT
$n: 255;
--color: #{$n}, #{$n}, #{$n}; // OK

See this blog post for more details: http://sass.logdown.com/posts/809572

nex3 commented 5 years ago

This could theoretically be meaningful CSS, since some JavaScript framework could parse the variable names out from the custom properties at runtime, but I think it's worth adding this lint anyway since I'm pretty sure no real JavaScript libraries do so.