Sha256: 30dcfeda61d3b4ff7a5a9a2b0ed19669e6bac25a07f8dee6a06f64c0283b9743

Contents?: true

Size: 632 Bytes

Versions: 4

Compression:

Stored size: 632 Bytes

Contents

module SCSSLint
  class Linter::DuplicateProperty < Linter
    include LinterRegistry

    def visit_rule(node)
      properties = node.children
                       .select { |child| child.is_a?(Sass::Tree::PropNode) }
                       .reject { |prop| prop.name.any? { |item| item.is_a?(Sass::Script::Node) } }

      prop_names = {}

      properties.each do |prop|
        name = prop.name.join

        if existing_prop = prop_names[name]
          add_lint(prop, "Property '#{name}' already defined on line #{existing_prop.line}")
        else
          prop_names[name] = prop
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scss-lint-0.13.0 lib/scss_lint/linter/duplicate_property.rb
scss-lint-0.12.1 lib/scss_lint/linter/duplicate_property.rb
scss-lint-0.12.0 lib/scss_lint/linter/duplicate_property.rb
scss-lint-0.11.1 lib/scss_lint/linter/duplicate_property.rb