Sha256: 7e07943a0921369a4439550fc0adefc84b3f671e65c05ac75bc0bd0e58651008

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

module SCSSLint
  # Checks for explicitly transitioned properties instead of transition all.
  class Linter::TransitionAll < Linter
    include LinterRegistry

    TRANSITION_PROPERTIES = %w[
      transition
      transition-property
    ]

    def visit_prop(node)
      property = node.name.first.to_s
      return unless TRANSITION_PROPERTIES.include?(property)

      check_transition(node, property, node.value.to_sass)
    end

  private

    def check_transition(node, property, value)
      return unless offset = value =~ /\ball\b/

      pos = node.value_source_range.start_pos.after(value[0, offset])

      add_lint(Location.new(pos.line, pos.offset, 3),
               "#{property} should contain explicit properties " \
                'instead of using the keyword all')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scss_lint-0.43.2 lib/scss_lint/linter/transition_all.rb
scss_lint-0.43.1 lib/scss_lint/linter/transition_all.rb
scss_lint-0.43.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.42.2 lib/scss_lint/linter/transition_all.rb
scss_lint-0.42.1 lib/scss_lint/linter/transition_all.rb
scss_lint-0.42.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.41.0 lib/scss_lint/linter/transition_all.rb