Sha256: 7c6f5dcea0eb77b6561b99ed5ab4898b1c79892de94f29d6fe355f757f3fb865

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

module SCSSLint
  class Linter::ZeroUnit < Linter
    include LinterRegistry

    def visit_script_string(node)
      node.value.scan(/\b(0[a-z]+)\b/i) do |match|
        add_lint(node, MESSAGE_FORMAT % match.first)
      end
    end

    def visit_script_number(node)
      if node.value == 0 && !node.unitless?
        add_lint(node, MESSAGE_FORMAT % node.original_string)
      end
    end

  private

    MESSAGE_FORMAT = '`%s` should be written without units as `0`'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.11.1 lib/scss_lint/linter/zero_unit.rb