lib/scss_lint/linter/property_spelling.rb in scss-lint-0.15.0 vs lib/scss_lint/linter/property_spelling.rb in scss-lint-0.16.0
- old
+ new
@@ -1,280 +1,32 @@
module SCSSLint
# Checks for misspelled properties.
class Linter::PropertySpelling < Linter
include LinterRegistry
+ def visit_root(node)
+ @extra_properties = config['extra_properties'].to_set
+ yield # Continue linting children
+ end
+
def visit_prop(node)
# Ignore properties with interpolation
return if node.name.count > 1 || !node.name.first.is_a?(String)
name = node.name.join
# Ignore vendor-prefixed properties
return if name.start_with?('-')
- unless KNOWN_PROPERTIES.include?(name)
+ unless KNOWN_PROPERTIES.include?(name) || @extra_properties.include?(name)
add_lint(node, "Unknown property #{name}")
end
end
private
- KNOWN_PROPERTIES = %w[
- @keyframes
- alignment-adjust
- alignment-baseline
- animation
- animation-delay
- animation-direction
- animation-duration
- animation-fill-mode
- animation-iteration-count
- animation-name
- animation-play-state
- animation-timing-function
- appearance
- backface-visibility
- background
- background-attachment
- background-clip
- background-color
- background-image
- background-origin
- background-position
- background-repeat
- background-size
- baseline-shift
- bookmark-label
- bookmark-level
- bookmark-target
- border
- border-bottom
- border-bottom-color
- border-bottom-left-radius
- border-bottom-right-radius
- border-bottom-style
- border-bottom-width
- border-collapse
- border-color
- border-image
- border-image-outset
- border-image-repeat
- border-image-slice
- border-image-source
- border-image-width
- border-left
- border-left-color
- border-left-style
- border-left-width
- border-radius
- border-right
- border-right-color
- border-right-style
- border-right-width
- border-spacing
- border-style
- border-top
- border-top-color
- border-top-left-radius
- border-top-right-radius
- border-top-style
- border-top-width
- border-width
- bottom
- box-align
- box-decoration-break
- box-direction
- box-flex
- box-flex-group
- box-lines
- box-ordinal-group
- box-orient
- box-pack
- box-shadow
- box-sizing
- caption-side
- clear
- clip
- color
- color-profile
- column-count
- column-fill
- column-gap
- column-rule
- column-rule-color
- column-rule-style
- column-rule-width
- column-span
- column-width
- columns
- content
- counter-increment
- counter-reset
- crop
- cursor
- direction
- display
- dominant-baseline
- drop-initial-after-adjust
- drop-initial-after-align
- drop-initial-before-adjust
- drop-initial-before-align
- drop-initial-size
- drop-initial-value
- empty-cells
- fill
- filter
- fit
- fit-position
- float
- float-offset
- font
- font-family
- font-size
- font-size-adjust
- font-stretch
- font-style
- font-variant
- font-weight
- grid-columns
- grid-rows
- hanging-punctuation
- height
- hyphenate-after
- hyphenate-before
- hyphenate-character
- hyphenate-lines
- hyphenate-resource
- hyphens
- icon
- image-orientation
- image-resolution
- inline-box-align
- left
- letter-spacing
- line-height
- line-stacking
- line-stacking-ruby
- line-stacking-shift
- line-stacking-strategy
- list-style
- list-style-image
- list-style-position
- list-style-type
- margin
- margin-bottom
- margin-left
- margin-right
- margin-top
- mark
- mark-after
- mark-before
- marks
- marquee-direction
- marquee-play-count
- marquee-speed
- marquee-style
- max-height
- max-width
- min-height
- min-width
- move-to
- nav-down
- nav-index
- nav-left
- nav-right
- nav-up
- opacity
- orphans
- outline
- outline-color
- outline-offset
- outline-style
- outline-width
- overflow
- overflow-style
- overflow-x
- overflow-y
- padding
- padding-bottom
- padding-left
- padding-right
- padding-top
- page
- page-break-after
- page-break-before
- page-break-inside
- page-policy
- perspective
- perspective-origin
- phonemes
- pointer-events
- position
- punctuation-trim
- quotes
- rendering-intent
- resize
- rest
- rest-after
- rest-before
- right
- rotation
- rotation-point
- ruby-align
- ruby-overhang
- ruby-position
- ruby-span
- shape-rendering
- size
- speak
- src
- stroke
- stroke-width
- string-set
- table-layout
- target
- target-name
- target-new
- target-position
- text-align
- text-align-last
- text-decoration
- text-height
- text-indent
- text-justify
- text-outline
- text-overflow
- text-rendering
- text-shadow
- text-transform
- text-wrap
- top
- transform
- transform-origin
- transform-style
- transition
- transition-delay
- transition-duration
- transition-property
- transition-timing-function
- unicode-bidi
- vertical-align
- visibility
- voice-balance
- voice-duration
- voice-pitch
- voice-pitch-range
- voice-rate
- voice-stress
- voice-volume
- white-space
- widows
- width
- word-break
- word-spacing
- word-wrap
- z-index
- zoom
- ]
+ KNOWN_PROPERTIES = File.open(File.join(SCSS_LINT_DATA, 'properties.txt'))
+ .read
+ .split
+ .to_set
end
end