gems.scss-lint-0.34.0.lib.scss_lint.linter.placeholder_in_extend.rb Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sass-maven-plugin Show documentation
Show all versions of sass-maven-plugin Show documentation
A Maven Plugin that compiles Sass files.
module SCSSLint
# Checks that `@extend` is always used with a placeholder selector.
class Linter::PlaceholderInExtend < Linter
include LinterRegistry
def visit_extend(node)
# Ignore if it cannot be statically determined that this selector is a
# placeholder since its prefix is dynamically generated
return if node.selector.first.is_a?(Sass::Script::Tree::Node)
# The array returned by the parser is a bit awkward in that it splits on
# every word boundary (so %placeholder becomes ['%', 'placeholder']).
selector = node.selector.join
# Ignore if this is a placeholder
return if selector.start_with?('%')
add_lint(node, 'Prefer using placeholder selectors (e.g. ' \
'%some-placeholder) with @extend')
end
end
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy