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
@@ -3,16 +3,16 @@ require 'spec_helper'
|
|
3
3
|
describe SCSSLint::Linter::Shorthand do
|
4
4
|
context 'when a rule' do
|
5
5
|
context 'is empty' do
|
6
|
-
let(:
|
6
|
+
let(:scss) { <<-SCSS }
|
7
7
|
p {
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should_not report_lint }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'contains properties with valid shorthand values' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
p {
|
17
17
|
border-radius: 1px 2px 1px 3px;
|
18
18
|
border-width: 1px;
|
@@ -20,7 +20,7 @@ describe SCSSLint::Linter::Shorthand do
|
|
20
20
|
margin: 1px 2px;
|
21
21
|
padding: 0 0 1px;
|
22
22
|
}
|
23
|
-
|
23
|
+
SCSS
|
24
24
|
|
25
25
|
it { should_not report_lint }
|
26
26
|
end
|
@@ -28,142 +28,142 @@ describe SCSSLint::Linter::Shorthand do
|
|
28
28
|
|
29
29
|
context 'when a property' do
|
30
30
|
context 'has a value repeated 4 times' do
|
31
|
-
let(:
|
31
|
+
let(:scss) { <<-SCSS }
|
32
32
|
p {
|
33
33
|
padding: 1px 1px 1px 1px;
|
34
34
|
}
|
35
|
-
|
35
|
+
SCSS
|
36
36
|
|
37
37
|
it { should report_lint line: 2 }
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'has a value repeated 3 times' do
|
41
|
-
let(:
|
41
|
+
let(:scss) { <<-SCSS }
|
42
42
|
p {
|
43
43
|
padding: 3px 3px 3px;
|
44
44
|
}
|
45
|
-
|
45
|
+
SCSS
|
46
46
|
|
47
47
|
it { should report_lint line: 2 }
|
48
48
|
end
|
49
49
|
|
50
50
|
context 'has interpolation in its name and starts with a shorthandable property' do
|
51
|
-
let(:
|
51
|
+
let(:scss) { <<-SCSS }
|
52
52
|
p {
|
53
53
|
border-color\#{$type}: 1px 1px;
|
54
54
|
}
|
55
|
-
|
55
|
+
SCSS
|
56
56
|
|
57
57
|
it { should_not report_lint }
|
58
58
|
end
|
59
59
|
|
60
60
|
context 'has exactly two identical values' do
|
61
|
-
let(:
|
61
|
+
let(:scss) { <<-SCSS }
|
62
62
|
p {
|
63
63
|
padding: 10px 10px;
|
64
64
|
}
|
65
|
-
|
65
|
+
SCSS
|
66
66
|
|
67
67
|
it { should report_lint line: 2 }
|
68
68
|
end
|
69
69
|
|
70
70
|
context 'appears to have two identical values, but cannot be shorthanded' do
|
71
|
-
let(:
|
71
|
+
let(:scss) { <<-SCSS }
|
72
72
|
p:before {
|
73
73
|
content: ' ';
|
74
74
|
}
|
75
|
-
|
75
|
+
SCSS
|
76
76
|
|
77
77
|
it { should_not report_lint }
|
78
78
|
end
|
79
79
|
|
80
80
|
context 'has its first two values repeated' do
|
81
|
-
let(:
|
81
|
+
let(:scss) { <<-SCSS }
|
82
82
|
p {
|
83
83
|
padding: 1px 2px 1px 2px;
|
84
84
|
}
|
85
|
-
|
85
|
+
SCSS
|
86
86
|
|
87
87
|
it { should report_lint line: 2 }
|
88
88
|
end
|
89
89
|
|
90
90
|
context 'has its first value repeated in the third position' do
|
91
|
-
let(:
|
91
|
+
let(:scss) { <<-SCSS }
|
92
92
|
p {
|
93
93
|
padding: 1px 2px 1px;
|
94
94
|
}
|
95
|
-
|
95
|
+
SCSS
|
96
96
|
|
97
97
|
it { should report_lint line: 2 }
|
98
98
|
end
|
99
99
|
|
100
100
|
context 'has its second value repeated in the fourth position' do
|
101
|
-
let(:
|
101
|
+
let(:scss) { <<-SCSS }
|
102
102
|
p {
|
103
103
|
padding: 1px 2px 3px 2px;
|
104
104
|
}
|
105
|
-
|
105
|
+
SCSS
|
106
106
|
|
107
107
|
it { should report_lint line: 2 }
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'contains numeric values and function calls' do
|
111
|
-
let(:
|
111
|
+
let(:scss) { <<-SCSS }
|
112
112
|
p {
|
113
113
|
margin: 10px percentage(1 / 100);
|
114
114
|
}
|
115
|
-
|
115
|
+
SCSS
|
116
116
|
|
117
117
|
it { should_not report_lint }
|
118
118
|
end
|
119
119
|
|
120
120
|
context 'contains a list of function calls that can be shortened' do
|
121
|
-
let(:
|
121
|
+
let(:scss) { <<-SCSS }
|
122
122
|
p {
|
123
123
|
margin: percentage(1 / 100) percentage(1 / 100);
|
124
124
|
}
|
125
|
-
|
125
|
+
SCSS
|
126
126
|
|
127
127
|
it { should report_lint line: 2 }
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'contains a list of function calls that cannot be shortened' do
|
131
|
-
let(:
|
131
|
+
let(:scss) { <<-SCSS }
|
132
132
|
p {
|
133
133
|
margin: percentage(1 / 100) percentage(5 / 100);
|
134
134
|
}
|
135
|
-
|
135
|
+
SCSS
|
136
136
|
|
137
137
|
it { should_not report_lint }
|
138
138
|
end
|
139
139
|
|
140
140
|
context 'contains a list of variables that can be shortened' do
|
141
|
-
let(:
|
141
|
+
let(:scss) { <<-SCSS }
|
142
142
|
p {
|
143
143
|
margin: $my-var 1px $my-var;
|
144
144
|
}
|
145
|
-
|
145
|
+
SCSS
|
146
146
|
|
147
147
|
it { should report_lint line: 2 }
|
148
148
|
end
|
149
149
|
|
150
150
|
context 'contains a number with no trailing semicolon' do
|
151
|
-
let(:
|
151
|
+
let(:scss) { <<-SCSS }
|
152
152
|
p {
|
153
153
|
margin: 4px
|
154
154
|
}
|
155
|
-
|
155
|
+
SCSS
|
156
156
|
|
157
157
|
it { should_not report_lint }
|
158
158
|
end
|
159
159
|
|
160
160
|
context 'can be shortened and is followed by !important modifier' do
|
161
|
-
let(:
|
161
|
+
let(:scss) { <<-SCSS }
|
162
162
|
p {
|
163
163
|
padding: 1px 2px 3px 2px !important;
|
164
164
|
margin: 0 0 0 0 !important; // A comment
|
165
165
|
}
|
166
|
-
|
166
|
+
SCSS
|
167
167
|
|
168
168
|
it { should report_lint line: 2 }
|
169
169
|
it { should report_lint line: 3 }
|
@@ -2,43 +2,43 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::SingleLinePerProperty do
|
4
4
|
context 'when properties are each on their own line' do
|
5
|
-
let(:
|
5
|
+
let(:scss) { <<-SCSS }
|
6
6
|
p {
|
7
7
|
color: #fff;
|
8
8
|
margin: 0;
|
9
9
|
padding: 5px;
|
10
10
|
}
|
11
|
-
|
11
|
+
SCSS
|
12
12
|
|
13
13
|
it { should_not report_lint }
|
14
14
|
end
|
15
15
|
|
16
16
|
context 'when two properties share a line' do
|
17
|
-
let(:
|
17
|
+
let(:scss) { <<-SCSS }
|
18
18
|
p {
|
19
19
|
color: #fff;
|
20
20
|
margin: 0; padding: 5px;
|
21
21
|
}
|
22
|
-
|
22
|
+
SCSS
|
23
23
|
|
24
24
|
it { should_not report_lint line: 2 }
|
25
25
|
it { should report_lint line: 3, count: 1 }
|
26
26
|
end
|
27
27
|
|
28
28
|
context 'when multiple properties share a line' do
|
29
|
-
let(:
|
29
|
+
let(:scss) { <<-SCSS }
|
30
30
|
p {
|
31
31
|
color: #fff; margin: 0; padding: 5px;
|
32
32
|
}
|
33
|
-
|
33
|
+
SCSS
|
34
34
|
|
35
35
|
it { should report_lint line: 2, count: 2 }
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when multiple properties share a line on a single line rule set' do
|
39
|
-
let(:
|
39
|
+
let(:scss) { <<-SCSS }
|
40
40
|
p { color: #fff; margin: 0; padding: 5px; }
|
41
|
-
|
41
|
+
SCSS
|
42
42
|
|
43
43
|
context 'and single line rule sets are allowed' do
|
44
44
|
let(:linter_config) { { 'allow_single_line_rule_sets' => true } }
|
@@ -54,9 +54,9 @@ describe SCSSLint::Linter::SingleLinePerProperty do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when a single line rule set contains a single property' do
|
57
|
-
let(:
|
57
|
+
let(:scss) { <<-SCSS }
|
58
58
|
p { color: #fff; }
|
59
|
-
|
59
|
+
SCSS
|
60
60
|
|
61
61
|
context 'and single line rule sets are allowed' do
|
62
62
|
let(:linter_config) { { 'allow_single_line_rule_sets' => true } }
|
@@ -2,59 +2,59 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe SCSSLint::Linter::SingleLinePerSelector do
|
4
4
|
context 'when rule has one selector' 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 has one selector on each line' do
|
14
|
-
let(:
|
14
|
+
let(:scss) { <<-SCSS }
|
15
15
|
p,
|
16
16
|
a {
|
17
17
|
}
|
18
|
-
|
18
|
+
SCSS
|
19
19
|
|
20
20
|
it { should_not report_lint }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'when rule contains multiple selectors on the same line' do
|
24
|
-
let(:
|
24
|
+
let(:scss) { <<-SCSS }
|
25
25
|
.first,
|
26
26
|
.second,
|
27
27
|
.third, .fourth,
|
28
28
|
.fifth {
|
29
29
|
}
|
30
|
-
|
30
|
+
SCSS
|
31
31
|
|
32
32
|
it { should report_lint line: 3 }
|
33
33
|
end
|
34
34
|
|
35
35
|
context 'when commas are not at the end of the line' do
|
36
|
-
let(:
|
36
|
+
let(:scss) { <<-SCSS }
|
37
37
|
.foo
|
38
38
|
, .bar {
|
39
39
|
}
|
40
|
-
|
40
|
+
SCSS
|
41
41
|
|
42
42
|
it { should report_lint }
|
43
43
|
end
|
44
44
|
|
45
45
|
context 'when commas are on their own line' do
|
46
|
-
let(:
|
46
|
+
let(:scss) { <<-SCSS }
|
47
47
|
.foo
|
48
48
|
,
|
49
49
|
.bar {
|
50
50
|
}
|
51
|
-
|
51
|
+
SCSS
|
52
52
|
|
53
53
|
it { should report_lint }
|
54
54
|
end
|
55
55
|
|
56
56
|
context 'when nested rule contains multiple selectors on the same line' do
|
57
|
-
let(:
|
57
|
+
let(:scss) { <<-SCSS }
|
58
58
|
#foo {
|
59
59
|
.first,
|
60
60
|
.second,
|
@@ -62,68 +62,68 @@ describe SCSSLint::Linter::SingleLinePerSelector do
|
|
62
62
|
.fifth {
|
63
63
|
}
|
64
64
|
}
|
65
|
-
|
65
|
+
SCSS
|
66
66
|
|
67
67
|
it { should report_lint line: 4 }
|
68
68
|
end
|
69
69
|
|
70
70
|
context 'when rule contains interpolated selectors' do
|
71
|
-
let(:
|
71
|
+
let(:scss) { <<-SCSS }
|
72
72
|
.first,
|
73
73
|
\#{interpolated-selector}.thing,
|
74
74
|
.third {
|
75
75
|
}
|
76
|
-
|
76
|
+
SCSS
|
77
77
|
|
78
78
|
it { should_not report_lint }
|
79
79
|
end
|
80
80
|
|
81
81
|
context 'when rule contains an interpolated selector not on its own line' do
|
82
|
-
let(:
|
82
|
+
let(:scss) { <<-SCSS }
|
83
83
|
.first,
|
84
84
|
.second, \#{$interpolated-selector}.thing,
|
85
85
|
.fourth {
|
86
86
|
}
|
87
|
-
|
87
|
+
SCSS
|
88
88
|
|
89
89
|
it { should_not report_lint }
|
90
90
|
end
|
91
91
|
|
92
92
|
context 'when rule contains an inline comment' do
|
93
|
-
let(:
|
93
|
+
let(:scss) { <<-SCSS }
|
94
94
|
.first, /* A comment */
|
95
95
|
.second, // Another comment
|
96
96
|
.third {
|
97
97
|
}
|
98
|
-
|
98
|
+
SCSS
|
99
99
|
|
100
100
|
it { should_not report_lint }
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'when interpolation contains a comma' do
|
104
|
-
let(:
|
104
|
+
let(:scss) { <<-SCSS }
|
105
105
|
.my-\#{function(1, 2)}-selector .nested {
|
106
106
|
}
|
107
|
-
|
107
|
+
SCSS
|
108
108
|
|
109
109
|
it { should_not report_lint }
|
110
110
|
end
|
111
111
|
|
112
112
|
context 'when selector contains an interpolated string' do
|
113
|
-
let(:
|
113
|
+
let(:scss) { <<-SCSS }
|
114
114
|
div,
|
115
115
|
\#{$selector},
|
116
116
|
p {}
|
117
|
-
|
117
|
+
SCSS
|
118
118
|
|
119
119
|
it { should_not report_lint }
|
120
120
|
end
|
121
121
|
|
122
122
|
context 'when a function is used in the selector' do
|
123
|
-
let(:
|
123
|
+
let(:scss) { <<-SCSS }
|
124
124
|
\#{function()} {
|
125
125
|
}
|
126
|
-
|
126
|
+
SCSS
|
127
127
|
|
128
128
|
it { should_not report_lint }
|
129
129
|
end
|
@@ -3,78 +3,78 @@ require 'spec_helper'
|
|
3
3
|
describe SCSSLint::Linter::SpaceAfterComma do
|
4
4
|
context 'in a mixin declaration' do
|
5
5
|
context 'where spaces do not follow commas' do
|
6
|
-
let(:
|
6
|
+
let(:scss) { <<-SCSS }
|
7
7
|
@mixin mixin($arg1,$arg2,$kwarg1: 'default',$kwarg2: 'default') {
|
8
8
|
}
|
9
|
-
|
9
|
+
SCSS
|
10
10
|
|
11
11
|
it { should report_lint count: 3 }
|
12
12
|
end
|
13
13
|
|
14
14
|
context 'where spaces follow commas' do
|
15
|
-
let(:
|
15
|
+
let(:scss) { <<-SCSS }
|
16
16
|
@mixin mixin($arg1, $arg2, $kwarg1: 'default', $kwarg2: 'default') {
|
17
17
|
}
|
18
|
-
|
18
|
+
SCSS
|
19
19
|
|
20
20
|
it { should_not report_lint }
|
21
21
|
end
|
22
22
|
|
23
23
|
context 'where spaces surround commas' do
|
24
|
-
let(:
|
24
|
+
let(:scss) { <<-SCSS }
|
25
25
|
@mixin mixin($arg1 , $arg2 , $kwarg1: 'default' , $kwarg2: 'default') {
|
26
26
|
}
|
27
|
-
|
27
|
+
SCSS
|
28
28
|
|
29
29
|
it { should_not report_lint }
|
30
30
|
end
|
31
31
|
|
32
32
|
context 'where commas are followed by a newline' do
|
33
|
-
let(:
|
33
|
+
let(:scss) { <<-SCSS }
|
34
34
|
@mixin mixin($arg1,
|
35
35
|
$arg2,
|
36
36
|
$kwarg1: 'default',
|
37
37
|
$kwarg2: 'default') {
|
38
38
|
}
|
39
|
-
|
39
|
+
SCSS
|
40
40
|
|
41
41
|
it { should_not report_lint }
|
42
42
|
end
|
43
43
|
|
44
44
|
context 'definining a variable argument' do
|
45
45
|
context 'where spaces do not follow commas' do
|
46
|
-
let(:
|
46
|
+
let(:scss) { <<-SCSS }
|
47
47
|
@mixin mixin($arg,$args...) {
|
48
48
|
}
|
49
|
-
|
49
|
+
SCSS
|
50
50
|
|
51
51
|
it { should report_lint count: 1 }
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'where spaces follow commas' do
|
55
|
-
let(:
|
55
|
+
let(:scss) { <<-SCSS }
|
56
56
|
@mixin mixin($arg, $args...) {
|
57
57
|
}
|
58
|
-
|
58
|
+
SCSS
|
59
59
|
|
60
60
|
it { should_not report_lint }
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'where spaces surround commas' do
|
64
|
-
let(:
|
64
|
+
let(:scss) { <<-SCSS }
|
65
65
|
@mixin mixin($arg , $args...) {
|
66
66
|
}
|
67
|
-
|
67
|
+
SCSS
|
68
68
|
|
69
69
|
it { should_not report_lint }
|
70
70
|
end
|
71
71
|
|
72
72
|
context 'where commas are followed by a newline' do
|
73
|
-
let(:
|
73
|
+
let(:scss) { <<-SCSS }
|
74
74
|
@mixin mixin($arg,
|
75
75
|
$args...) {
|
76
76
|
}
|
77
|
-
|
77
|
+
SCSS
|
78
78
|
|
79
79
|
it { should_not report_lint }
|
80
80
|
end
|
@@ -83,37 +83,37 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
83
83
|
|
84
84
|
context 'in a mixin inclusion' do
|
85
85
|
context 'where spaces do not follow commas' do
|
86
|
-
let(:
|
86
|
+
let(:scss) { <<-SCSS }
|
87
87
|
p {
|
88
88
|
@include mixin(1,2,3,$args...,$kwarg1: 4,$kwarg2: 5,$kwargs...);
|
89
89
|
}
|
90
|
-
|
90
|
+
SCSS
|
91
91
|
|
92
92
|
it { should report_lint count: 6 }
|
93
93
|
end
|
94
94
|
|
95
95
|
context 'where spaces follow commas' do
|
96
|
-
let(:
|
96
|
+
let(:scss) { <<-SCSS }
|
97
97
|
p {
|
98
98
|
@include mixin(1, 2, 3, $args..., $kwarg1: 4, $kwarg2: 5, $kwargs...);
|
99
99
|
}
|
100
|
-
|
100
|
+
SCSS
|
101
101
|
|
102
102
|
it { should_not report_lint }
|
103
103
|
end
|
104
104
|
|
105
105
|
context 'where spaces surround commas' do
|
106
|
-
let(:
|
106
|
+
let(:scss) { <<-SCSS }
|
107
107
|
p {
|
108
108
|
@include mixin(1 , 2 , 3 , $args... , $kwarg1: 4 , $kwarg2: 5 , $kwargs...);
|
109
109
|
}
|
110
|
-
|
110
|
+
SCSS
|
111
111
|
|
112
112
|
it { should_not report_lint }
|
113
113
|
end
|
114
114
|
|
115
115
|
context 'where commas are followed by a newline' do
|
116
|
-
let(:
|
116
|
+
let(:scss) { <<-SCSS }
|
117
117
|
p {
|
118
118
|
@include mixin(1,
|
119
119
|
2,
|
@@ -123,7 +123,7 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
123
123
|
$kwarg2: 5,
|
124
124
|
$kwargs...);
|
125
125
|
}
|
126
|
-
|
126
|
+
SCSS
|
127
127
|
|
128
128
|
it { should_not report_lint }
|
129
129
|
end
|
@@ -131,78 +131,78 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
131
131
|
|
132
132
|
context 'in a function declaration' do
|
133
133
|
context 'where spaces do not follow commas' do
|
134
|
-
let(:
|
134
|
+
let(:scss) { <<-SCSS }
|
135
135
|
@function func($arg1,$arg2,$kwarg1: 'default',$kwarg2: 'default') {
|
136
136
|
}
|
137
|
-
|
137
|
+
SCSS
|
138
138
|
|
139
139
|
it { should report_lint count: 3 }
|
140
140
|
end
|
141
141
|
|
142
142
|
context 'where spaces follow commas' do
|
143
|
-
let(:
|
143
|
+
let(:scss) { <<-SCSS }
|
144
144
|
@function func($arg1, $arg2, $kwarg1: 'default', $kwarg2: 'default') {
|
145
145
|
}
|
146
|
-
|
146
|
+
SCSS
|
147
147
|
|
148
148
|
it { should_not report_lint }
|
149
149
|
end
|
150
150
|
|
151
151
|
context 'where spaces surround commas' do
|
152
|
-
let(:
|
152
|
+
let(:scss) { <<-SCSS }
|
153
153
|
@function func($arg1 , $arg2 , $kwarg1: 'default' , $kwarg2: 'default') {
|
154
154
|
}
|
155
|
-
|
155
|
+
SCSS
|
156
156
|
|
157
157
|
it { should_not report_lint }
|
158
158
|
end
|
159
159
|
|
160
160
|
context 'where commas are followed by a newline' do
|
161
|
-
let(:
|
161
|
+
let(:scss) { <<-SCSS }
|
162
162
|
@function func($arg1,
|
163
163
|
$arg2,
|
164
164
|
$kwarg1: 'default',
|
165
165
|
$kwarg2: 'default') {
|
166
166
|
}
|
167
|
-
|
167
|
+
SCSS
|
168
168
|
|
169
169
|
it { should_not report_lint }
|
170
170
|
end
|
171
171
|
|
172
172
|
context 'definining a variable argument' do
|
173
173
|
context 'where spaces do not follow commas' do
|
174
|
-
let(:
|
174
|
+
let(:scss) { <<-SCSS }
|
175
175
|
@function func($arg,$args...) {
|
176
176
|
}
|
177
|
-
|
177
|
+
SCSS
|
178
178
|
|
179
179
|
it { should report_lint count: 1 }
|
180
180
|
end
|
181
181
|
|
182
182
|
context 'where spaces follow commas' do
|
183
|
-
let(:
|
183
|
+
let(:scss) { <<-SCSS }
|
184
184
|
@function func($arg, $args...) {
|
185
185
|
}
|
186
|
-
|
186
|
+
SCSS
|
187
187
|
|
188
188
|
it { should_not report_lint }
|
189
189
|
end
|
190
190
|
|
191
191
|
context 'where spaces surround commas' do
|
192
|
-
let(:
|
192
|
+
let(:scss) { <<-SCSS }
|
193
193
|
@function func($arg , $args...) {
|
194
194
|
}
|
195
|
-
|
195
|
+
SCSS
|
196
196
|
|
197
197
|
it { should_not report_lint }
|
198
198
|
end
|
199
199
|
|
200
200
|
context 'where commas are followed by a newline' do
|
201
|
-
let(:
|
201
|
+
let(:scss) { <<-SCSS }
|
202
202
|
@function func($arg,
|
203
203
|
$args...) {
|
204
204
|
}
|
205
|
-
|
205
|
+
SCSS
|
206
206
|
|
207
207
|
it { should_not report_lint }
|
208
208
|
end
|
@@ -211,37 +211,37 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
211
211
|
|
212
212
|
context 'in a function invocation' do
|
213
213
|
context 'where spaces do not follow commas' do
|
214
|
-
let(:
|
214
|
+
let(:scss) { <<-SCSS }
|
215
215
|
p {
|
216
216
|
margin: func(1,2,3,$args...,$kwarg1: 4,$kwarg2: 5,$kwargs...);
|
217
217
|
}
|
218
|
-
|
218
|
+
SCSS
|
219
219
|
|
220
220
|
it { should report_lint count: 6 }
|
221
221
|
end
|
222
222
|
|
223
223
|
context 'where spaces follow commas' do
|
224
|
-
let(:
|
224
|
+
let(:scss) { <<-SCSS }
|
225
225
|
p {
|
226
226
|
margin: func(1, 2, 3, $args..., $kwarg1: 4, $kwarg2: 5, $kwargs...);
|
227
227
|
}
|
228
|
-
|
228
|
+
SCSS
|
229
229
|
|
230
230
|
it { should_not report_lint }
|
231
231
|
end
|
232
232
|
|
233
233
|
context 'where spaces surround commas' do
|
234
|
-
let(:
|
234
|
+
let(:scss) { <<-SCSS }
|
235
235
|
p {
|
236
236
|
margin: func(1 , 2 , 3 , $args... , $kwarg1: 4 , $kwarg2: 5 , $kwargs...);
|
237
237
|
}
|
238
|
-
|
238
|
+
SCSS
|
239
239
|
|
240
240
|
it { should_not report_lint }
|
241
241
|
end
|
242
242
|
|
243
243
|
context 'where commas are followed by a newline' do
|
244
|
-
let(:
|
244
|
+
let(:scss) { <<-SCSS }
|
245
245
|
p {
|
246
246
|
margin: func(1,
|
247
247
|
2,
|
@@ -251,7 +251,7 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
251
251
|
$kwarg2: 5,
|
252
252
|
$kwargs...);
|
253
253
|
}
|
254
|
-
|
254
|
+
SCSS
|
255
255
|
|
256
256
|
it { should_not report_lint }
|
257
257
|
end
|
@@ -259,55 +259,55 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
259
259
|
|
260
260
|
context 'in a comma-separated literal list' do
|
261
261
|
context 'where spaces do not follow commas' do
|
262
|
-
let(:
|
262
|
+
let(:scss) { <<-SCSS }
|
263
263
|
p {
|
264
264
|
property: $a,$b,$c,$d;
|
265
265
|
}
|
266
|
-
|
266
|
+
SCSS
|
267
267
|
|
268
268
|
it { should report_lint count: 3 }
|
269
269
|
end
|
270
270
|
|
271
271
|
context 'where spaces follow commas' do
|
272
|
-
let(:
|
272
|
+
let(:scss) { <<-SCSS }
|
273
273
|
p {
|
274
274
|
property: $a, $b, $c, $d;
|
275
275
|
}
|
276
|
-
|
276
|
+
SCSS
|
277
277
|
|
278
278
|
it { should_not report_lint }
|
279
279
|
end
|
280
280
|
|
281
281
|
context 'where spaces surround commas' do
|
282
|
-
let(:
|
282
|
+
let(:scss) { <<-SCSS }
|
283
283
|
p {
|
284
284
|
property: $a , $b , $c , $d;
|
285
285
|
}
|
286
|
-
|
286
|
+
SCSS
|
287
287
|
|
288
288
|
it { should_not report_lint }
|
289
289
|
end
|
290
290
|
|
291
291
|
context 'where commas are followed by a newline' do
|
292
|
-
let(:
|
292
|
+
let(:scss) { <<-SCSS }
|
293
293
|
p {
|
294
294
|
property: $a,
|
295
295
|
$b,
|
296
296
|
$c,
|
297
297
|
$d;
|
298
298
|
}
|
299
|
-
|
299
|
+
SCSS
|
300
300
|
|
301
301
|
it { should_not report_lint }
|
302
302
|
end
|
303
303
|
|
304
304
|
context 'when commas are followed by a space and a newline' do
|
305
|
-
let(:
|
305
|
+
let(:scss) { <<-SCSS }
|
306
306
|
p {
|
307
307
|
property: $a,\s
|
308
308
|
$b;
|
309
309
|
}
|
310
|
-
|
310
|
+
SCSS
|
311
311
|
|
312
312
|
it { should_not report_lint }
|
313
313
|
end
|
@@ -315,7 +315,7 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
315
315
|
|
316
316
|
context 'when declaring list variables' do
|
317
317
|
context 'and one argument does not have a trailing comma' do
|
318
|
-
let(:
|
318
|
+
let(:scss) { <<-SCSS }
|
319
319
|
$z-list: (
|
320
320
|
(
|
321
321
|
name1
|
@@ -324,7 +324,7 @@ describe SCSSLint::Linter::SpaceAfterComma do
|
|
324
324
|
name2,
|
325
325
|
)
|
326
326
|
);
|
327
|
-
|
327
|
+
SCSS
|
328
328
|
|
329
329
|
it { should_not report_lint }
|
330
330
|
end
|