Sha256: b301d6cd953061e1a26875d8742e0329799c2bdcd6dbcd26f7c9615f6a29b198

Contents?: true

Size: 546 Bytes

Versions: 2

Compression:

Stored size: 546 Bytes

Contents

module SlimLint
  # Checks for unnecessary uses of the `div` tag where a class name or ID
  # already implies a div.
  class Linter::RedundantDiv < Linter
    include LinterRegistry

    MESSAGE = '`div` is redundant when %s attribute shortcut is present'

    on [:html, :tag, 'div', [:html, :attrs, [:html, :attr, 'class', [:static]]]] do |sexp|
      report_lint(sexp, MESSAGE % 'class')
    end

    on [:html, :tag, 'div', [:html, :attrs, [:html, :attr, 'id', [:static]]]] do |sexp|
      report_lint(sexp, MESSAGE % 'id')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slim_lint-0.2.0 lib/slim_lint/linter/redundant_div.rb
slim_lint-0.1.0 lib/slim_lint/linter/redundant_div.rb