lib/scss_lint/linter/string_quotes.rb in scss-lint-0.27.0 vs lib/scss_lint/linter/string_quotes.rb in scss-lint-0.28.0
- old
+ new
@@ -1,9 +1,20 @@
module SCSSLint
# Checks the type of quotes used in string literals.
class Linter::StringQuotes < Linter
include LinterRegistry
+ def visit_script_stringinterpolation(node)
+ # We can't statically determine what the resultant string looks like when
+ # string interpolation is used, e.g. "one #{$var} three" could be a very
+ # different string depending on $var = `'" + "'` or $var = `two`.
+ #
+ # Thus we manually skip the substrings in the string interpolation and
+ # visit the expressions in the interpolation itself.
+ node.children.reject { |child| child.is_a?(Sass::Script::Tree::Literal) }
+ .each { |child| visit(child) }
+ end
+
def visit_script_string(node)
check_quotes(node, source_from_range(node.source_range))
end
def visit_import(node)