Sha256: 83db7a2e4ee435b837f145af9f1c98d4e7b56ba51ddf0b790fe182df155fd4b4

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

module SCSSLint
  class Linter::UsageName < Linter
    include LinterRegistry

    def visit_extend(node)
      add_lint(node) if selector_has_bad_placeholder?(node.selector)
    end

    def visit_mixin(node)
      check(node)
      yield # Continue into content block of this mixin's block
    end

    def visit_script_funcall(node)
      check(node) unless FUNCTION_WHITELIST.include?(node.name)
    end

    def visit_script_variable(node)
      check(node)
    end

    def description
      'Usages of variables, functions, mixins, and placeholders should be ' <<
      'lowercase and use hyphens instead of underscores.'
    end

  private

    FUNCTION_WHITELIST = %w[
      rotateX rotateY rotateZ
      scaleX scaleY scaleZ
      skewX skewY
      translateX translateY translateZ
    ].to_set

    def check(node)
      add_lint(node) if node_has_bad_name?(node)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.9.0 lib/scss_lint/linter/usage_name.rb