Sha256: 73e4a050da913edd37fa671adea26eeaf389c63eaeb802fa57a61af45498ac23

Contents?: true

Size: 727 Bytes

Versions: 25

Compression:

Stored size: 727 Bytes

Contents

module SCSSLint
  # Checks for spaces following the name of a property and before the colon
  # separating the property's name from its value.
  class Linter::SpaceAfterPropertyName < Linter
    include LinterRegistry

    def visit_prop(node)
      offset = property_name_colon_offset(node)
      return unless character_at(node.name_source_range.start_pos, offset - 1) == ' '
      add_lint node, 'Property name should be immediately followed by a colon'
    end

  private

    # Deals with a weird Sass bug where the name_source_range of a PropNode does
    # not start at the beginning of the property name.
    def property_name_colon_offset(node)
      offset_to(node.name_source_range.start_pos, ':')
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
scss_lint-0.60.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.59.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.58.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.57.1 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.57.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.56.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.55.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.54.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.53.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.52.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.51.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.50.3 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.50.2 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.50.1 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.50.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.49.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.48.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.47.1 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.47.0 lib/scss_lint/linter/space_after_property_name.rb
scss_lint-0.46.0 lib/scss_lint/linter/space_after_property_name.rb