Sha256: d6b2154a88a56e329faf538169dde0a807d76e464360c51ad094b79ed623fe2c
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
module SCSSLint # Checks for identical root selectors. class Linter::DuplicateRoot < Linter include LinterRegistry def visit_root(node) # Root rules are evaluated per document, so use new hashes for eash file @roots = {} yield # Continue linting children end def visit_rule(node) if @roots[node.rule] add_lint node.line, "Merge root rule `#{node.rule.join}` with identical " \ "rule on line #{@roots[node.rule].line}" else @roots[node.rule] = node end # Don't yield so we only check one level deep end # Define stubs so we don't check rules nested in other constructs %w[ media mixin mixindef ].each do |node_type| define_method("visit_#{node_type}") { |*args| } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.23.0 | lib/scss_lint/linter/duplicate_root.rb |