scss-lint 0.29.0 → 0.30.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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/config/default.yml +31 -1
  3. data/data/prefixed-identifiers/base.txt +107 -0
  4. data/data/prefixed-identifiers/bourbon.txt +71 -0
  5. data/lib/scss_lint/cli.rb +34 -7
  6. data/lib/scss_lint/config.rb +12 -1
  7. data/lib/scss_lint/engine.rb +3 -1
  8. data/lib/scss_lint/linter/bang_format.rb +40 -0
  9. data/lib/scss_lint/linter/declaration_order.rb +35 -14
  10. data/lib/scss_lint/linter/import_path.rb +62 -0
  11. data/lib/scss_lint/linter/name_format.rb +1 -1
  12. data/lib/scss_lint/linter/nesting_depth.rb +24 -0
  13. data/lib/scss_lint/linter/property_sort_order.rb +4 -11
  14. data/lib/scss_lint/linter/property_spelling.rb +25 -8
  15. data/lib/scss_lint/linter/qualifying_element.rb +42 -0
  16. data/lib/scss_lint/linter/selector_format.rb +23 -11
  17. data/lib/scss_lint/linter/space_after_property_colon.rb +4 -4
  18. data/lib/scss_lint/linter/space_after_property_name.rb +16 -1
  19. data/lib/scss_lint/linter/space_before_brace.rb +36 -9
  20. data/lib/scss_lint/linter/trailing_semicolon.rb +6 -2
  21. data/lib/scss_lint/linter/vendor_prefixes.rb +64 -0
  22. data/lib/scss_lint/rake_task.rb +1 -0
  23. data/lib/scss_lint/runner.rb +2 -1
  24. data/lib/scss_lint/sass/script.rb +10 -0
  25. data/lib/scss_lint/version.rb +1 -1
  26. data/spec/scss_lint/cli_spec.rb +45 -2
  27. data/spec/scss_lint/linter/bang_format_spec.rb +79 -0
  28. data/spec/scss_lint/linter/declaration_order_spec.rb +466 -0
  29. data/spec/scss_lint/linter/import_path_spec.rb +300 -0
  30. data/spec/scss_lint/linter/nesting_depth_spec.rb +114 -0
  31. data/spec/scss_lint/linter/property_spelling_spec.rb +27 -0
  32. data/spec/scss_lint/linter/qualifying_element_spec.rb +125 -0
  33. data/spec/scss_lint/linter/selector_format_spec.rb +329 -0
  34. data/spec/scss_lint/linter/space_after_property_colon_spec.rb +14 -0
  35. data/spec/scss_lint/linter/space_after_property_name_spec.rb +14 -0
  36. data/spec/scss_lint/linter/space_before_brace_spec.rb +401 -17
  37. data/spec/scss_lint/linter/trailing_semicolon_spec.rb +47 -0
  38. data/spec/scss_lint/linter/vendor_prefixes_spec.rb +350 -0
  39. metadata +19 -2
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe SCSSLint::Linter::TrailingSemicolon do
@@ -206,6 +208,24 @@ describe SCSSLint::Linter::TrailingSemicolon do
206
208
  it { should_not report_lint }
207
209
  end
208
210
 
211
+ context 'when @import ends with a semicolon' do
212
+ let(:css) { '@import "something";' }
213
+
214
+ it { should_not report_lint }
215
+ end
216
+
217
+ context 'when @import does not end with a semicolon' do
218
+ let(:css) { '@import "something"' }
219
+
220
+ it { should report_lint line: 1 }
221
+ end
222
+
223
+ context 'when @import has a space before a semicolon' do
224
+ let(:css) { '@import "something" ;' }
225
+
226
+ it { should report_lint line: 1 }
227
+ end
228
+
209
229
  context 'when variable declaration does not end with a semicolon' do
210
230
  let(:css) { <<-CSS }
