scss-lint 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e0c38097da925d1dcc77a8cc9c4d90468e598abb
4
- data.tar.gz: e5e2f0352fc1e808b3ebe147c200c24727e425d0
3
+ metadata.gz: f1861dcef7f2f3be9166fd44664791979a1f1f7b
4
+ data.tar.gz: 032466f84b7ad63144ebf038d86e5b7b26455dd6
5
5
  SHA512:
6
- metadata.gz: 0e65ae3133dbdefac6e650b8561db659671280f659d050d37c5dc0704b3b592ac1d7ab8303a936ccaf0aa6fab6a02c50a2e8be254039e5cfc2caa741890cf600
7
- data.tar.gz: e7677e4fe7bbc9337884d8cc423105a08d77361d9d50369ae41c4677677cf8626e920e791592d715db56d763dca2d91292469453a61b4201dbe66c1e3be25419
6
+ metadata.gz: 522188c952f6be108b512e9b606472227e91ccaa9766c223116592d52ba18f30b91ba201cf657ba77da35575914bf16b47c25af1ddf154f72bbe6ff7b3427353
7
+ data.tar.gz: 4e13aa18990e381d7e8a7d5316975daac70dc2525d7ebdbe24d47bd64786a4f6a4d2151b1e84f2144492bb8a26850bd3318e45eeef4566d49301f0f313f12a73
@@ -43,6 +43,9 @@ linters:
43
43
  PlaceholderInExtend:
44
44
  enabled: true
45
45
 
46
+ PropertySpelling:
47
+ enabled: true
48
+
46
49
  SelectorDepth:
47
50
  enabled: true
48
51
  max_depth: 3
@@ -68,6 +71,10 @@ linters:
68
71
  SpaceBeforeBrace:
69
72
  enabled: true
70
73
 
74
+ SpaceBetweenParens:
75
+ enabled: true
76
+ spaces: 0
77
+
71
78
  TrailingSemicolonAfterPropertyValue:
72
79
  enabled: true
73
80
 
@@ -13,10 +13,25 @@ module SCSSLint
13
13
  properties.each do |prop|
14
14
  name = prop.name.join
15
15
 
16
- if existing_prop = prop_names[name]
16
+ prop_hash = name
17
+ prop_value =
18
+ case prop.value
19
+ when Sass::Script::Funcall
20
+ prop.value.name
21
+ when Sass::Script::String
22
+ prop.value.value
23
+ else
24
+ prop.value.to_s
25
+ end
26
+
27
+ prop_value.to_s.scan(/^(-[^-]+-.+)/) do |vendor_keyword|
28
+ prop_hash << vendor_keyword.first
29
+ end
30
+
31
+ if existing_prop = prop_names[prop_hash]
17
32
  add_lint(prop, "Property '#{name}' already defined on line #{existing_prop.line}")
18
33
  else
19
- prop_names[name] = prop
34
+ prop_names[prop_hash] = prop
20
35
  end
21
36
  end
22
37
  end
@@ -7,7 +7,7 @@ module SCSSLint
7
7
  id_sel = seq.members.find { |simple| simple.is_a?(Sass::Selector::Id) }
8
8
  return unless id_sel
9
9
 
10
- if seq.members.any? { |simple| !simple.is_a?(Sass::Selector::Id) }
10
+ if seq.members.any? { |simple| !simple.is_a?(Sass::Selector::Id) && !simple.is_a?(Sass::Selector::Pseudo) }
11
11
  add_lint(seq, "Selector `#{seq}` can be simplified to `#{id_sel}`, " <<
12
12
  'since IDs should be uniquely identifying')
13
13
  end
