scss-lint 0.33.0 → 0.34.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +19 -1
- data/data/properties.txt +4 -0
- data/lib/scss_lint.rb +1 -0
- data/lib/scss_lint/cli.rb +4 -42
- data/lib/scss_lint/config.rb +1 -45
- data/lib/scss_lint/control_comment_processor.rb +47 -15
- data/lib/scss_lint/file_finder.rb +57 -0
- data/lib/scss_lint/linter/bang_format.rb +1 -1
- data/lib/scss_lint/linter/border_zero.rb +25 -9
- data/lib/scss_lint/linter/color_keyword.rb +3 -13
- data/lib/scss_lint/linter/color_variable.rb +36 -0
- data/lib/scss_lint/linter/declaration_order.rb +2 -2
- data/lib/scss_lint/linter/important_rule.rb +12 -0
- data/lib/scss_lint/linter/indentation.rb +7 -1
- data/lib/scss_lint/linter/property_count.rb +44 -0
- data/lib/scss_lint/linter/property_sort_order.rb +73 -19
- data/lib/scss_lint/linter/string_quotes.rb +9 -0
- data/lib/scss_lint/linter/variable_for_property.rb +20 -0
- data/lib/scss_lint/linter/vendor_prefixes.rb +3 -3
- data/lib/scss_lint/runner.rb +5 -7
- data/lib/scss_lint/utils.rb +34 -0
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/cli_spec.rb +1 -1
- data/spec/scss_lint/config_spec.rb +4 -203
- data/spec/scss_lint/engine_spec.rb +4 -4
- data/spec/scss_lint/file_finder_spec.rb +110 -0
- data/spec/scss_lint/linter/bang_format_spec.rb +28 -18
- data/spec/scss_lint/linter/border_zero_spec.rb +50 -16
- data/spec/scss_lint/linter/color_keyword_spec.rb +16 -16
- data/spec/scss_lint/linter/color_variable_spec.rb +102 -0
- data/spec/scss_lint/linter/comment_spec.rb +9 -9
- data/spec/scss_lint/linter/compass/property_with_mixin_spec.rb +10 -10
- data/spec/scss_lint/linter/debug_statement_spec.rb +4 -4
- data/spec/scss_lint/linter/declaration_order_spec.rb +80 -80
- data/spec/scss_lint/linter/duplicate_property_spec.rb +30 -30
- data/spec/scss_lint/linter/else_placement_spec.rb +16 -16
- data/spec/scss_lint/linter/empty_line_between_blocks_spec.rb +38 -38
- data/spec/scss_lint/linter/empty_rule_spec.rb +4 -4
- data/spec/scss_lint/linter/final_newline_spec.rb +6 -6
- data/spec/scss_lint/linter/hex_length_spec.rb +16 -16
- data/spec/scss_lint/linter/hex_notation_spec.rb +16 -16
- data/spec/scss_lint/linter/hex_validation_spec.rb +6 -6
- data/spec/scss_lint/linter/id_selector_spec.rb +10 -10
- data/spec/scss_lint/linter/import_path_spec.rb +45 -45
- data/spec/scss_lint/linter/important_rule_spec.rb +43 -0
- data/spec/scss_lint/linter/indentation_spec.rb +103 -43
- data/spec/scss_lint/linter/leading_zero_spec.rb +45 -45
- data/spec/scss_lint/linter/mergeable_selector_spec.rb +32 -32
- data/spec/scss_lint/linter/name_format_spec.rb +75 -41
- data/spec/scss_lint/linter/nesting_depth_spec.rb +14 -14
- data/spec/scss_lint/linter/placeholder_in_extend_spec.rb +12 -12
- data/spec/scss_lint/linter/property_count_spec.rb +104 -0
- data/spec/scss_lint/linter/property_sort_order_spec.rb +138 -48
- data/spec/scss_lint/linter/property_spelling_spec.rb +14 -14
- data/spec/scss_lint/linter/qualifying_element_spec.rb +26 -26
- data/spec/scss_lint/linter/selector_depth_spec.rb +26 -26
- data/spec/scss_lint/linter/selector_format_spec.rb +114 -114
- data/spec/scss_lint/linter/shorthand_spec.rb +32 -32
- data/spec/scss_lint/linter/single_line_per_property_spec.rb +10 -10
- data/spec/scss_lint/linter/single_line_per_selector_spec.rb +24 -24
- data/spec/scss_lint/linter/space_after_comma_spec.rb +60 -60
- data/spec/scss_lint/linter/space_after_property_colon_spec.rb +44 -44
- data/spec/scss_lint/linter/space_after_property_name_spec.rb +6 -6
- data/spec/scss_lint/linter/space_before_brace_spec.rb +119 -119
- data/spec/scss_lint/linter/space_between_parens_spec.rb +48 -48
- data/spec/scss_lint/linter/string_quotes_spec.rb +74 -62
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +53 -54
- data/spec/scss_lint/linter/trailing_zero_spec.rb +34 -34
- data/spec/scss_lint/linter/unnecessary_mantissa_spec.rb +10 -10
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +18 -18
- data/spec/scss_lint/linter/url_format_spec.rb +4 -4
- data/spec/scss_lint/linter/url_quotes_spec.rb +14 -14
- data/spec/scss_lint/linter/variable_for_property_spec.rb +115 -0
- data/spec/scss_lint/linter/vendor_prefixes_spec.rb +66 -56
- data/spec/scss_lint/linter/zero_unit_spec.rb +22 -22
- data/spec/scss_lint/linter_spec.rb +72 -28
- data/spec/scss_lint/runner_spec.rb +0 -1
- data/spec/scss_lint/selector_visitor_spec.rb +23 -23
- data/spec/spec_helper.rb +2 -2
- metadata +27 -12
@@ -7,64 +7,64 @@ describe SCSSLint::Linter::SpaceAfterPropertyColon do
|
|
7
7
|
let(:style) { 'one_space' }
|
8
8
|
|
9
9
|
context 'when the colon after a property is not followed by space' do
|
10
|
-
let(:
|
10
|
+
let(:scss) { <<-SCSS }
|
11
11
|
p {
|
12
12
|
margin:0;
|
13
13
|
}
|
14
|
-
|
14
|
+
SCSS
|
15
15
|
|
16
16
|
it { should report_lint line: 2 }
|
17
17
|
end
|
18
18
|
|
19
19
|
context 'when colon after property is not followed by space and the semicolon is missing' do
|
20
|
-
let(:
|
20
|
+
let(:scss) { <<-SCSS }
|
21
21
|
p {
|
22
22
|
color:#eee
|
23
23
|
}
|
24
|
-
|
24
|
+
SCSS
|
25
25
|
|
26
26
|
it { should report_lint line: 2 }
|
27
27
|
end
|
28
28
|
|
29
29
|
context 'when the colon after a property is followed by a space' do
|
30
|
-
let(:
|
30
|
+
let(:scss) { <<-SCSS }
|
31
31
|
p {
|
32
32
|
margin: 0;
|
33
33
|
}
|
34
|
-
|
34
|
+
SCSS
|
35
35
|
|
36
36
|
it { should_not report_lint }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when the colon after a property is surrounded by spaces' do
|
40
|
-
let(:
|
40
|
+
let(:scss) { <<-SCSS }
|
41
41
|
p {
|
42
42
|
margin : bold;
|
43
43
|
}
|
44
|
-
|
44
|
+
SCSS
|
45
45
|
|
46
46
|
it { should_not report_lint }
|
47
47
|
end
|
48
48
|
|
49
49
|
context 'when the colon after a property is followed by multiple spaces' do
|
50
|
-
let(:
|
50
|
+
let(:scss) { <<-SCSS }
|
51
51
|
p {
|
52
52
|
margin: bold;
|
53
53
|
}
|
54
|
-
|
54
|
+
SCSS
|
55
55
|
|
56
56
|
it { should report_lint line: 2 }
|
57
57
|
end
|
58
58
|
|
59
59
|
context 'when interpolation within single quotes is followed by inline property' do
|
60
60
|
context 'and property name is followed by a space' do
|
61
|
-
let(:
|
61
|
+
let(:scss) { "[class~='\#{$test}'] { width: 100%; }" }
|
62
62
|
|
63
63
|
it { should_not report_lint }
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'and property name is not followed by a space' do
|
67
|
-
let(:
|
67
|
+
let(:scss) { "[class~='\#{$test}'] { width:100%; }" }
|
68
68
|
|
69
69
|
it { should report_lint }
|
70
70
|
end
|
@@ -75,51 +75,51 @@ describe SCSSLint::Linter::SpaceAfterPropertyColon do
|
|
75
75
|
let(:style) { 'no_space' }
|
76
76
|
|
77
77
|
context 'when the colon after a property is not followed by space' do
|
78
|
-
let(:
|
78
|
+
let(:scss) { <<-SCSS }
|
79
79
|
p {
|
80
80
|
margin:0;
|
81
81
|
}
|
82
|
-
|
82
|
+
SCSS
|
83
83
|
|
84
84
|
it { should_not report_lint }
|
85
85
|
end
|
86
86
|
|
87
87
|
context 'when colon after property is not followed by space and the semicolon is missing' do
|
88
|
-
let(:
|
88
|
+
let(:scss) { <<-SCSS }
|
89
89
|
p {
|
90
90
|
color:#eee
|
91
91
|
}
|
92
|
-
|
92
|
+
SCSS
|
93
93
|
|
94
94
|
it { should_not report_lint }
|
95
95
|
end
|
96
96
|
|
97
97
|
context 'when the colon after a property is followed by a space' do
|
98
|
-
let(:
|
98
|
+
let(:scss) { <<-SCSS }
|
99
99
|
p {
|
100
100
|
margin: 0;
|
101
101
|
}
|
102
|
-
|
102
|
+
SCSS
|
103
103
|
|
104
104
|
it { should report_lint line: 2 }
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'when the colon after a property is surrounded by spaces' do
|
108
|
-
let(:
|
108
|
+
let(:scss) { <<-SCSS }
|
109
109
|
p {
|
110
110
|
margin : bold;
|
111
111
|
}
|
112
|
-
|
112
|
+
SCSS
|
113
113
|
|
114
114
|
it { should report_lint line: 2 }
|
115
115
|
end
|
116
116
|
|
117
117
|
context 'when the colon after a property is followed by multiple spaces' do
|
118
|
-
let(:
|
118
|
+
let(:scss) { <<-SCSS }
|
119
119
|
p {
|
120
120
|
margin: bold;
|
121
121
|
}
|
122
|
-
|
122
|
+
SCSS
|
123
123
|
|
124
124
|
it { should report_lint line: 2 }
|
125
125
|
end
|
@@ -129,51 +129,51 @@ describe SCSSLint::Linter::SpaceAfterPropertyColon do
|
|
129
129
|
let(:style) { 'at_least_one_space' }
|
130
130
|
|
131
131
|
context 'when the colon after a property is not followed by space' do
|
132
|
-
let(:
|
132
|
+
let(:scss) { <<-SCSS }
|
133
133
|
p {
|
134
134
|
margin:0;
|
135
135
|
}
|
136
|
-
|
136
|
+
SCSS
|
137
137
|
|
138
138
|
it { should report_lint line: 2 }
|
139
139
|
end
|
140
140
|
|
141
141
|
context 'when colon after property is not followed by space and the semicolon is missing' do
|
142
|
-
let(:
|
142
|
+
let(:scss) { <<-SCSS }
|
143
143
|
p {
|
144
144
|
color:#eee
|
145
145
|
}
|
146
|
-
|
146
|
+
SCSS
|
147
147
|
|
148
148
|
it { should report_lint line: 2 }
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'when the colon after a property is followed by a space' do
|
152
|
-
let(:
|
152
|
+
let(:scss) { <<-SCSS }
|
153
153
|
p {
|
154
154
|
margin: 0;
|
155
155
|
}
|
156
|
-
|
156
|
+
SCSS
|
157
157
|
|
158
158
|
it { should_not report_lint }
|
159
159
|
end
|
160
160
|
|
161
161
|
context 'when the colon after a property is surrounded by spaces' do
|
162
|
-
let(:
|
162
|
+
let(:scss) { <<-SCSS }
|
163
163
|
p {
|
164
164
|
margin : bold;
|
165
165
|
}
|
166
|
-
|
166
|
+
SCSS
|
167
167
|
|
168
168
|
it { should_not report_lint }
|
169
169
|
end
|
170
170
|
|
171
171
|
context 'when the colon after a property is followed by multiple spaces' do
|
172
|
-
let(:
|
172
|
+
let(:scss) { <<-SCSS }
|
173
173
|
p {
|
174
174
|
margin: bold;
|
175
175
|
}
|
176
|
-
|
176
|
+
SCSS
|
177
177
|
|
178
178
|
it { should_not report_lint }
|
179
179
|
end
|
@@ -183,68 +183,68 @@ describe SCSSLint::Linter::SpaceAfterPropertyColon do
|
|
183
183
|
let(:style) { 'aligned' }
|
184
184
|
|
185
185
|
context 'when the colon after a single property is not followed by space' do
|
186
|
-
let(:
|
186
|
+
let(:scss) { <<-SCSS }
|
187
187
|
p {
|
188
188
|
margin:0;
|
189
189
|
}
|
190
|
-
|
190
|
+
SCSS
|
191
191
|
|
192
192
|
it { should_not report_lint }
|
193
193
|
end
|
194
194
|
|
195
195
|
context 'when the colon after a single property is followed by a space' do
|
196
|
-
let(:
|
196
|
+
let(:scss) { <<-SCSS }
|
197
197
|
p {
|
198
198
|
margin: 0;
|
199
199
|
}
|
200
|
-
|
200
|
+
SCSS
|
201
201
|
|
202
202
|
it { should_not report_lint }
|
203
203
|
end
|
204
204
|
|
205
205
|
context 'when properties are not aligned' do
|
206
|
-
let(:
|
206
|
+
let(:scss) { <<-SCSS }
|
207
207
|
p {
|
208
208
|
content: 'hello';
|
209
209
|
margin: 0;
|
210
210
|
padding: 0;
|
211
211
|
}
|
212
|
-
|
212
|
+
SCSS
|
213
213
|
|
214
214
|
it { should report_lint line: 2 }
|
215
215
|
end
|
216
216
|
|
217
217
|
context 'when properties aligned but the names are not' do
|
218
|
-
let(:
|
218
|
+
let(:scss) { <<-SCSS }
|
219
219
|
p {
|
220
220
|
content: 'hello';
|
221
221
|
margin: 0;
|
222
222
|
padding: 0;
|
223
223
|
}
|
224
|
-
|
224
|
+
SCSS
|
225
225
|
|
226
226
|
it { should_not report_lint }
|
227
227
|
end
|
228
228
|
|
229
229
|
context 'when properties aligned but the names with spaces are not' do
|
230
|
-
let(:
|
230
|
+
let(:scss) { <<-SCSS }
|
231
231
|
p {
|
232
232
|
content : 'hello';
|
233
233
|
margin : 0;
|
234
234
|
padding : 0;
|
235
235
|
}
|
236
|
-
|
236
|
+
SCSS
|
237
237
|
|
238
238
|
it { should_not report_lint }
|
239
239
|
end
|
240
240
|
|
241
241
|
context 'when properties are aligned' do
|
242
|
-
let(:
|
242
|
+
let(:scss) { <<-SCSS }
|
243
243
|
p {
|
244
244
|
margin: 0;
|
245
245
|
padding: 0;
|
246
246
|
}
|
247
|
-
|
247
|
+
SCSS
|
248
248
|
|
249
249
|
it { should_not report_lint }
|
250
250
|
end
|
@@ -2,34 +2,34 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::SpaceAfterPropertyName do
|
4
4
|
context 'when a property name is followed by a space' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
margin : 0;
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should report_lint line: 2 }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when a property name is not followed by a space' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
p {
|
17
17
|
margin: 0;
|
18
18
|
}
|
19
|
-
|
19
|
+
SCSS
|
20
20
|
|
21
21
|
it { should_not report_lint }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'when interpolation within single quotes is followed by inline property' do
|
25
25
|
context 'and property name is followed by a space' do
|
26
|
-
let(:
|
26
|
+
let(:scss) { "[class~='\#{$test}'] { width: 100%; }" }
|
27
27
|
|
28
28
|
it { should_not report_lint }
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'and property name is not followed by a space' do
|
32
|
-
let(:
|
32
|
+
let(:scss) { "[class~='\#{$test}'] { width : 100%; }" }
|
33
33
|
|
34
34
|
it { should report_lint }
|
35
35
|
end
|
@@ -3,12 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe SCSSLint::Linter::SpaceBeforeBrace do
|
4
4
|
context 'with a @at-root block' do
|
5
5
|
context 'when brace is preceded by a space' do
|
6
|
-
let(:
|
6
|
+
let(:scss) { <<-SCSS }
|
7
7
|
.parent {
|
8
8
|
@at-root .child {
|
9
9
|
}
|
10
10
|
}
|
11
|
-
|
11
|
+
SCSS
|
12
12
|
|
13
13
|
it { should_not report_lint }
|
14
14
|
|
@@ -21,36 +21,36 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when brace is preceded by multiple spaces' do
|
24
|
-
let(:
|
24
|
+
let(:scss) { <<-SCSS }
|
25
25
|
.parent {
|
26
26
|
@at-root .child {
|
27
27
|
}
|
28
28
|
}
|
29
|
-
|
29
|
+
SCSS
|
30
30
|
|
31
31
|
it { should report_lint line: 2 }
|
32
32
|
end
|
33
33
|
|
34
34
|
context 'when brace is not preceded by a space' do
|
35
|
-
let(:
|
35
|
+
let(:scss) { <<-SCSS }
|
36
36
|
.parent {
|
37
37
|
@at-root .child{
|
38
38
|
}
|
39
39
|
}
|
40
|
-
|
40
|
+
SCSS
|
41
41
|
|
42
42
|
it { should report_lint line: 2 }
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'when brace is preceded by a new line' do
|
46
|
-
let(:
|
46
|
+
let(:scss) { <<-SCSS }
|
47
47
|
.parent
|
48
48
|
{
|
49
49
|
@at-root .child
|
50
50
|
{
|
51
51
|
}
|
52
52
|
}
|
53
|
-
|
53
|
+
SCSS
|
54
54
|
|
55
55
|
it { should report_lint line: 2 }
|
56
56
|
it { should report_lint line: 4 }
|
@@ -65,10 +65,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
65
65
|
|
66
66
|
context 'with an @each block' do
|
67
67
|
context 'when brace is preceded by a space' do
|
68
|
-
let(:
|
68
|
+
let(:scss) { <<-SCSS }
|
69
69
|
@each $item in $list {
|
70
70
|
}
|
71
|
-
|
71
|
+
SCSS
|
72
72
|
|
73
73
|
it { should_not report_lint }
|
74
74
|
|
@@ -80,29 +80,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
context 'when brace is preceded by multiple spaces' do
|
83
|
-
let(:
|
83
|
+
let(:scss) { <<-SCSS }
|
84
84
|
@each $item in $list {
|
85
85
|
}
|
86
|
-
|
86
|
+
SCSS
|
87
87
|
|
88
88
|
it { should report_lint line: 1 }
|
89
89
|
end
|
90
90
|
|
91
91
|
context 'when brace is not preceded by a space' do
|
92
|
-
let(:
|
92
|
+
let(:scss) { <<-SCSS }
|
93
93
|
@each $item in $list{
|
94
94
|
}
|
95
|
-
|
95
|
+
SCSS
|
96
96
|
|
97
97
|
it { should report_lint line: 1 }
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'when brace is preceded by a new line' do
|
101
|
-
let(:
|
101
|
+
let(:scss) { <<-SCSS }
|
102
102
|
@each $item in $list
|
103
103
|
{
|
104
104
|
}
|
105
|
-
|
105
|
+
SCSS
|
106
106
|
|
107
107
|
it { should report_lint line: 2 }
|
108
108
|
|
@@ -116,10 +116,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
116
116
|
|
117
117
|
context 'with a @for block' do
|
118
118
|
context 'when brace is preceded by a space' do
|
119
|
-
let(:
|
119
|
+
let(:scss) { <<-SCSS }
|
120
120
|
@for $i from $start to $end {
|
121
121
|
}
|
122
|
-
|
122
|
+
SCSS
|
123
123
|
|
124
124
|
it { should_not report_lint }
|
125
125
|
|
@@ -131,29 +131,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
context 'when brace is preceded by multiple spaces' do
|
134
|
-
let(:
|
134
|
+
let(:scss) { <<-SCSS }
|
135
135
|
@for $i from $start to $end {
|
136
136
|
}
|
137
|
-
|
137
|
+
SCSS
|
138
138
|
|
139
139
|
it { should report_lint line: 1 }
|
140
140
|
end
|
141
141
|
|
142
142
|
context 'when brace is not preceded by a space' do
|
143
|
-
let(:
|
143
|
+
let(:scss) { <<-SCSS }
|
144
144
|
@for $i from $start to $end{
|
145
145
|
}
|
146
|
-
|
146
|
+
SCSS
|
147
147
|
|
148
148
|
it { should report_lint line: 1 }
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'when brace is preceded by a new line' do
|
152
|
-
let(:
|
152
|
+
let(:scss) { <<-SCSS }
|
153
153
|
@for $i from $start to $end
|
154
154
|
{
|
155
155
|
}
|
156
|
-
|
156
|
+
SCSS
|
157
157
|
|
158
158
|
it { should report_lint line: 2 }
|
159
159
|
|
@@ -167,10 +167,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
167
167
|
|
168
168
|
context 'with a @while block' do
|
169
169
|
context 'when brace is preceded by a space' do
|
170
|
-
let(:
|
170
|
+
let(:scss) { <<-SCSS }
|
171
171
|
@while $condition {
|
172
172
|
}
|
173
|
-
|
173
|
+
SCSS
|
174
174
|
|
175
175
|
it { should_not report_lint }
|
176
176
|
|
@@ -182,29 +182,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
182
182
|
end
|
183
183
|
|
184
184
|
context 'when brace is preceded by multiple spaces' do
|
185
|
-
let(:
|
185
|
+
let(:scss) { <<-SCSS }
|
186
186
|
@while $condition {
|
187
187
|
}
|
188
|
-
|
188
|
+
SCSS
|
189
189
|
|
190
190
|
it { should report_lint line: 1 }
|
191
191
|
end
|
192
192
|
|
193
193
|
context 'when brace is not preceded by a space' do
|
194
|
-
let(:
|
194
|
+
let(:scss) { <<-SCSS }
|
195
195
|
@while $condition{
|
196
196
|
}
|
197
|
-
|
197
|
+
SCSS
|
198
198
|
|
199
199
|
it { should report_lint line: 1 }
|
200
200
|
end
|
201
201
|
|
202
202
|
context 'when brace is preceded by a new line' do
|
203
|
-
let(:
|
203
|
+
let(:scss) { <<-SCSS }
|
204
204
|
@while $condition
|
205
205
|
{
|
206
206
|
}
|
207
|
-
|
207
|
+
SCSS
|
208
208
|
|
209
209
|
it { should report_lint line: 2 }
|
210
210
|
|
@@ -218,10 +218,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
218
218
|
|
219
219
|
context 'with a rule selector' do
|
220
220
|
context 'when brace is preceded by a space' do
|
221
|
-
let(:
|
221
|
+
let(:scss) { <<-SCSS }
|
222
222
|
p {
|
223
223
|
}
|
224
|
-
|
224
|
+
SCSS
|
225
225
|
|
226
226
|
it { should_not report_lint }
|
227
227
|
|
@@ -233,48 +233,48 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
233
233
|
end
|
234
234
|
|
235
235
|
context 'when brace is preceded by multiple spaces' do
|
236
|
-
let(:
|
236
|
+
let(:scss) { <<-SCSS }
|
237
237
|
p {
|
238
238
|
}
|
239
|
-
|
239
|
+
SCSS
|
240
240
|
|
241
241
|
it { should report_lint line: 1 }
|
242
242
|
end
|
243
243
|
|
244
244
|
context 'when brace is not preceded by a space' do
|
245
|
-
let(:
|
245
|
+
let(:scss) { <<-SCSS }
|
246
246
|
p{
|
247
247
|
}
|
248
|
-
|
248
|
+
SCSS
|
249
249
|
|
250
250
|
it { should report_lint line: 1 }
|
251
251
|
end
|
252
252
|
|
253
253
|
context 'when brace is in a single line rule set' do
|
254
|
-
let(:
|
254
|
+
let(:scss) { <<-SCSS }
|
255
255
|
.single-line-selector{color: #f00;}
|
256
|
-
|
256
|
+
SCSS
|
257
257
|
|
258
258
|
it { should report_lint line: 1 }
|
259
259
|
end
|
260
260
|
|
261
261
|
context 'when brace is following a multi-selector rule set' do
|
262
|
-
let(:
|
262
|
+
let(:scss) { <<-SCSS }
|
263
263
|
.selector1,
|
264
264
|
.selector2,
|
265
265
|
.selector3{
|
266
266
|
}
|
267
|
-
|
267
|
+
SCSS
|
268
268
|
|
269
269
|
it { should report_lint line: 3 }
|
270
270
|
end
|
271
271
|
|
272
272
|
context 'when brace is preceded by a new line' do
|
273
|
-
let(:
|
273
|
+
let(:scss) { <<-SCSS }
|
274
274
|
p
|
275
275
|
{
|
276
276
|
}
|
277
|
-
|
277
|
+
SCSS
|
278
278
|
|
279
279
|
it { should report_lint line: 2 }
|
280
280
|
|
@@ -289,10 +289,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
289
289
|
context 'with a function declaration' do
|
290
290
|
context 'with arguments' do
|
291
291
|
context 'when brace is preceded by a space' do
|
292
|
-
let(:
|
292
|
+
let(:scss) { <<-SCSS }
|
293
293
|
@function func($arg, $arg2) {
|
294
294
|
}
|
295
|
-
|
295
|
+
SCSS
|
296
296
|
|
297
297
|
it { should_not report_lint }
|
298
298
|
|
@@ -304,29 +304,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
304
304
|
end
|
305
305
|
|
306
306
|
context 'when brace is preceded by multiple spaces' do
|
307
|
-
let(:
|
307
|
+
let(:scss) { <<-SCSS }
|
308
308
|
@function func($arg, $arg2) {
|
309
309
|
}
|
310
|
-
|
310
|
+
SCSS
|
311
311
|
|
312
312
|
it { should report_lint line: 1 }
|
313
313
|
end
|
314
314
|
|
315
315
|
context 'when brace is not preceded by a space' do
|
316
|
-
let(:
|
316
|
+
let(:scss) { <<-SCSS }
|
317
317
|
@function func($arg, $arg2){
|
318
318
|
}
|
319
|
-
|
319
|
+
SCSS
|
320
320
|
|
321
321
|
it { should report_lint line: 1 }
|
322
322
|
end
|
323
323
|
|
324
324
|
context 'when brace is preceded by a new line' do
|
325
|
-
let(:
|
325
|
+
let(:scss) { <<-SCSS }
|
326
326
|
@function func($arg, $arg2)
|
327
327
|
{
|
328
328
|
}
|
329
|
-
|
329
|
+
SCSS
|
330
330
|
|
331
331
|
it { should report_lint line: 2 }
|
332
332
|
|
@@ -340,10 +340,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
340
340
|
|
341
341
|
context 'without arguments' do
|
342
342
|
context 'when brace is preceded by a space' do
|
343
|
-
let(:
|
343
|
+
let(:scss) { <<-SCSS }
|
344
344
|
@function func() {
|
345
345
|
}
|
346
|
-
|
346
|
+
SCSS
|
347
347
|
|
348
348
|
it { should_not report_lint }
|
349
349
|
|
@@ -355,29 +355,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
355
355
|
end
|
356
356
|
|
357
357
|
context 'when brace is preceded by multiple spaces' do
|
358
|
-
let(:
|
358
|
+
let(:scss) { <<-SCSS }
|
359
359
|
@function func() {
|
360
360
|
}
|
361
|
-
|
361
|
+
SCSS
|
362
362
|
|
363
363
|
it { should report_lint line: 1 }
|
364
364
|
end
|
365
365
|
|
366
366
|
context 'when brace is not preceded by a space' do
|
367
|
-
let(:
|
367
|
+
let(:scss) { <<-SCSS }
|
368
368
|
@function func(){
|
369
369
|
}
|
370
|
-
|
370
|
+
SCSS
|
371
371
|
|
372
372
|
it { should report_lint line: 1 }
|
373
373
|
end
|
374
374
|
|
375
375
|
context 'when brace is preceded by a new line' do
|
376
|
-
let(:
|
376
|
+
let(:scss) { <<-SCSS }
|
377
377
|
@function func()
|
378
378
|
{
|
379
379
|
}
|
380
|
-
|
380
|
+
SCSS
|
381
381
|
|
382
382
|
it { should report_lint line: 2 }
|
383
383
|
|
@@ -393,10 +393,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
393
393
|
context 'with a mixin declaration' do
|
394
394
|
context 'with arguments' do
|
395
395
|
context 'when brace is preceded by a space' do
|
396
|
-
let(:
|
396
|
+
let(:scss) { <<-SCSS }
|
397
397
|
@mixin mixin($arg, $arg2) {
|
398
398
|
}
|
399
|
-
|
399
|
+
SCSS
|
400
400
|
|
401
401
|
it { should_not report_lint }
|
402
402
|
|
@@ -408,29 +408,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
408
408
|
end
|
409
409
|
|
410
410
|
context 'when brace is preceded by multiple spaces' do
|
411
|
-
let(:
|
411
|
+
let(:scss) { <<-SCSS }
|
412
412
|
@mixin mixin($arg, $arg2) {
|
413
413
|
}
|
414
|
-
|
414
|
+
SCSS
|
415
415
|
|
416
416
|
it { should report_lint line: 1 }
|
417
417
|
end
|
418
418
|
|
419
419
|
context 'when brace is not preceded by a space' do
|
420
|
-
let(:
|
420
|
+
let(:scss) { <<-SCSS }
|
421
421
|
@mixin mixin($arg, $arg2){
|
422
422
|
}
|
423
|
-
|
423
|
+
SCSS
|
424
424
|
|
425
425
|
it { should report_lint line: 1 }
|
426
426
|
end
|
427
427
|
|
428
428
|
context 'when brace is preceded by a new line' do
|
429
|
-
let(:
|
429
|
+
let(:scss) { <<-SCSS }
|
430
430
|
@mixin mixin($arg, $arg2)
|
431
431
|
{
|
432
432
|
}
|
433
|
-
|
433
|
+
SCSS
|
434
434
|
|
435
435
|
it { should report_lint line: 2 }
|
436
436
|
|
@@ -444,10 +444,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
444
444
|
|
445
445
|
context 'without arguments' do
|
446
446
|
context 'when brace is preceded by a space' do
|
447
|
-
let(:
|
447
|
+
let(:scss) { <<-SCSS }
|
448
448
|
@mixin mixin {
|
449
449
|
}
|
450
|
-
|
450
|
+
SCSS
|
451
451
|
|
452
452
|
it { should_not report_lint }
|
453
453
|
|
@@ -459,29 +459,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
459
459
|
end
|
460
460
|
|
461
461
|
context 'when brace is preceded by multiple spaces' do
|
462
|
-
let(:
|
462
|
+
let(:scss) { <<-SCSS }
|
463
463
|
@mixin mixin {
|
464
464
|
}
|
465
|
-
|
465
|
+
SCSS
|
466
466
|
|
467
467
|
it { should report_lint line: 1 }
|
468
468
|
end
|
469
469
|
|
470
470
|
context 'when brace is not preceded by a space' do
|
471
|
-
let(:
|
471
|
+
let(:scss) { <<-SCSS }
|
472
472
|
@mixin mixin{
|
473
473
|
}
|
474
|
-
|
474
|
+
SCSS
|
475
475
|
|
476
476
|
it { should report_lint line: 1 }
|
477
477
|
end
|
478
478
|
|
479
479
|
context 'when brace is preceded by a new line' do
|
480
|
-
let(:
|
480
|
+
let(:scss) { <<-SCSS }
|
481
481
|
@mixin mixin
|
482
482
|
{
|
483
483
|
}
|
484
|
-
|
484
|
+
SCSS
|
485
485
|
|
486
486
|
it { should report_lint line: 2 }
|
487
487
|
|
@@ -497,10 +497,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
497
497
|
context 'with a mixin include with braces' do
|
498
498
|
context 'with arguments' do
|
499
499
|
context 'when brace is preceded by a space' do
|
500
|
-
let(:
|
500
|
+
let(:scss) { <<-SCSS }
|
501
501
|
@include mixin(arg, arg2) {
|
502
502
|
}
|
503
|
-
|
503
|
+
SCSS
|
504
504
|
|
505
505
|
it { should_not report_lint }
|
506
506
|
|
@@ -512,29 +512,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
512
512
|
end
|
513
513
|
|
514
514
|
context 'when brace is preceded by multiple spaces' do
|
515
|
-
let(:
|
515
|
+
let(:scss) { <<-SCSS }
|
516
516
|
@include mixin(arg, arg2) {
|
517
517
|
}
|
518
|
-
|
518
|
+
SCSS
|
519
519
|
|
520
520
|
it { should report_lint line: 1 }
|
521
521
|
end
|
522
522
|
|
523
523
|
context 'when brace is not preceded by a space' do
|
524
|
-
let(:
|
524
|
+
let(:scss) { <<-SCSS }
|
525
525
|
@include mixin(arg, arg2){
|
526
526
|
}
|
527
|
-
|
527
|
+
SCSS
|
528
528
|
|
529
529
|
it { should report_lint line: 1 }
|
530
530
|
end
|
531
531
|
|
532
532
|
context 'when brace is preceded by a new line' do
|
533
|
-
let(:
|
533
|
+
let(:scss) { <<-SCSS }
|
534
534
|
@include mixin(arg, arg2)
|
535
535
|
{
|
536
536
|
}
|
537
|
-
|
537
|
+
SCSS
|
538
538
|
|
539
539
|
it { should report_lint line: 2 }
|
540
540
|
|
@@ -548,10 +548,10 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
548
548
|
|
549
549
|
context 'without arguments' do
|
550
550
|
context 'when brace is preceded by a space' do
|
551
|
-
let(:
|
551
|
+
let(:scss) { <<-SCSS }
|
552
552
|
@include mixin {
|
553
553
|
}
|
554
|
-
|
554
|
+
SCSS
|
555
555
|
|
556
556
|
it { should_not report_lint }
|
557
557
|
|
@@ -563,29 +563,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
563
563
|
end
|
564
564
|
|
565
565
|
context 'when brace is preceded by multiple spaces' do
|
566
|
-
let(:
|
566
|
+
let(:scss) { <<-SCSS }
|
567
567
|
@include mixin {
|
568
568
|
}
|
569
|
-
|
569
|
+
SCSS
|
570
570
|
|
571
571
|
it { should report_lint line: 1 }
|
572
572
|
end
|
573
573
|
|
574
574
|
context 'when brace is not preceded by a space' do
|
575
|
-
let(:
|
575
|
+
let(:scss) { <<-SCSS }
|
576
576
|
@include mixin{
|
577
577
|
}
|
578
|
-
|
578
|
+
SCSS
|
579
579
|
|
580
580
|
it { should report_lint line: 1 }
|
581
581
|
end
|
582
582
|
|
583
583
|
context 'when brace is preceded by a new line' do
|
584
|
-
let(:
|
584
|
+
let(:scss) { <<-SCSS }
|
585
585
|
@include mixin
|
586
586
|
{
|
587
587
|
}
|
588
|
-
|
588
|
+
SCSS
|
589
589
|
|
590
590
|
it { should report_lint line: 2 }
|
591
591
|
|
@@ -600,9 +600,9 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
600
600
|
|
601
601
|
context 'with a mixin include with no braces' do
|
602
602
|
context 'with arguments' do
|
603
|
-
let(:
|
603
|
+
let(:scss) { <<-SCSS }
|
604
604
|
@include mixin(arg, arg2);
|
605
|
-
|
605
|
+
SCSS
|
606
606
|
|
607
607
|
it { should_not report_lint }
|
608
608
|
|
@@ -614,9 +614,9 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
614
614
|
end
|
615
615
|
|
616
616
|
context 'without arguments' do
|
617
|
-
let(:
|
617
|
+
let(:scss) { <<-SCSS }
|
618
618
|
@include mixin;
|
619
|
-
|
619
|
+
SCSS
|
620
620
|
|
621
621
|
it { should_not report_lint }
|
622
622
|
|
@@ -630,11 +630,11 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
630
630
|
|
631
631
|
context 'when curly brace appears in a string' do
|
632
632
|
context 'and the `style` option is `space`' do
|
633
|
-
let(:
|
633
|
+
let(:scss) { <<-SCSS }
|
634
634
|
a {
|
635
635
|
content: "{";
|
636
636
|
}
|
637
|
-
|
637
|
+
SCSS
|
638
638
|
|
639
639
|
it { should_not report_lint }
|
640
640
|
end
|
@@ -642,12 +642,12 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
642
642
|
context 'and the `style` option is `new_line`' do
|
643
643
|
let(:linter_config) { { 'style' => 'new_line' } }
|
644
644
|
|
645
|
-
let(:
|
645
|
+
let(:scss) { <<-SCSS }
|
646
646
|
a
|
647
647
|
{
|
648
648
|
content: "{";
|
649
649
|
}
|
650
|
-
|
650
|
+
SCSS
|
651
651
|
|
652
652
|
it { should_not report_lint }
|
653
653
|
end
|
@@ -655,13 +655,13 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
655
655
|
|
656
656
|
context 'when using #{} interpolation' do
|
657
657
|
context 'and the `style` option is `space`' do
|
658
|
-
let(:
|
658
|
+
let(:scss) { <<-SCSS }
|
659
659
|
@mixin test-mixin($class, $prop, $pixels) {
|
660
660
|
.\#{$class} {
|
661
661
|
\#{$prop}: \#{$pixels}px;
|
662
662
|
}
|
663
663
|
}
|
664
|
-
|
664
|
+
SCSS
|
665
665
|
|
666
666
|
it { should_not report_lint }
|
667
667
|
end
|
@@ -669,7 +669,7 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
669
669
|
context 'and the `style` option is `new_line`' do
|
670
670
|
let(:linter_config) { { 'style' => 'new_line' } }
|
671
671
|
|
672
|
-
let(:
|
672
|
+
let(:scss) { <<-SCSS }
|
673
673
|
@mixin test-mixin($class, $prop, $pixels)
|
674
674
|
{
|
675
675
|
.\#{$class}
|
@@ -677,14 +677,14 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
677
677
|
\#{$prop}: \#{$pixels}px;
|
678
678
|
}
|
679
679
|
}
|
680
|
-
|
680
|
+
SCSS
|
681
681
|
|
682
682
|
it { should_not report_lint }
|
683
683
|
end
|
684
684
|
end
|
685
685
|
|
686
686
|
context 'when using braces in comments' do
|
687
|
-
let(:
|
687
|
+
let(:scss) { '// ({x})' }
|
688
688
|
|
689
689
|
it { should_not report_lint }
|
690
690
|
|
@@ -703,12 +703,12 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
703
703
|
}
|
704
704
|
end
|
705
705
|
|
706
|
-
let(:
|
706
|
+
let(:scss) { <<-SCSS }
|
707
707
|
p{ }
|
708
708
|
p { }
|
709
709
|
p { &:before { } }
|
710
710
|
p { &:before{ } }
|
711
|
-
|
711
|
+
SCSS
|
712
712
|
|
713
713
|
context 'and the `allow_single_line_padding` option is true' do
|
714
714
|
let(:allow_single_line_padding) { true }
|
@@ -750,32 +750,32 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
750
750
|
end
|
751
751
|
|
752
752
|
context 'when curly brace is in single quotes' do
|
753
|
-
let(:
|
753
|
+
let(:scss) { <<-SCSS }
|
754
754
|
@if $token == '{' {
|
755
755
|
}
|
756
|
-
|
756
|
+
SCSS
|
757
757
|
|
758
758
|
it { should_not report_lint }
|
759
759
|
|
760
760
|
context 'and the `style` option is `new_line`' do
|
761
761
|
let(:linter_config) { { 'style' => 'new_line' } }
|
762
762
|
|
763
|
-
let(:
|
763
|
+
let(:scss) { <<-SCSS }
|
764
764
|
@if $token == '{'
|
765
765
|
{
|
766
766
|
}
|
767
|
-
|
767
|
+
SCSS
|
768
768
|
|
769
769
|
it { should_not report_lint }
|
770
770
|
end
|
771
771
|
end
|
772
772
|
|
773
773
|
context 'when curly brace is on own line' do
|
774
|
-
let(:
|
774
|
+
let(:scss) { <<-SCSS }
|
775
775
|
.class
|
776
776
|
{
|
777
777
|
}
|
778
|
-
|
778
|
+
SCSS
|
779
779
|
|
780
780
|
it { should report_lint line: 2 }
|
781
781
|
|
@@ -790,25 +790,25 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
790
790
|
let(:linter_config) { { 'style' => 'new_line' } }
|
791
791
|
|
792
792
|
context 'and the curly brace is preceded by a space' do
|
793
|
-
let(:
|
793
|
+
let(:scss) { <<-SCSS }
|
794
794
|
.class {
|
795
795
|
}
|
796
|
-
|
796
|
+
SCSS
|
797
797
|
|
798
798
|
it { should report_lint line: 1 }
|
799
799
|
end
|
800
800
|
|
801
801
|
context 'and the curly brace is preceded by multiple spaces' do
|
802
|
-
let(:
|
802
|
+
let(:scss) { <<-SCSS }
|
803
803
|
.class {
|
804
804
|
}
|
805
|
-
|
805
|
+
SCSS
|
806
806
|
|
807
807
|
it { should report_lint line: 1 }
|
808
808
|
end
|
809
809
|
|
810
810
|
context 'and there are multiple levels of nesting' do
|
811
|
-
let(:
|
811
|
+
let(:scss) { <<-SCSS }
|
812
812
|
ul
|
813
813
|
{
|
814
814
|
li
|
@@ -821,7 +821,7 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
821
821
|
}
|
822
822
|
}
|
823
823
|
}
|
824
|
-
|
824
|
+
SCSS
|
825
825
|
|
826
826
|
it { should_not report_lint }
|
827
827
|
end
|