scss_lint 0.38.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 +7 -0
- data/bin/scss-lint +6 -0
- data/config/default.yml +205 -0
- data/data/prefixed-identifiers/base.txt +107 -0
- data/data/prefixed-identifiers/bourbon.txt +71 -0
- data/data/properties.txt +477 -0
- data/data/property-sort-orders/concentric.txt +134 -0
- data/data/property-sort-orders/recess.txt +149 -0
- data/data/property-sort-orders/smacss.txt +137 -0
- data/lib/scss_lint.rb +31 -0
- data/lib/scss_lint/cli.rb +215 -0
- data/lib/scss_lint/config.rb +251 -0
- data/lib/scss_lint/constants.rb +8 -0
- data/lib/scss_lint/control_comment_processor.rb +126 -0
- data/lib/scss_lint/engine.rb +56 -0
- data/lib/scss_lint/exceptions.rb +21 -0
- data/lib/scss_lint/file_finder.rb +68 -0
- data/lib/scss_lint/lint.rb +24 -0
- data/lib/scss_lint/linter.rb +161 -0
- data/lib/scss_lint/linter/bang_format.rb +52 -0
- data/lib/scss_lint/linter/border_zero.rb +39 -0
- data/lib/scss_lint/linter/color_keyword.rb +32 -0
- data/lib/scss_lint/linter/color_variable.rb +60 -0
- data/lib/scss_lint/linter/comment.rb +21 -0
- data/lib/scss_lint/linter/compass.rb +7 -0
- data/lib/scss_lint/linter/compass/property_with_mixin.rb +47 -0
- data/lib/scss_lint/linter/debug_statement.rb +10 -0
- data/lib/scss_lint/linter/declaration_order.rb +71 -0
- data/lib/scss_lint/linter/duplicate_property.rb +58 -0
- data/lib/scss_lint/linter/else_placement.rb +48 -0
- data/lib/scss_lint/linter/empty_line_between_blocks.rb +85 -0
- data/lib/scss_lint/linter/empty_rule.rb +11 -0
- data/lib/scss_lint/linter/final_newline.rb +20 -0
- data/lib/scss_lint/linter/hex_length.rb +56 -0
- data/lib/scss_lint/linter/hex_notation.rb +38 -0
- data/lib/scss_lint/linter/hex_validation.rb +23 -0
- data/lib/scss_lint/linter/id_selector.rb +10 -0
- data/lib/scss_lint/linter/import_path.rb +62 -0
- data/lib/scss_lint/linter/important_rule.rb +12 -0
- data/lib/scss_lint/linter/indentation.rb +197 -0
- data/lib/scss_lint/linter/leading_zero.rb +49 -0
- data/lib/scss_lint/linter/mergeable_selector.rb +60 -0
- data/lib/scss_lint/linter/name_format.rb +117 -0
- data/lib/scss_lint/linter/nesting_depth.rb +24 -0
- data/lib/scss_lint/linter/placeholder_in_extend.rb +22 -0
- data/lib/scss_lint/linter/property_count.rb +44 -0
- data/lib/scss_lint/linter/property_sort_order.rb +198 -0
- data/lib/scss_lint/linter/property_spelling.rb +49 -0
- data/lib/scss_lint/linter/property_units.rb +59 -0
- data/lib/scss_lint/linter/qualifying_element.rb +42 -0
- data/lib/scss_lint/linter/selector_depth.rb +64 -0
- data/lib/scss_lint/linter/selector_format.rb +102 -0
- data/lib/scss_lint/linter/shorthand.rb +139 -0
- data/lib/scss_lint/linter/single_line_per_property.rb +59 -0
- data/lib/scss_lint/linter/single_line_per_selector.rb +35 -0
- data/lib/scss_lint/linter/space_after_comma.rb +110 -0
- data/lib/scss_lint/linter/space_after_property_colon.rb +92 -0
- data/lib/scss_lint/linter/space_after_property_name.rb +27 -0
- data/lib/scss_lint/linter/space_before_brace.rb +72 -0
- data/lib/scss_lint/linter/space_between_parens.rb +35 -0
- data/lib/scss_lint/linter/string_quotes.rb +94 -0
- data/lib/scss_lint/linter/trailing_semicolon.rb +67 -0
- data/lib/scss_lint/linter/trailing_zero.rb +41 -0
- data/lib/scss_lint/linter/unnecessary_mantissa.rb +42 -0
- data/lib/scss_lint/linter/unnecessary_parent_reference.rb +49 -0
- data/lib/scss_lint/linter/url_format.rb +56 -0
- data/lib/scss_lint/linter/url_quotes.rb +27 -0
- data/lib/scss_lint/linter/variable_for_property.rb +30 -0
- data/lib/scss_lint/linter/vendor_prefix.rb +64 -0
- data/lib/scss_lint/linter/zero_unit.rb +39 -0
- data/lib/scss_lint/linter_registry.rb +26 -0
- data/lib/scss_lint/location.rb +38 -0
- data/lib/scss_lint/options.rb +109 -0
- data/lib/scss_lint/rake_task.rb +106 -0
- data/lib/scss_lint/reporter.rb +18 -0
- data/lib/scss_lint/reporter/config_reporter.rb +26 -0
- data/lib/scss_lint/reporter/default_reporter.rb +27 -0
- data/lib/scss_lint/reporter/files_reporter.rb +8 -0
- data/lib/scss_lint/reporter/json_reporter.rb +30 -0
- data/lib/scss_lint/reporter/xml_reporter.rb +33 -0
- data/lib/scss_lint/runner.rb +51 -0
- data/lib/scss_lint/sass/script.rb +78 -0
- data/lib/scss_lint/sass/tree.rb +168 -0
- data/lib/scss_lint/selector_visitor.rb +34 -0
- data/lib/scss_lint/utils.rb +112 -0
- data/lib/scss_lint/version.rb +4 -0
- data/spec/scss_lint/cli_spec.rb +177 -0
- data/spec/scss_lint/config_spec.rb +253 -0
- data/spec/scss_lint/engine_spec.rb +24 -0
- data/spec/scss_lint/file_finder_spec.rb +134 -0
- data/spec/scss_lint/linter/bang_format_spec.rb +121 -0
- data/spec/scss_lint/linter/border_zero_spec.rb +118 -0
- data/spec/scss_lint/linter/color_keyword_spec.rb +83 -0
- data/spec/scss_lint/linter/color_variable_spec.rb +155 -0
- data/spec/scss_lint/linter/comment_spec.rb +79 -0
- data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +55 -0
- data/spec/scss_lint/linter/debug_statement_spec.rb +21 -0
- data/spec/scss_lint/linter/declaration_order_spec.rb +575 -0
- data/spec/scss_lint/linter/duplicate_property_spec.rb +189 -0
- data/spec/scss_lint/linter/else_placement_spec.rb +106 -0
- data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +276 -0
- data/spec/scss_lint/linter/empty_rule_spec.rb +27 -0
- data/spec/scss_lint/linter/final_newline_spec.rb +49 -0
- data/spec/scss_lint/linter/hex_length_spec.rb +104 -0
- data/spec/scss_lint/linter/hex_notation_spec.rb +104 -0
- data/spec/scss_lint/linter/hex_validation_spec.rb +40 -0
- data/spec/scss_lint/linter/id_selector_spec.rb +62 -0
- data/spec/scss_lint/linter/import_path_spec.rb +300 -0
- data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
- data/spec/scss_lint/linter/indentation_spec.rb +347 -0
- data/spec/scss_lint/linter/leading_zero_spec.rb +233 -0
- data/spec/scss_lint/linter/mergeable_selector_spec.rb +283 -0
- data/spec/scss_lint/linter/name_format_spec.rb +282 -0
- data/spec/scss_lint/linter/nesting_depth_spec.rb +114 -0
- data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +63 -0
- data/spec/scss_lint/linter/property_count_spec.rb +104 -0
- data/spec/scss_lint/linter/property_sort_order_spec.rb +482 -0
- data/spec/scss_lint/linter/property_spelling_spec.rb +84 -0
- data/spec/scss_lint/linter/property_units_spec.rb +229 -0
- data/spec/scss_lint/linter/qualifying_element_spec.rb +125 -0
- data/spec/scss_lint/linter/selector_depth_spec.rb +159 -0
- data/spec/scss_lint/linter/selector_format_spec.rb +632 -0
- data/spec/scss_lint/linter/shorthand_spec.rb +198 -0
- data/spec/scss_lint/linter/single_line_per_property_spec.rb +73 -0
- data/spec/scss_lint/linter/single_line_per_selector_spec.rb +130 -0
- data/spec/scss_lint/linter/space_after_comma_spec.rb +332 -0
- data/spec/scss_lint/linter/space_after_property_colon_spec.rb +373 -0
- data/spec/scss_lint/linter/space_after_property_name_spec.rb +37 -0
- data/spec/scss_lint/linter/space_before_brace_spec.rb +829 -0
- data/spec/scss_lint/linter/space_between_parens_spec.rb +263 -0
- data/spec/scss_lint/linter/string_quotes_spec.rb +335 -0
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +304 -0
- data/spec/scss_lint/linter/trailing_zero_spec.rb +176 -0
- data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +67 -0
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +98 -0
- data/spec/scss_lint/linter/url_format_spec.rb +55 -0
- data/spec/scss_lint/linter/url_quotes_spec.rb +73 -0
- data/spec/scss_lint/linter/variable_for_property_spec.rb +145 -0
- data/spec/scss_lint/linter/vendor_prefix_spec.rb +371 -0
- data/spec/scss_lint/linter/zero_unit_spec.rb +113 -0
- data/spec/scss_lint/linter_registry_spec.rb +50 -0
- data/spec/scss_lint/linter_spec.rb +292 -0
- data/spec/scss_lint/location_spec.rb +42 -0
- data/spec/scss_lint/options_spec.rb +34 -0
- data/spec/scss_lint/rake_task_spec.rb +43 -0
- data/spec/scss_lint/reporter/config_reporter_spec.rb +42 -0
- data/spec/scss_lint/reporter/default_reporter_spec.rb +73 -0
- data/spec/scss_lint/reporter/files_reporter_spec.rb +38 -0
- data/spec/scss_lint/reporter/json_reporter_spec.rb +96 -0
- data/spec/scss_lint/reporter/xml_reporter_spec.rb +103 -0
- data/spec/scss_lint/reporter_spec.rb +11 -0
- data/spec/scss_lint/runner_spec.rb +123 -0
- data/spec/scss_lint/selector_visitor_spec.rb +264 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/support/isolated_environment.rb +25 -0
- data/spec/support/matchers/report_lint.rb +48 -0
- metadata +328 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SCSSLint::Linter::DebugStatement do
|
|
4
|
+
context 'when no debug statements are present' do
|
|
5
|
+
let(:scss) { <<-SCSS }
|
|
6
|
+
p {
|
|
7
|
+
color: #fff;
|
|
8
|
+
}
|
|
9
|
+
SCSS
|
|
10
|
+
|
|
11
|
+
it { should_not report_lint }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'when a debug statement is present' do
|
|
15
|
+
let(:scss) { <<-SCSS }
|
|
16
|
+
@debug 'This is a debug statement';
|
|
17
|
+
SCSS
|
|
18
|
+
|
|
19
|
+
it { should report_lint line: 1 }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SCSSLint::Linter::DeclarationOrder do
|
|
4
|
+
context 'when rule is empty' do
|
|
5
|
+
let(:scss) { <<-SCSS }
|
|
6
|
+
p {
|
|
7
|
+
}
|
|
8
|
+
SCSS
|
|
9
|
+
|
|
10
|
+
it { should_not report_lint }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'when rule contains only properties' do
|
|
14
|
+
let(:scss) { <<-SCSS }
|
|
15
|
+
p {
|
|
16
|
+
background: #000;
|
|
17
|
+
margin: 5px;
|
|
18
|
+
}
|
|
19
|
+
SCSS
|
|
20
|
+
|
|
21
|
+
it { should_not report_lint }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
context 'when rule contains only mixins' do
|
|
25
|
+
let(:scss) { <<-SCSS }
|
|
26
|
+
p {
|
|
27
|
+
@include border-radius(5px);
|
|
28
|
+
@include box-shadow(5px);
|
|
29
|
+
}
|
|
30
|
+
SCSS
|
|
31
|
+
|
|
32
|
+
it { should_not report_lint }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
context 'when rule contains no mixins or properties' do
|
|
36
|
+
let(:scss) { <<-SCSS }
|
|
37
|
+
p {
|
|
38
|
+
a {
|
|
39
|
+
color: #f00;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
SCSS
|
|
43
|
+
|
|
44
|
+
it { should_not report_lint }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
context 'when rule contains properties after nested rules' do
|
|
48
|
+
let(:scss) { <<-SCSS }
|
|
49
|
+
p {
|
|
50
|
+
a {
|
|
51
|
+
color: #f00;
|
|
52
|
+
}
|
|
53
|
+
color: #f00;
|
|
54
|
+
margin: 5px;
|
|
55
|
+
}
|
|
56
|
+
SCSS
|
|
57
|
+
|
|
58
|
+
it { should report_lint }
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'when @extend appears before any properties or rules' do
|
|
62
|
+
let(:scss) { <<-SCSS }
|
|
63
|
+
.warn {
|
|
64
|
+
font-weight: bold;
|
|
65
|
+
}
|
|
66
|
+
.error {
|
|
67
|
+
@extend .warn;
|
|
68
|
+
color: #f00;
|
|
69
|
+
a {
|
|
70
|
+
color: #ccc;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
SCSS
|
|
74
|
+
|
|
75
|
+
it { should_not report_lint }
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context 'when @extend appears after a property' do
|
|
79
|
+
let(:scss) { <<-SCSS }
|
|
80
|
+
.warn {
|
|
81
|
+
font-weight: bold;
|
|
82
|
+
}
|
|
83
|
+
.error {
|
|
84
|
+
color: #f00;
|
|
85
|
+
@extend .warn;
|
|
86
|
+
a {
|
|
87
|
+
color: #ccc;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
SCSS
|
|
91
|
+
|
|
92
|
+
it { should report_lint line: 6 }
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
context 'when nested rule set' do
|
|
96
|
+
context 'contains @extend before a property' do
|
|
97
|
+
let(:scss) { <<-SCSS }
|
|
98
|
+
p {
|
|
99
|
+
a {
|
|
100
|
+
@extend foo;
|
|
101
|
+
color: #f00;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
SCSS
|
|
105
|
+
|
|
106
|
+
it { should_not report_lint }
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
context 'contains @extend after a property' do
|
|
110
|
+
let(:scss) { <<-SCSS }
|
|
111
|
+
p {
|
|
112
|
+
a {
|
|
113
|
+
color: #f00;
|
|
114
|
+
@extend foo;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
SCSS
|
|
118
|
+
|
|
119
|
+
it { should report_lint line: 4 }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context 'contains @extend after nested rule set' do
|
|
123
|
+
let(:scss) { <<-SCSS }
|
|
124
|
+
p {
|
|
125
|
+
a {
|
|
126
|
+
span {
|
|
127
|
+
color: #000;
|
|
128
|
+
}
|
|
129
|
+
@extend foo;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
SCSS
|
|
133
|
+
|
|
134
|
+
it { should report_lint line: 6 }
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
context 'when @include appears' do
|
|
139
|
+
context 'before a property and rule set' do
|
|
140
|
+
let(:scss) { <<-SCSS }
|
|
141
|
+
.error {
|
|
142
|
+
@include warn;
|
|
143
|
+
color: #f00;
|
|
144
|
+
a {
|
|
145
|
+
color: #ccc;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
SCSS
|
|
149
|
+
|
|
150
|
+
it { should_not report_lint }
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
context 'after a property and before a rule set' do
|
|
154
|
+
let(:scss) { <<-SCSS }
|
|
155
|
+
.error {
|
|
156
|
+
color: #f00;
|
|
157
|
+
@include warn;
|
|
158
|
+
a {
|
|
159
|
+
color: #ccc;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
SCSS
|
|
163
|
+
|
|
164
|
+
it { should report_lint line: 3 }
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
context 'when @include that features @content appears' do
|
|
169
|
+
context 'before a property' do
|
|
170
|
+
let(:scss) { <<-SCSS }
|
|
171
|
+
.foo {
|
|
172
|
+
@include breakpoint("phone") {
|
|
173
|
+
color: #ccc;
|
|
174
|
+
}
|
|
175
|
+
color: #f00;
|
|
176
|
+
}
|
|
177
|
+
SCSS
|
|
178
|
+
|
|
179
|
+
it { should report_lint line: 5 }
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
context 'after a property' do
|
|
183
|
+
let(:scss) { <<-SCSS }
|
|
184
|
+
.foo {
|
|
185
|
+
color: #f00;
|
|
186
|
+
@include breakpoint("phone") {
|
|
187
|
+
color: #ccc;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
SCSS
|
|
191
|
+
|
|
192
|
+
it { should_not report_lint }
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
context 'before an @extend' do
|
|
196
|
+
let(:scss) { <<-SCSS }
|
|
197
|
+
.foo {
|
|
198
|
+
@include breakpoint("phone") {
|
|
199
|
+
color: #ccc;
|
|
200
|
+
}
|
|
201
|
+
@extend .bar;
|
|
202
|
+
}
|
|
203
|
+
SCSS
|
|
204
|
+
|
|
205
|
+
it { should report_lint line: 5 }
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
context 'before a rule set' do
|
|
209
|
+
let(:scss) { <<-SCSS }
|
|
210
|
+
.foo {
|
|
211
|
+
@include breakpoint("phone") {
|
|
212
|
+
color: #ccc;
|
|
213
|
+
}
|
|
214
|
+
a {
|
|
215
|
+
color: #fff;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
SCSS
|
|
219
|
+
|
|
220
|
+
it { should_not report_lint }
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
context 'after a rule set' do
|
|
224
|
+
let(:scss) { <<-SCSS }
|
|
225
|
+
.foo {
|
|
226
|
+
a {
|
|
227
|
+
color: #fff;
|
|
228
|
+
}
|
|
229
|
+
@include breakpoint("phone") {
|
|
230
|
+
color: #ccc;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
SCSS
|
|
234
|
+
|
|
235
|
+
it { should report_lint line: 5 }
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
context 'with its own nested rule set' do
|
|
239
|
+
context 'before a property' do
|
|
240
|
+
let(:scss) { <<-SCSS }
|
|
241
|
+
@include breakpoint("phone") {
|
|
242
|
+
a {
|
|
243
|
+
color: #000;
|
|
244
|
+
}
|
|
245
|
+
color: #ccc;
|
|
246
|
+
}
|
|
247
|
+
SCSS
|
|
248
|
+
|
|
249
|
+
it { should report_lint line: 5 }
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
context 'after a property' do
|
|
253
|
+
let(:scss) { <<-SCSS }
|
|
254
|
+
@include breakpoint("phone") {
|
|
255
|
+
color: #ccc;
|
|
256
|
+
a {
|
|
257
|
+
color: #000;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
SCSS
|
|
261
|
+
|
|
262
|
+
it { should_not report_lint }
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
context 'when the nesting is crazy deep' do
|
|
268
|
+
context 'and nothing is wrong' do
|
|
269
|
+
let(:scss) { <<-SCSS }
|
|
270
|
+
div {
|
|
271
|
+
ul {
|
|
272
|
+
@extend .thing;
|
|
273
|
+
li {
|
|
274
|
+
@include box-shadow(yes);
|
|
275
|
+
background: green;
|
|
276
|
+
a {
|
|
277
|
+
span {
|
|
278
|
+
@include border-radius(5px);
|
|
279
|
+
color: #000;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
SCSS
|
|
286
|
+
|
|
287
|
+
it { should_not report_lint }
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
context 'and something is wrong' do
|
|
291
|
+
let(:scss) { <<-SCSS }
|
|
292
|
+
div {
|
|
293
|
+
ul {
|
|
294
|
+
li {
|
|
295
|
+
a {
|
|
296
|
+
span {
|
|
297
|
+
color: #000;
|
|
298
|
+
@include border-radius(5px);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
SCSS
|
|
305
|
+
|
|
306
|
+
it { should report_lint line: 7 }
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
context 'when inside a @media query and rule set' do
|
|
311
|
+
context 'contains @extend before a property' do
|
|
312
|
+
let(:scss) { <<-SCSS }
|
|
313
|
+
@media only screen and (max-width: 1px) {
|
|
314
|
+
a {
|
|
315
|
+
@extend foo;
|
|
316
|
+
color: #f00;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
SCSS
|
|
320
|
+
|
|
321
|
+
it { should_not report_lint }
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
context 'contains @extend after a property' do
|
|
325
|
+
let(:scss) { <<-SCSS }
|
|
326
|
+
@media only screen and (max-width: 1px) {
|
|
327
|
+
a {
|
|
328
|
+
color: #f00;
|
|
329
|
+
@extend foo;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
SCSS
|
|
333
|
+
|
|
334
|
+
it { should report_lint line: 4 }
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
context 'contains @extend after nested rule set' do
|
|
338
|
+
let(:scss) { <<-SCSS }
|
|
339
|
+
@media only screen and (max-width: 1px) {
|
|
340
|
+
a {
|
|
341
|
+
span {
|
|
342
|
+
color: #000;
|
|
343
|
+
}
|
|
344
|
+
@extend foo;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
SCSS
|
|
348
|
+
|
|
349
|
+
it { should report_lint line: 6 }
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
context 'when a pseudo-element appears before a property' do
|
|
354
|
+
let(:scss) { <<-SCSS }
|
|
355
|
+
a {
|
|
356
|
+
&:hover {
|
|
357
|
+
color: #000;
|
|
358
|
+
}
|
|
359
|
+
color: #fff;
|
|
360
|
+
}
|
|
361
|
+
SCSS
|
|
362
|
+
|
|
363
|
+
it { should report_lint line: 5 }
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
context 'when a pseudo-element appears after a property' do
|
|
367
|
+
let(:scss) { <<-SCSS }
|
|
368
|
+
a {
|
|
369
|
+
color: #fff;
|
|
370
|
+
&:focus {
|
|
371
|
+
color: #000;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
SCSS
|
|
375
|
+
|
|
376
|
+
it { should_not report_lint }
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
context 'when a chained selector appears after a property' do
|
|
380
|
+
let(:scss) { <<-SCSS }
|
|
381
|
+
a {
|
|
382
|
+
color: #fff;
|
|
383
|
+
&.is-active {
|
|
384
|
+
color: #000;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
SCSS
|
|
388
|
+
|
|
389
|
+
it { should_not report_lint }
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
context 'when a chained selector appears before a property' do
|
|
393
|
+
let(:scss) { <<-SCSS }
|
|
394
|
+
a {
|
|
395
|
+
&.is-active {
|
|
396
|
+
color: #000;
|
|
397
|
+
}
|
|
398
|
+
color: #fff;
|
|
399
|
+
}
|
|
400
|
+
SCSS
|
|
401
|
+
|
|
402
|
+
it { should report_lint line: 5 }
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
context 'when a selector with parent reference appears after a property' do
|
|
406
|
+
let(:scss) { <<-SCSS }
|
|
407
|
+
a {
|
|
408
|
+
color: #fff;
|
|
409
|
+
.is-active & {
|
|
410
|
+
color: #000;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
SCSS
|
|
414
|
+
|
|
415
|
+
it { should_not report_lint }
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
context 'when a selector with parent reference appears before a property' do
|
|
419
|
+
let(:scss) { <<-SCSS }
|
|
420
|
+
a {
|
|
421
|
+
.is-active & {
|
|
422
|
+
color: #000;
|
|
423
|
+
}
|
|
424
|
+
color: #fff;
|
|
425
|
+
}
|
|
426
|
+
SCSS
|
|
427
|
+
|
|
428
|
+
it { should report_lint line: 5 }
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
context 'when a pseudo-element appears after a property' do
|
|
432
|
+
let(:scss) { <<-SCSS }
|
|
433
|
+
a {
|
|
434
|
+
color: #fff;
|
|
435
|
+
&:before {
|
|
436
|
+
color: #000;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
SCSS
|
|
440
|
+
|
|
441
|
+
it { should_not report_lint }
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
context 'when a pseudo-element appears before a property' do
|
|
445
|
+
let(:scss) { <<-SCSS }
|
|
446
|
+
a {
|
|
447
|
+
&:before {
|
|
448
|
+
color: #000;
|
|
449
|
+
}
|
|
450
|
+
color: #fff;
|
|
451
|
+
}
|
|
452
|
+
SCSS
|
|
453
|
+
|
|
454
|
+
it { should report_lint line: 5 }
|
|
455
|
+
end
|
|
456
|
+
|
|
457
|
+
context 'when a direct descendent appears after a property' do
|
|
458
|
+
let(:scss) { <<-SCSS }
|
|
459
|
+
a {
|
|
460
|
+
color: #fff;
|
|
461
|
+
> .foo {
|
|
462
|
+
color: #000;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
SCSS
|
|
466
|
+
|
|
467
|
+
it { should_not report_lint }
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
context 'when a direct descendent appears before a property' do
|
|
471
|
+
let(:scss) { <<-SCSS }
|
|
472
|
+
a {
|
|
473
|
+
> .foo {
|
|
474
|
+
color: #000;
|
|
475
|
+
}
|
|
476
|
+
color: #fff;
|
|
477
|
+
}
|
|
478
|
+
SCSS
|
|
479
|
+
|
|
480
|
+
it { should report_lint line: 5 }
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
context 'when an adjacent sibling appears after a property' do
|
|
484
|
+
let(:scss) { <<-SCSS }
|
|
485
|
+
a {
|
|
486
|
+
color: #fff;
|
|
487
|
+
& + .foo {
|
|
488
|
+
color: #000;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
SCSS
|
|
492
|
+
|
|
493
|
+
it { should_not report_lint }
|
|
494
|
+
end
|
|
495
|
+
|
|
496
|
+
context 'when an adjacent sibling appears before a property' do
|
|
497
|
+
let(:scss) { <<-SCSS }
|
|
498
|
+
a {
|
|
499
|
+
& + .foo {
|
|
500
|
+
color: #000;
|
|
501
|
+
}
|
|
502
|
+
color: #fff;
|
|
503
|
+
}
|
|
504
|
+
SCSS
|
|
505
|
+
|
|
506
|
+
it { should report_lint line: 5 }
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
context 'when a general sibling appears after a property' do
|
|
510
|
+
let(:scss) { <<-SCSS }
|
|
511
|
+
a {
|
|
512
|
+
color: #fff;
|
|
513
|
+
& ~ .foo {
|
|
514
|
+
color: #000;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
SCSS
|
|
518
|
+
|
|
519
|
+
it { should_not report_lint }
|
|
520
|
+
end
|
|
521
|
+
|
|
522
|
+
context 'when a general sibling appears before a property' do
|
|
523
|
+
let(:scss) { <<-SCSS }
|
|
524
|
+
a {
|
|
525
|
+
& ~ .foo {
|
|
526
|
+
color: #000;
|
|
527
|
+
}
|
|
528
|
+
color: #fff;
|
|
529
|
+
}
|
|
530
|
+
SCSS
|
|
531
|
+
|
|
532
|
+
it { should report_lint line: 5 }
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
context 'when a descendent appears after a property' do
|
|
536
|
+
let(:scss) { <<-SCSS }
|
|
537
|
+
a {
|
|
538
|
+
color: #fff;
|
|
539
|
+
.foo {
|
|
540
|
+
color: #000;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
SCSS
|
|
544
|
+
|
|
545
|
+
it { should_not report_lint }
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
context 'when a descendent appears before a property' do
|
|
549
|
+
let(:scss) { <<-SCSS }
|
|
550
|
+
a {
|
|
551
|
+
.foo {
|
|
552
|
+
color: #000;
|
|
553
|
+
}
|
|
554
|
+
color: #fff;
|
|
555
|
+
}
|
|
556
|
+
SCSS
|
|
557
|
+
|
|
558
|
+
it { should report_lint line: 5 }
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
context 'when order within a media query is incorrect' do
|
|
562
|
+
let(:scss) { <<-SCSS }
|
|
563
|
+
@media screen and (max-width: 600px) {
|
|
564
|
+
@include mix1();
|
|
565
|
+
|
|
566
|
+
width: 100%;
|
|
567
|
+
height: 100%;
|
|
568
|
+
|
|
569
|
+
@include mix2();
|
|
570
|
+
}
|
|
571
|
+
SCSS
|
|
572
|
+
|
|
573
|
+
it { should report_lint }
|
|
574
|
+
end
|
|
575
|
+
end
|