@@ -0,0 +1,280 @@
1
+ module SCSSLint
2
+ # Checks for misspelled properties.
3
+ class Linter::PropertySpelling < Linter
4
+ include LinterRegistry
5
+
6
+ def visit_prop(node)
7
+ # Ignore properties with interpolation
8
+ return if node.name.count > 1 || !node.name.first.is_a?(String)
9
+
10
+ name = node.name.join
11
+
12
+ # Ignore vendor-prefixed properties
13
+ return if name.start_with?('-')
14
+
15
+ unless KNOWN_PROPERTIES.include?(name)
16
+ add_lint(node, "Unknown property #{name}")
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ KNOWN_PROPERTIES = %w[
23
+ @keyframes
24
+ alignment-adjust
25
+ alignment-baseline
26
+ animation
27
+ animation-delay
28
+ animation-direction
29
+ animation-duration
30
+ animation-fill-mode
31
+ animation-iteration-count
32
+ animation-name
33
+ animation-play-state
34
+ animation-timing-function
35
+ appearance
36
+ backface-visibility
37
+ background
38
+ background-attachment
39
+ background-clip
40
+ background-color
41
+ background-image
42
+ background-origin
43
+ background-position
44
+ background-repeat
45
+ background-size
46
+ baseline-shift
47
+ bookmark-label
48
+ bookmark-level
49
+ bookmark-target
50
+ border
51
+ border-bottom
52
+ border-bottom-color
53
+ border-bottom-left-radius
54
+ border-bottom-right-radius
55
+ border-bottom-style
56
+ border-bottom-width
57
+ border-collapse
58
+ border-color
59
+ border-image
60
+ border-image-outset
61
+ border-image-repeat
62
+ border-image-slice
63
+ border-image-source
64
+ border-image-width
65
+ border-left
66
+ border-left-color
67
+ border-left-style
68
+ border-left-width
69
+ border-radius
70
+ border-right
71
+ border-right-color
72
+ border-right-style
73
+ border-right-width
74
+ border-spacing
75
+ border-style
76
+ border-top
77
+ border-top-color
78
+ border-top-left-radius
79
+ border-top-right-radius
80
+ border-top-style
81
+ border-top-width
82
+ border-width
83
+ bottom
84
+ box-align
85
+ box-decoration-break
86
+ box-direction
87
+ box-flex
88
+ box-flex-group
89
+ box-lines
90
+ box-ordinal-group
91
+ box-orient
92
+ box-pack
93
+ box-shadow
94
+ box-sizing
95
+ caption-side
96
+ clear
97
+ clip
98
+ color
99
+ color-profile
100
+ column-count
101
+ column-fill
102
+ column-gap
103
+ column-rule
104
+ column-rule-color
105
+ column-rule-style
106
+ column-rule-width
107
+ column-span
108
+ column-width
109
+ columns
110
+ content
111
+ counter-increment
112
+ counter-reset
113
+ crop
114
+ cursor
115
+ direction
116
+ display
117
+ dominant-baseline
118
+ drop-initial-after-adjust
119
+ drop-initial-after-align
120
+ drop-initial-before-adjust
121
+ drop-initial-before-align
122
+ drop-initial-size
123
+ drop-initial-value
124
+ empty-cells
125
+ fill
126
+ filter
127
+ fit
128
+ fit-position
129
+ float
130
+ float-offset
131
+ font
132
+ font-family
133
+ font-size
134
+ font-size-adjust
135
+ font-stretch
136
+ font-style
137
+ font-variant
138
+ font-weight
139
+ grid-columns
140
+ grid-rows
141
+ hanging-punctuation
142
+ height
143
+ hyphenate-after
144
+ hyphenate-before
145
+ hyphenate-character
146
+ hyphenate-lines
147
+ hyphenate-resource
148
+ hyphens
149
+ icon
150
+ image-orientation
151
+ image-resolution
152
+ inline-box-align
153
+ left
154
+ letter-spacing
155
+ line-height
156
+ line-stacking
157
+ line-stacking-ruby
158
+ line-stacking-shift
159
+ line-stacking-strategy
160
+ list-style
161
+ list-style-image
162
+ list-style-position
163
+ list-style-type
164
+ margin
165
+ margin-bottom
166
+ margin-left
167
+ margin-right
168
+ margin-top
169
+ mark
170
+ mark-after
171
+ mark-before
172
+ marks
173
+ marquee-direction
174
+ marquee-play-count
175
+ marquee-speed
176
+ marquee-style
177
+ max-height
178
+ max-width
179
+ min-height
180
+ min-width
181
+ move-to
182
+ nav-down
183
+ nav-index
184
+ nav-left
185
+ nav-right
186
+ nav-up
187
+ opacity
188
+ orphans
189
+ outline
190
+ outline-color
191
+ outline-offset
192
+ outline-style
193
+ outline-width
194
+ overflow
195
+ overflow-style
196
+ overflow-x
197
+ overflow-y
198
+ padding
199
+ padding-bottom
200
+ padding-left
201
+ padding-right
202
+ padding-top
203
+ page
204
+ page-break-after
205
+ page-break-before
206
+ page-break-inside
207
+ page-policy
208
+ perspective
209
+ perspective-origin
210
+ phonemes
211
+ pointer-events
212
+ position
213
+ punctuation-trim
214
+ quotes
215
+ rendering-intent
216
+ resize
217
+ rest
218
+ rest-after
219
+ rest-before
220
+ right
221
+ rotation
222
+ rotation-point
223
+ ruby-align
224
+ ruby-overhang
225
+ ruby-position
226
+ ruby-span
227
+ shape-rendering
228
+ size
229
+ speak
230
+ src
231
+ stroke
232
+ stroke-width
233
+ string-set
234
+ table-layout
235
+ target
236
+ target-name
237
+ target-new
238
+ target-position
239
+ text-align
240
+ text-align-last
241
+ text-decoration
242
+ text-height
243
+ text-indent
244
+ text-justify
245
+ text-outline
246
+ text-overflow
247
+ text-rendering
248
+ text-shadow
249
+ text-transform
250
+ text-wrap
251
+ top
252
+ transform
253
+ transform-origin
254
+ transform-style
255
+ transition
256
+ transition-delay
257
+ transition-duration
258
+ transition-property
259
+ transition-timing-function
260
+ unicode-bidi
261
+ vertical-align
262
+ visibility
263
+ voice-balance
264
+ voice-duration
265
+ voice-pitch
266
+ voice-pitch-range
267
+ voice-rate
268
+ voice-stress
269
+ voice-volume
270
+ white-space
271
+ widows
272
+ width
273
+ word-break
274
+ word-spacing
275
+ word-wrap
276
+ z-index
277
+ zoom
278
+ ]
279
+ end
280
+ end
@@ -38,7 +38,9 @@ module SCSSLint
38
38
  item.is_a?(String)
