require 'sass' require 'set' module SCSSLint class Linter::DuplicateSelectorLinter < Linter include LinterRegistry class << self def run(engine) lints = [] engine.tree.each do |node| if node.is_a?(Sass::Tree::RuleNode) lints << check_selector_already_used(node) end end lints.compact end def description 'Rule was declared with same selector as another--you should merge them' end private def check_selector_already_used(rule_node) #selectors_seen = Set.new puts rule_node.rule.inspect puts rule_node.resolved_rules #rule_node.children.each do |child| #selectors = child.rule.first.to_s.gsub(/\s/, '') #if selectors_seen.member?(selectors) #return create_lint(child) #else #selectors_seen.add selectors #end #end nil end end end end