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
@@ -2,39 +2,39 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::DuplicateProperty do
|
4
4
|
context 'when rule set is empty' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
}
|
8
|
-
|
8
|
+
SCSS
|
9
9
|
|
10
10
|
it { should_not report_lint }
|
11
11
|
end
|
12
12
|
|
13
13
|
context 'when rule set contains no duplicates' do
|
14
|
-
let(:
|
14
|
+
let(:scss) { <<-SCSS }
|
15
15
|
p {
|
16
16
|
margin: 0;
|
17
17
|
padding: 0;
|
18
18
|
}
|
19
|
-
|
19
|
+
SCSS
|
20
20
|
|
21
21
|
it { should_not report_lint }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'when rule set contains duplicates' do
|
25
|
-
let(:
|
25
|
+
let(:scss) { <<-SCSS }
|
26
26
|
p {
|
27
27
|
margin: 0;
|
28
28
|
padding: 0;
|
29
29
|
margin: 1em;
|
30
30
|
}
|
31
|
-
|
31
|
+
SCSS
|
32
32
|
|
33
33
|
it { should report_lint line: 4 }
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'when rule set contains duplicates but only on vendor-prefixed property values' do
|
37
|
-
let(:
|
37
|
+
let(:scss) { <<-SCSS }
|
38
38
|
p {
|
39
39
|
background: -moz-linear-gradient(center top , #fff, #000);
|
40
40
|
background: -ms-linear-gradient(center top , #fff, #000);
|
@@ -43,59 +43,59 @@ describe SCSSLint::Linter::DuplicateProperty do
|
|
43
43
|
background: linear-gradient(center top , #fff, #000);
|
44
44
|
margin: 1em;
|
45
45
|
}
|
46
|
-
|
46
|
+
SCSS
|
47
47
|
|
48
48
|
it { should_not report_lint }
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when placeholder contains duplicates but only on vendor-prefixed values' do
|
52
|
-
let(:
|
52
|
+
let(:scss) { <<-SCSS }
|
53
53
|
%cursor-grabbing {
|
54
54
|
cursor: -moz-grabbing;
|
55
55
|
cursor: -webkit-grabbing;
|
56
56
|
cursor: grabbing;
|
57
57
|
}
|
58
|
-
|
58
|
+
SCSS
|
59
59
|
|
60
60
|
it { should_not report_lint }
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'when placeholder contains exact duplicates besides for vendor-prefixed values' do
|
64
|
-
let(:
|
64
|
+
let(:scss) { <<-SCSS }
|
65
65
|
%cursor-grabbing {
|
66
66
|
cursor: grabbing;
|
67
67
|
cursor: grabbing;
|
68
68
|
}
|
69
|
-
|
69
|
+
SCSS
|
70
70
|
|
71
71
|
it { should report_lint line: 3 }
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'when mixin contains duplicates but only on vendor-prefixed values' do
|
75
|
-
let(:
|
75
|
+
let(:scss) { <<-SCSS }
|
76
76
|
@mixin cursor-grabbing($num) {
|
77
77
|
cursor: -moz-grabbing;
|
78
78
|
cursor: -webkit-grabbing;
|
79
79
|
cursor: grabbing;
|
80
80
|
}
|
81
|
-
|
81
|
+
SCSS
|
82
82
|
|
83
83
|
it { should_not report_lint }
|
84
84
|
end
|
85
85
|
|
86
86
|
context 'when mixin contains duplicates besides for vendor-prefixed values' do
|
87
|
-
let(:
|
87
|
+
let(:scss) { <<-SCSS }
|
88
88
|
@mixin cursor-grabbing($num) {
|
89
89
|
cursor: grabbing;
|
90
90
|
cursor: grabbing;
|
91
91
|
}
|
92
|
-
|
92
|
+
SCSS
|
93
93
|
|
94
94
|
it { should report_lint line: 3 }
|
95
95
|
end
|
96
96
|
|
97
97
|
context 'when rule set contains exact duplicates besides for vendor-prefixed property values' do
|
98
|
-
let(:
|
98
|
+
let(:scss) { <<-SCSS }
|
99
99
|
p {
|
100
100
|
background: -moz-linear-gradient(center top , #fff, #000);
|
101
101
|
background: -ms-linear-gradient(center top , #fff, #000);
|
@@ -105,13 +105,13 @@ describe SCSSLint::Linter::DuplicateProperty do
|
|
105
105
|
background: linear-gradient(center top , #fff, #000);
|
106
106
|
margin: 1em;
|
107
107
|
}
|
108
|
-
|
108
|
+
SCSS
|
109
109
|
|
110
110
|
it { should report_lint line: 7 }
|
111
111
|
end
|
112
112
|
|
113
113
|
context 'when rule set contains non-exact duplicates besides for vendor-prefixed values' do
|
114
|
-
let(:
|
114
|
+
let(:scss) { <<-SCSS }
|
115
115
|
p {
|
116
116
|
background: -moz-linear-gradient(center top , #fff, #000);
|
117
117
|
background: -ms-linear-gradient(center top , #fff, #000);
|
@@ -121,68 +121,68 @@ describe SCSSLint::Linter::DuplicateProperty do
|
|
121
121
|
background: linear-gradient-b(center top , #fff, #000);
|
122
122
|
margin: 1em;
|
123
123
|
}
|
124
|
-
|
124
|
+
SCSS
|
125
125
|
|
126
126
|
it { should report_lint line: 7 }
|
127
127
|
end
|
128
128
|
|
129
129
|
context 'when rule set contains multiple duplicates' do
|
130
|
-
let(:
|
130
|
+
let(:scss) { <<-SCSS }
|
131
131
|
p {
|
132
132
|
margin: 0;
|
133
133
|
padding: 0;
|
134
134
|
margin: 1em;
|
135
135
|
margin: 2em;
|
136
136
|
}
|
137
|
-
|
137
|
+
SCSS
|
138
138
|
|
139
139
|
it { should report_lint line: 4 }
|
140
140
|
it { should report_lint line: 5 }
|
141
141
|
end
|
142
142
|
|
143
143
|
context 'when rule set contains duplicate properties with interpolation' do
|
144
|
-
let(:
|
144
|
+
let(:scss) { <<-SCSS }
|
145
145
|
p {
|
146
146
|
$direction: 'right';
|
147
147
|
margin-\#{direction}: 0;
|
148
148
|
$direction: 'left';
|
149
149
|
margin-\#{direction}: 0;
|
150
150
|
}
|
151
|
-
|
151
|
+
SCSS
|
152
152
|
|
153
153
|
it { should_not report_lint }
|
154
154
|
end
|
155
155
|
|
156
156
|
context 'when property contains a variable' do
|
157
|
-
let(:
|
157
|
+
let(:scss) { <<-SCSS }
|
158
158
|
p {
|
159
159
|
color: $some-color;
|
160
160
|
}
|
161
|
-
|
161
|
+
SCSS
|
162
162
|
|
163
163
|
it { should_not report_lint }
|
164
164
|
end
|
165
165
|
|
166
166
|
context 'when property contains a duplicate variable' do
|
167
|
-
let(:
|
167
|
+
let(:scss) { <<-SCSS }
|
168
168
|
p {
|
169
169
|
color: $some-color;
|
170
170
|
color: $some-color;
|
171
171
|
}
|
172
|
-
|
172
|
+
SCSS
|
173
173
|
|
174
174
|
it { should report_lint line: 3 }
|
175
175
|
end
|
176
176
|
|
177
177
|
context 'when property contains a duplicate value in a nested rule set' do
|
178
|
-
let(:
|
178
|
+
let(:scss) { <<-SCSS }
|
179
179
|
.outer {
|
180
180
|
.inner {
|
181
181
|
color: $some-color;
|
182
182
|
color: $some-color;
|
183
183
|
}
|
184
184
|
}
|
185
|
-
|
185
|
+
SCSS
|
186
186
|
|
187
187
|
it { should report_lint line: 4 }
|
188
188
|
end
|
@@ -2,42 +2,42 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::ElsePlacement do
|
4
4
|
context 'when @if contains no accompanying @else' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
@if $condition {
|
7
7
|
$var: 1;
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should_not report_lint }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'when @else is on different line' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
@if $condition {
|
17
17
|
$var: 1;
|
18
18
|
}
|
19
19
|
@else {
|
20
20
|
$var: 0;
|
21
21
|
}
|
22
|
-
|
22
|
+
SCSS
|
23
23
|
|
24
24
|
it { should report_lint line: 4 }
|
25
25
|
end
|
26
26
|
|
27
27
|
context 'when @else is on the same line as previous curly' do
|
28
|
-
let(:
|
28
|
+
let(:scss) { <<-SCSS }
|
29
29
|
@if $condition {
|
30
30
|
$var: 1;
|
31
31
|
} @else {
|
32
32
|
$var: 0;
|
33
33
|
}
|
34
|
-
|
34
|
+
SCSS
|
35
35
|
|
36
36
|
it { should_not report_lint }
|
37
37
|
end
|
38
38
|
|
39
39
|
context 'when `@else if` is on different line' do
|
40
|
-
let(:
|
40
|
+
let(:scss) { <<-SCSS }
|
41
41
|
@if $condition {
|
42
42
|
$var: 1;
|
43
43
|
}
|
@@ -47,14 +47,14 @@ describe SCSSLint::Linter::ElsePlacement do
|
|
47
47
|
@else {
|
48
48
|
$var: 0;
|
49
49
|
}
|
50
|
-
|
50
|
+
SCSS
|
51
51
|
|
52
52
|
it { should report_lint line: 4 }
|
53
53
|
it { should report_lint line: 7 }
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when `@else if` is on the same line as previous curly' do
|
57
|
-
let(:
|
57
|
+
let(:scss) { <<-SCSS }
|
58
58
|
@if $condition {
|
59
59
|
$var: 1;
|
60
60
|
} @else if $other_condition {
|
@@ -62,15 +62,15 @@ describe SCSSLint::Linter::ElsePlacement do
|
|
62
62
|
} @else {
|
63
63
|
$var: 0;
|
64
64
|
}
|
65
|
-
|
65
|
+
SCSS
|
66
66
|
|
67
67
|
it { should_not report_lint }
|
68
68
|
end
|
69
69
|
|
70
70
|
context 'when @else is on same line as @if' do
|
71
|
-
let(:
|
71
|
+
let(:scss) { <<-SCSS }
|
72
72
|
@if $condition { $var: 1; } @else { $var: 0; }
|
73
|
-
|
73
|
+
SCSS
|
74
74
|
|
75
75
|
it { should_not report_lint }
|
76
76
|
end
|
@@ -79,26 +79,26 @@ describe SCSSLint::Linter::ElsePlacement do
|
|
79
79
|
let(:linter_config) { { 'style' => 'new_line' } }
|
80
80
|
|
81
81
|
context 'when @else is on a new line' do
|
82
|
-
let(:
|
82
|
+
let(:scss) { <<-SCSS }
|
83
83
|
@if $condition {
|
84
84
|
$var: 1;
|
85
85
|
}
|
86
86
|
@else {
|
87
87
|
$var: 0;
|
88
88
|
}
|
89
|
-
|
89
|
+
SCSS
|
90
90
|
|
91
91
|
it { should_not report_lint }
|
92
92
|
end
|
93
93
|
|
94
94
|
context 'when @else is on the same line as previous curly brace' do
|
95
|
-
let(:
|
95
|
+
let(:scss) { <<-SCSS }
|
96
96
|
@if $condition {
|
97
97
|
$var: 1;
|
98
98
|
} @else {
|
99
99
|
$var: 0;
|
100
100
|
}
|
101
|
-
|
101
|
+
SCSS
|
102
102
|
|
103
103
|
it { should report_lint line: 3 }
|
104
104
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
4
4
|
context 'when there are multiple rule sets' do
|
5
5
|
context 'with blank lines between them' do
|
6
|
-
let(:
|
6
|
+
let(:scss) { <<-SCSS }
|
7
7
|
a {
|
8
8
|
}
|
9
9
|
|
@@ -12,20 +12,20 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
12
12
|
|
13
13
|
p {
|
14
14
|
}
|
15
|
-
|
15
|
+
SCSS
|
16
16
|
|
17
17
|
it { should_not report_lint }
|
18
18
|
end
|
19
19
|
|
20
20
|
context 'with no blank line between them' do
|
21
|
-
let(:
|
21
|
+
let(:scss) { <<-SCSS }
|
22
22
|
a {
|
23
23
|
}
|
24
24
|
b {
|
25
25
|
}
|
26
26
|
p {
|
27
27
|
}
|
28
|
-
|
28
|
+
SCSS
|
29
29
|
|
30
30
|
it { should report_lint line: 2 }
|
31
31
|
it { should report_lint line: 4 }
|
@@ -35,21 +35,21 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
35
35
|
|
36
36
|
context 'when a rule set contains nested rule sets' do
|
37
37
|
context 'and the nested rule sets have no blank line between them' do
|
38
|
-
let(:
|
38
|
+
let(:scss) { <<-SCSS }
|
39
39
|
p {
|
40
40
|
a {
|
41
41
|
}
|
42
42
|
b {
|
43
43
|
}
|
44
44
|
}
|
45
|
-
|
45
|
+
SCSS
|
46
46
|
|
47
47
|
it { should report_lint line: 3 }
|
48
48
|
it { should_not report_lint line: 5 }
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'and the nested rule sets have a blank line between them' do
|
52
|
-
let(:
|
52
|
+
let(:scss) { <<-SCSS }
|
53
53
|
p {
|
54
54
|
a {
|
55
55
|
}
|
@@ -57,32 +57,32 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
57
57
|
b {
|
58
58
|
}
|
59
59
|
}
|
60
|
-
|
60
|
+
SCSS
|
61
61
|
|
62
62
|
it { should_not report_lint }
|
63
63
|
end
|
64
64
|
|
65
65
|
context 'and the nested rule set has a property preceding it' do
|
66
|
-
let(:
|
66
|
+
let(:scss) { <<-SCSS }
|
67
67
|
p {
|
68
68
|
margin: 0;
|
69
69
|
a {
|
70
70
|
}
|
71
71
|
}
|
72
|
-
|
72
|
+
SCSS
|
73
73
|
|
74
74
|
it { should report_lint line: 3 }
|
75
75
|
end
|
76
76
|
|
77
77
|
context 'and the nested rule set has a property and empty line preceding it' do
|
78
|
-
let(:
|
78
|
+
let(:scss) { <<-SCSS }
|
79
79
|
p {
|
80
80
|
margin: 0;
|
81
81
|
|
82
82
|
a {
|
83
83
|
}
|
84
84
|
}
|
85
|
-
|
85
|
+
SCSS
|
86
86
|
|
87
87
|
it { should_not report_lint }
|
88
88
|
end
|
@@ -90,57 +90,57 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
90
90
|
|
91
91
|
context 'when mixins are defined' do
|
92
92
|
context 'and there is no blank line between them' do
|
93
|
-
let(:
|
93
|
+
let(:scss) { <<-SCSS }
|
94
94
|
@mixin mixin1() {
|
95
95
|
}
|
96
96
|
@mixin mixin2() {
|
97
97
|
}
|
98
|
-
|
98
|
+
SCSS
|
99
99
|
|
100
100
|
it { should report_lint line: 2 }
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'and there is a blank line between them' do
|
104
|
-
let(:
|
104
|
+
let(:scss) { <<-SCSS }
|
105
105
|
@mixin mixin1() {
|
106
106
|
}
|
107
107
|
|
108
108
|
@mixin mixin2() {
|
109
109
|
}
|
110
|
-
|
110
|
+
SCSS
|
111
111
|
|
112
112
|
it { should_not report_lint }
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
116
|
context 'when mixins are included without content' do
|
117
|
-
let(:
|
117
|
+
let(:scss) { <<-SCSS }
|
118
118
|
p {
|
119
119
|
@include mixin1();
|
120
120
|
property: blah;
|
121
121
|
@include mixin2(4);
|
122
122
|
}
|
123
|
-
|
123
|
+
SCSS
|
124
124
|
|
125
125
|
it { should_not report_lint }
|
126
126
|
end
|
127
127
|
|
128
128
|
context 'when mixins are included with content' do
|
129
129
|
context 'and there is no blank line between them' do
|
130
|
-
let(:
|
130
|
+
let(:scss) { <<-SCSS }
|
131
131
|
@include mixin1() {
|
132
132
|
property: value;
|
133
133
|
}
|
134
134
|
@include mixin2() {
|
135
135
|
property: value;
|
136
136
|
}
|
137
|
-
|
137
|
+
SCSS
|
138
138
|
|
139
139
|
it { should report_lint line: 3 }
|
140
140
|
end
|
141
141
|
|
142
142
|
context 'and there is a blank line between them' do
|
143
|
-
let(:
|
143
|
+
let(:scss) { <<-SCSS }
|
144
144
|
@include mixin1() {
|
145
145
|
property: value;
|
146
146
|
}
|
@@ -148,7 +148,7 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
148
148
|
@include mixin2() {
|
149
149
|
property: value;
|
150
150
|
}
|
151
|
-
|
151
|
+
SCSS
|
152
152
|
|
153
153
|
it { should_not report_lint }
|
154
154
|
end
|
@@ -156,70 +156,70 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
156
156
|
|
157
157
|
context 'when functions are defined' do
|
158
158
|
context 'and there is no blank line between them' do
|
159
|
-
let(:
|
159
|
+
let(:scss) { <<-SCSS }
|
160
160
|
@function func1() {
|
161
161
|
}
|
162
162
|
@function func2() {
|
163
163
|
}
|
164
|
-
|
164
|
+
SCSS
|
165
165
|
|
166
166
|
it { should report_lint line: 2 }
|
167
167
|
end
|
168
168
|
|
169
169
|
context 'and there is a blank line between them' do
|
170
|
-
let(:
|
170
|
+
let(:scss) { <<-SCSS }
|
171
171
|
@function func1() {
|
172
172
|
}
|
173
173
|
|
174
174
|
@function func2() {
|
175
175
|
}
|
176
|
-
|
176
|
+
SCSS
|
177
177
|
|
178
178
|
it { should_not report_lint }
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
182
|
context 'when a rule set is preceded by a comment' do
|
183
|
-
let(:
|
183
|
+
let(:scss) { <<-SCSS }
|
184
184
|
a {
|
185
185
|
}
|
186
186
|
|
187
187
|
// This is a comment
|
188
188
|
p {
|
189
189
|
}
|
190
|
-
|
190
|
+
SCSS
|
191
191
|
|
192
192
|
it { should_not report_lint }
|
193
193
|
end
|
194
194
|
|
195
195
|
context 'when a rule set is immediately followed by a comment' do
|
196
|
-
let(:
|
196
|
+
let(:scss) { <<-SCSS }
|
197
197
|
a {
|
198
198
|
} // A comment
|
199
199
|
|
200
200
|
a {
|
201
201
|
} /* Another comment */
|
202
|
-
|
202
|
+
SCSS
|
203
203
|
|
204
204
|
it { should_not report_lint }
|
205
205
|
end
|
206
206
|
|
207
207
|
context 'when rule set is followed by a comment on the next line' do
|
208
|
-
let(:
|
208
|
+
let(:scss) { <<-SCSS }
|
209
209
|
a {
|
210
210
|
}
|
211
211
|
// A trailing comment (often a control comment)
|
212
212
|
|
213
213
|
b {
|
214
214
|
}
|
215
|
-
|
215
|
+
SCSS
|
216
216
|
|
217
217
|
it { should_not report_lint }
|
218
218
|
end
|
219
219
|
|
220
220
|
context 'when there are multiple placeholder rule sets' do
|
221
221
|
context 'with blank lines between them' do
|
222
|
-
let(:
|
222
|
+
let(:scss) { <<-SCSS }
|
223
223
|
%a {
|
224
224
|
}
|
225
225
|
|
@@ -228,20 +228,20 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
228
228
|
|
229
229
|
%c {
|
230
230
|
}
|
231
|
-
|
231
|
+
SCSS
|
232
232
|
|
233
233
|
it { should_not report_lint }
|
234
234
|
end
|
235
235
|
|
236
236
|
context 'with no blank line between them' do
|
237
|
-
let(:
|
237
|
+
let(:scss) { <<-SCSS }
|
238
238
|
%a {
|
239
239
|
}
|
240
240
|
%b {
|
241
241
|
}
|
242
242
|
%c {
|
243
243
|
}
|
244
|
-
|
244
|
+
SCSS
|
245
245
|
|
246
246
|
it { should report_lint line: 2 }
|
247
247
|
it { should report_lint line: 4 }
|
@@ -252,12 +252,12 @@ describe SCSSLint::Linter::EmptyLineBetweenBlocks do
|
|
252
252
|
context 'when blocks occupy a single line' do
|
253
253
|
let(:linter_config) { { 'ignore_single_line_blocks' => ignore_single_line_blocks } }
|
254
254
|
|
255
|
-
let(:
|
255
|
+
let(:scss) { <<-SCSS }
|
256
256
|
.icon-up { &:before { content: '^'; } }
|
257
257
|
.icon-right { &:before { content: '>'; } }
|
258
258
|
@include some-mixin { content: '<'; }
|
259
259
|
@include some-other-mixin { content: 'v'; }
|
260
|
-
|
260
|
+
SCSS
|
261
261
|
|
262
262
|
context 'and the `ignore_single_line_blocks` option is true' do
|
263
263
|
let(:ignore_single_line_blocks) { true }
|