39
39
  end
40
40
 
41
- parent_selectors = simple_sequences.count { |item| item.to_s == '&' }
41
+ parent_selectors = simple_sequences.count do |item|
42
+ item.rest.any? { |i| i.is_a?(Sass::Selector::Parent) }
43
+ end
42
44
 
43
45
  # Take the number of simple sequences and subtract one for each sibling
44
46
  # combinator, as these "combine" simple sequences such that they do not
@@ -0,0 +1,26 @@
1
+ module SCSSLint
2
+ # Checks for the presence of spaces between parentheses.
3
+ class Linter::SpaceBetweenParens < Linter
4
+ include LinterRegistry
5
+
6
+ def visit_root(node)
7
+ @spaces = config['spaces']
8
+ engine.lines.each_with_index do |line, index|
9
+ line.scan /(\( *[^ ]|[^\s] *\))/ do |match|
10
+ match.each { |str| check(str, index, engine) }
11
+ end
12
+ end
13
+ end
14
+
15
+ private
16
+
17
+ def check(str, index, engine)
18
+ spaces = str.count ' '
19
+
20
+ if spaces != @spaces
21
+ @lints << Lint.new(engine.filename, index + 1, "Expected #{pluralize(@spaces, 'space')}" <<
22
+ " between parentheses instead of #{spaces}")
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.14.0'
3
+ VERSION = '0.15.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Causes Engineering
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-12 00:00:00.000000000 Z
12
+ date: 2014-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colorize
@@ -106,7 +106,9 @@ files:
106
106
  - lib/scss_lint/linter/selector_depth.rb
107
107
  - lib/scss_lint/linter/compass/property_with_mixin.rb
108
108
  - lib/scss_lint/linter/space_after_property_name.rb
109
+ - lib/scss_lint/linter/property_spelling.rb
109
110
  - lib/scss_lint/linter/usage_name.rb
111
+ - lib/scss_lint/linter/space_between_parens.rb
110
112
  - lib/scss_lint/linter/border_zero.rb
111
113
  - lib/scss_lint/linter/space_after_property_colon.rb
112
114
  - lib/scss_lint/linter/debug_statement.rb
@@ -147,3 +149,4 @@ signing_key:
147
149
  specification_version: 4
148
150
  summary: SCSS lint tool
149
151
  test_files: []
152
+ has_rdoc: