Sha256: 507df7fd61c15b8a86e1ba0c319a0006bc394f5be8c8f8800068a36269be0e00

Contents?: true

Size: 812 Bytes

Versions: 16

Compression:

Stored size: 812 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
    ].freeze

    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

16 entries across 16 versions & 1 rubygems

Version Path
scss_lint-0.55.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.54.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.53.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.52.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.51.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.50.3 lib/scss_lint/linter/transition_all.rb
scss_lint-0.50.2 lib/scss_lint/linter/transition_all.rb
scss_lint-0.50.1 lib/scss_lint/linter/transition_all.rb
scss_lint-0.50.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.49.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.48.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.47.1 lib/scss_lint/linter/transition_all.rb
scss_lint-0.47.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.46.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.45.0 lib/scss_lint/linter/transition_all.rb
scss_lint-0.44.0 lib/scss_lint/linter/transition_all.rb