211
231
  .foo {
@@ -235,4 +255,31 @@ describe SCSSLint::Linter::TrailingSemicolon do
235
255
 
236
256
  it { should report_lint line: 2 }
237
257
  end
258
+
259
+ context 'when interpolation within single quotes is followed by property' do
260
+ context 'and property has a trailing semicolon' do
261
+ let(:css) { "[class~='\#{$test}'] { width: 100%; }" }
262
+
263
+ it { should_not report_lint }
264
+ end
265
+
266
+ context 'and property does not have a trailing semicolon' do
267
+ let(:css) { "[class~='\#{$test}'] { width : 100% }" }
268
+
269
+ it { should report_lint }
270
+ end
271
+ end
272
+
273
+ context 'when triggering a bug based on Windows IBM437 encoding' do
274
+ CSS = <<-CSS
275
+ @charset "UTF-8";
276
+
277
+ .foo:before {
278
+ content: '▼';
279
+ }
280
+ CSS
281
+ let(:css) { CSS.force_encoding('IBM437') }
282
+
283
+ it { should_not report_lint }
284
+ end
238
285
  end
@@ -0,0 +1,350 @@
1
+ require 'spec_helper'
2
+
3
+ describe SCSSLint::Linter::VendorPrefixes do
4
+ context 'when no vendor-prefix is used' do
5
+ let(:css) { <<-CSS }
6
+ div {
7
+ transition: none;
8
+ }
9
+ CSS
10
+
11
+ it { should_not report_lint }
12
+ end
13
+
14
+ context 'when a rule is empty' do
15
+ let(:css) { <<-CSS }
16
+ div {
17
+ }
18
+ CSS
19
+
20
+ it { should_not report_lint }
21
+ end
22
+
23
+ # Properties
24
+
25
+ context 'when a vendor-prefixed listed property is used' do
26
+ let(:css) { <<-CSS }
27
+ div {
28
+ -webkit-transition: none;
29
+ }
30
+ CSS
31
+
32
+ it { should report_lint line: 2 }
33
+ end
34
+
35
+ context 'when an unprefixed listed property is used' do
36
+ let(:css) { <<-CSS }
37
+ div {
38
+ transition: none;
39
+ }
40
+ CSS
41
+
42
+ it { should_not report_lint }
43
+ end
44
+
45
+ context 'when a vendor-prefixed unlisted property is used' do
46
+ let(:css) { <<-CSS }
47
+ div {
48
+ -webkit-appearance: none;
49
+ }
50
+ CSS
51
+
52
+ it { should_not report_lint }
53
+ end
54
+
55
+ context 'when a vendor-prefixed custom-listed property is used' do
56
+ let(:linter_config) { { 'identifier_list' => ['transform'] } }
57
+
58
+ let(:css) { <<-CSS }
59
+ div {
60
+ -webkit-transform: none;
61
+ }
62
+ CSS
63
+
64
+ it { should report_lint line: 2 }
65
+ end
66
+
67
+ context 'when a proprietary unlisted vendor-prefixed property is used' do
68
+ let(:css) { <<-CSS }
69
+ div {
70
+ -moz-padding-end: 0;
71
+ }
72
+ CSS
73
+
74
+ it { should_not report_lint }
75
+ end
76
+
77
+ context 'when a proprietary listed vendor-prefixed property is used' do
78
+ let(:linter_config) { { 'identifier_list' => ['padding-end'] } }
79
+
80
+ let(:css) { <<-CSS }
81
+ div {
82
+ -moz-padding-end: 0;
83
+ }
84
+ CSS
85
+
86
+ it { should report_lint line: 2 }
87
+ end
88
+
89
+ # Selectors
90
+
91
+ context 'when a vendor-prefixed listed selector is used' do
92
+ let(:css) { <<-CSS }
93
+ ::-moz-placeholder {
94
+ color: red;
95
+ }
96
+ :-ms-placeholder {
97
+ color: pink;
98
+ }
99
+ :-moz-fullscreen p {
100
+ font-size: 200%;
101
+ }
102
+ CSS
103
+
104
+ it { should report_lint line: 1 }
105
+ it { should report_lint line: 4 }
106
+ it { should report_lint line: 7 }
107
+ end
108
+
109
+ context 'when an unprefixed listed selector is used' do
110
+ let(:css) { <<-CSS }
111
+ ::placeholder {
112
+ color: red;
113
+ }
114
+ :fullscreen p {
115
+ font-size: 200%;
116
+ }
117
+ CSS
118
+
119
+ it { should_not report_lint }
120
+ end
121
+
122
+ context 'when a vendor-prefixed unlisted selector is used' do
123
+ let(:linter_config) { { 'identifier_list' => ['transform'] } }
124
+
125
+ let(:css) { <<-CSS }
126
+ ::-moz-placeholder {
127
+ color: red;
128
+ }
129
+ CSS
130
+
131
+ it { should_not report_lint }
132
+ end
133
+
134
+ context 'when a vendor-prefixed custom-listed selector is used' do
135
+ let(:linter_config) { { 'identifier_list' => ['placeholder'] } }
136
+
137
+ let(:css) { <<-CSS }
138
+ ::-moz-placeholder {
139
+ color: red;
140
+ }
141
+ CSS
142
+
143
+ it { should report_lint line: 1 }
144
+ end
145
+
146
+ # Directives
147
+
148
+ context 'when a vendor-prefixed listed directive is used' do
149
+ let(:css) { <<-CSS }
150
+ @-webkit-keyframes anim {
151
+ 0% { opacity: 0; }
152
+ }
153
+ CSS
154
+
155
+ it { should report_lint line: 1 }
156
+ end
157
+
158
+ context 'when an unprefixed listed directive is used' do
159
+ let(:css) { <<-CSS }
160
+ @keyframes anim {
161
+ 0% { opacity: 0; }
162
+ }
163
+ CSS
164
+
165
+ it { should_not report_lint }
166
+ end
167
+
168
+ context 'when an vendor-prefixed unlisted directive is used' do
169
+ let(:linter_config) { { 'identifier_list' => ['placeholder'] } }
170
+
171
+ let(:css) { <<-CSS }
172
+ @-webkit-keyframes anim {
173
+ 0% { opacity: 0; }
174
+ }
175
+ CSS
176
+
177
+ it { should_not report_lint }
178
+ end
179
+
180
+ context 'when an vendor-prefixed custom-listed directive is used' do
181
+ let(:linter_config) { { 'identifier_list' => ['keyframes'] } }
182
+
183
+ let(:css) { <<-CSS }
184
+ @-webkit-keyframes anim {
185
+ 0% { opacity: 0; }
186
+ }
187
+ CSS
188
+
189
+ it { should report_lint line: 1 }
190
+ end
191
+
192
+ # Values
193
+
194
+ context 'when a vendor-prefixed listed value is used' do
195
+ let(:css) { <<-CSS }
196
+ div {
197
+ background-image: -webkit-linear-gradient(#000, #fff);
198
+ position: -moz-sticky;
199
+ }
200
+ CSS
201
+
202
+ it { should report_lint line: 2 }
203
+ it { should report_lint line: 3 }
204
+ end
205
+
206
+ context 'when an unprefixed listed value is used' do
207
+ let(:css) { <<-CSS }
208
+ div {
209
+ background-image: linear-gradient(#000, #fff);
210
+ }
211
+ CSS
212
+
213
+ it { should_not report_lint }
214
+ end
215
+
216
+ context 'when a vendor-unprefixed unlisted value is used' do
217
+ let(:linter_config) { { 'identifier_list' => ['keyframes'] } }
218
+
219
+ let(:css) { <<-CSS }
220
+ div {
221
+ background-image: -webkit-linear-gradient(#000, #fff);
222
+ position: -moz-sticky;
223
+ }
224
+ CSS
225
+
226
+ it { should_not report_lint }
227
+ end
228
+
229
+ context 'when a vendor-unprefixed custom-listed value is used' do
230
+ let(:linter_config) { { 'identifier_list' => ['linear-gradient'] } }
231
+
232
+ let(:css) { <<-CSS }
233
+ div {
234
+ background-image: -webkit-linear-gradient(#000, #fff);
235
+ position: -moz-sticky;
236
+ }
237
+ CSS
238
+
239
+ it { should report_lint line: 2 }
240
+ end
241
+
242
+ # Identifier lists
243
+
244
+ context 'when using non-default named identifier list' do
245
+ let(:linter_config) { { 'identifier_list' => 'bourbon' } }
246
+
247
+ context 'and a standard vendor-prefixed property is used' do
248
+ let(:css) { <<-CSS }
249
+ div {
250
+ background-image: -webkit-linear-gradient(#000, #fff);
251
+ }
252
+ CSS
253
+
254
+ it { should report_lint line: 2 }
255
+ end
256
+
257
+ context 'and a list-specific vendor-prefixed property is used' do
258
+ let(:css) { <<-CSS }
259
+ div {
260
+ image-rendering: -moz-crisp-edges;
261
+ -webkit-appearance: none;
262
+ }
263
+ CSS
264
+
265
+ it { should report_lint line: 2 }
266
+ it { should report_lint line: 3 }
267
+ end
268
+
269
+ context 'and a list-exempt vendor-prefixed property is used' do
270
+ let(:css) { <<-CSS }
271
+ div {
272
+ -webkit-mask-repeat: inherit;
273
+ }
274
+ CSS
275
+
276
+ it { should_not report_lint }
277
+ end
278
+ end
279
+
280
+ # Excluding and Including
281
+
282
+ context 'when manually excluding identifiers' do
283
+ let(:linter_config) { { 'exclude' => %w[transform selection] } }
284
+
285
+ let(:css) { <<-CSS }
286
+ div {
287
+ -wekit-transform: translateZ(0);
288
+ }
289
+ ::-moz-selection {
290
+ color: #000;
291
+ }
292
+ CSS
293
+
294
+ it { should_not report_lint }
295
+ end
296
+
297
+ context 'when manually including identifiers' do
298
+ let(:linter_config) { { 'include' => ['padding-end'] } }
299
+
300
+ let(:css) { <<-CSS }
301
+ div {
302
+ -moz-padding-end: 0;
303
+ }
304
+ CSS
305
+
306
+ it { should report_lint line: 2 }
307
+ end
308
+
309
+ # More
310
+ context 'when dealing with many-hyphened vendor-prefixed identifiers' do
311
+ let(:css) { <<-CSS }
312
+ div {
313
+ -moz-animation-timing-function: ease-out;
314
+ -webkit-border-bottom-right-radius: 5px;
315
+ background: -o-repeating-radial-gradient(#000, #000 5px, #fff 5px, #fff 10px)
316
+ }
317
+ CSS
318
+
319
+ it { should report_lint line: 2 }
320
+ it { should report_lint line: 3 }
321
+ it { should report_lint line: 4 }
322
+ end
323
+
324
+ context 'when dealing with many-hyphened unprefixed identifiers' do
325
+ let(:css) { <<-CSS }
326
+ div {
327
+ animation-timing-function: ease-out;
328
+ border-bottom-right-radius: 5px;
329
+ background: repeating-radial-gradient(#000, #000 5px, #fff 5px, #fff 10px)
330
+ }
331
+ CSS
332
+
333
+ it { should_not report_lint }
334
+ end
335
+
336
+ context 'when vendor-prefixed media queries are used' do
337
+ let(:css) { <<-CSS }
338
+ @media
339
+ only screen and (-webkit-min-device-pixel-ratio: 1.3),
340
+ only screen and (-o-min-device-pixel-ratio: 13/10),
341
+ only screen and (min-resolution: 120dpi) {
342
+ body {
343
+ background: #fff;
344
+ }
345
+ }
346
+ CSS
347
+
348
+ it { should_not report_lint }
349
+ end
350
+ 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.29.0
4
+ version: 0.30.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: 2014-10-07 00:00:00.000000000 Z
12
+ date: 2014-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -93,6 +93,8 @@ files:
93
93
  - config/default.yml
94
94
  - data/properties.txt
95
95
  - data/property-sort-orders/concentric.txt
96
+ - data/prefixed-identifiers/base.txt
97
+ - data/prefixed-identifiers/bourbon.txt
96
98
  - lib/scss_lint/version.rb
97
99
  - lib/scss_lint/constants.rb
98
100
  - lib/scss_lint/utils.rb
@@ -114,6 +116,7 @@ files:
114
116
  - lib/scss_lint/config.rb
115
117
  - lib/scss_lint/linter/compass.rb
116
118
  - lib/scss_lint/linter/space_after_comma.rb
119
+ - lib/scss_lint/linter/nesting_depth.rb
117
120
  - lib/scss_lint/linter/trailing_zero.rb
118
121
  - lib/scss_lint/linter/space_before_brace.rb
119
122
  - lib/scss_lint/linter/hex_length.rb
@@ -122,13 +125,16 @@ files:
122
125
  - lib/scss_lint/linter/single_line_per_property.rb
123
126
  - lib/scss_lint/linter/shorthand.rb
124
127
  - lib/scss_lint/linter/final_newline.rb
128
+ - lib/scss_lint/linter/import_path.rb
125
129
  - lib/scss_lint/linter/id_with_extraneous_selector.rb
126
130
  - lib/scss_lint/linter/empty_line_between_blocks.rb
131
+ - lib/scss_lint/linter/bang_format.rb
127
132
  - lib/scss_lint/linter/declaration_order.rb
128
133
  - lib/scss_lint/linter/zero_unit.rb
129
134
  - lib/scss_lint/linter/placeholder_in_extend.rb
130
135
  - lib/scss_lint/linter/selector_depth.rb
131
136
  - lib/scss_lint/linter/else_placement.rb
137
+ - lib/scss_lint/linter/qualifying_element.rb
132
138
  - lib/scss_lint/linter/selector_format.rb
133
139
  - lib/scss_lint/linter/hex_validation.rb
134
140
  - lib/scss_lint/linter/compass/property_with_mixin.rb
@@ -151,6 +157,7 @@ files:
151
157
  - lib/scss_lint/linter/comment.rb
152
158
  - lib/scss_lint/linter/empty_rule.rb
153
159
  - lib/scss_lint/linter/single_line_per_selector.rb
160
+ - lib/scss_lint/linter/vendor_prefixes.rb
154
161
  - lib/scss_lint/linter/hex_notation.rb
155
162
  - lib/scss_lint/linter/url_format.rb
156
163
  - lib/scss_lint/cli.rb
@@ -172,10 +179,13 @@ files:
172
179
  - spec/scss_lint/cli_spec.rb
173
180
  - spec/scss_lint/linter/final_newline_spec.rb
174
181
  - spec/scss_lint/linter/color_keyword_spec.rb
182
+ - spec/scss_lint/linter/import_path_spec.rb
175
183
  - spec/scss_lint/linter/single_line_per_selector_spec.rb
176
184
  - spec/scss_lint/linter/empty_rule_spec.rb
177
185
  - spec/scss_lint/linter/hex_notation_spec.rb
186
+ - spec/scss_lint/linter/bang_format_spec.rb
178
187
  - spec/scss_lint/linter/hex_length_spec.rb
188
+ - spec/scss_lint/linter/vendor_prefixes_spec.rb
179
189
  - spec/scss_lint/linter/url_quotes_spec.rb
180
190
  - spec/scss_lint/linter/space_between_parens_spec.rb
181
191
  - spec/scss_lint/linter/selector_format_spec.rb
@@ -183,6 +193,7 @@ files:
183
193
  - spec/scss_lint/linter/property_spelling_spec.rb
184
194
  - spec/scss_lint/linter/property_sort_order_spec.rb
185
195
  - spec/scss_lint/linter/else_placement_spec.rb
196
+ - spec/scss_lint/linter/qualifying_element_spec.rb
186
197
  - spec/scss_lint/linter/zero_unit_spec.rb
187
198
  - spec/scss_lint/linter/mergeable_selector_spec.rb
188
199
  - spec/scss_lint/linter/unnecessary_mantissa_spec.rb
@@ -204,6 +215,7 @@ files:
204
215
  - spec/scss_lint/linter/trailing_zero_spec.rb
205
216
  - spec/scss_lint/linter/url_format_spec.rb
206
217
  - spec/scss_lint/linter/comment_spec.rb
218
+ - spec/scss_lint/linter/nesting_depth_spec.rb
207
219
  - spec/scss_lint/linter/trailing_semicolon_spec.rb
208
220
  - spec/scss_lint/linter/selector_depth_spec.rb
209
221
  - spec/scss_lint/linter/space_after_comma_spec.rb
@@ -254,10 +266,13 @@ test_files:
254
266
  - spec/scss_lint/cli_spec.rb
255
267
  - spec/scss_lint/linter/final_newline_spec.rb
256
268
  - spec/scss_lint/linter/color_keyword_spec.rb
269
+ - spec/scss_lint/linter/import_path_spec.rb
257
270
  - spec/scss_lint/linter/single_line_per_selector_spec.rb
258
271
  - spec/scss_lint/linter/empty_rule_spec.rb
259
272
  - spec/scss_lint/linter/hex_notation_spec.rb
273
+ - spec/scss_lint/linter/bang_format_spec.rb
260
274
  - spec/scss_lint/linter/hex_length_spec.rb
275
+ - spec/scss_lint/linter/vendor_prefixes_spec.rb
261
276
  - spec/scss_lint/linter/url_quotes_spec.rb
262
277
  - spec/scss_lint/linter/space_between_parens_spec.rb
263
278
  - spec/scss_lint/linter/selector_format_spec.rb
@@ -265,6 +280,7 @@ test_files:
265
280
  - spec/scss_lint/linter/property_spelling_spec.rb
266
281
  - spec/scss_lint/linter/property_sort_order_spec.rb
267
282
  - spec/scss_lint/linter/else_placement_spec.rb
283
+ - spec/scss_lint/linter/qualifying_element_spec.rb
268
284
  - spec/scss_lint/linter/zero_unit_spec.rb
269
285
  - spec/scss_lint/linter/mergeable_selector_spec.rb
270
286
  - spec/scss_lint/linter/unnecessary_mantissa_spec.rb
@@ -286,6 +302,7 @@ test_files:
286
302
  - spec/scss_lint/linter/trailing_zero_spec.rb
287
303
  - spec/scss_lint/linter/url_format_spec.rb
288
304
  - spec/scss_lint/linter/comment_spec.rb
305
+ - spec/scss_lint/linter/nesting_depth_spec.rb
289
306
  - spec/scss_lint/linter/trailing_semicolon_spec.rb
290
307
  - spec/scss_lint/linter/selector_depth_spec.rb
291
308
  - spec/scss_lint/linter/space_after_comma_spec.rb