scss-lint 0.26.0 → 0.26.1
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 +4 -4
- data/data/property-sort-orders/concentric.txt +11 -0
- data/lib/scss_lint/linter/leading_zero.rb +4 -1
- data/lib/scss_lint/linter/single_line_per_selector.rb +2 -2
- data/lib/scss_lint/linter/trailing_semicolon.rb +13 -12
- data/lib/scss_lint/linter/unnecessary_parent_reference.rb +4 -2
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/linter/single_line_per_selector_spec.rb +11 -2
- data/spec/scss_lint/linter/trailing_semicolon_spec.rb +26 -0
- data/spec/scss_lint/linter/unnecessary_parent_reference_spec.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35968261ce332fb768bb4718428cae2dbc1ac092
|
4
|
+
data.tar.gz: 4ca8c381e68d044cc215c7a282c0cf638d5b7549
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 026eb4b4c81ba0a753f5f804dd276f85f98e6d5b2c5ddc39c7979cfcecc55ac4470fae3e5d2c9bd8a78411743b64f8c07b71cb1999256337b488254bafaa779d
|
7
|
+
data.tar.gz: 45aa1649bae847377374ad44634bde37cee9ad3f4724359238cff14de0f634de29f42e783d3b45347838ca5a29fdd6828fc4a953e00408a447892f89609cff93
|
@@ -13,6 +13,7 @@ clear
|
|
13
13
|
|
14
14
|
visibility
|
15
15
|
opacity
|
16
|
+
transform
|
16
17
|
z-index
|
17
18
|
|
18
19
|
margin
|
@@ -40,17 +41,26 @@ border-right-style
|
|
40
41
|
border-bottom-style
|
41
42
|
border-left-style
|
42
43
|
|
44
|
+
border-radius
|
45
|
+
border-top-left-radius
|
46
|
+
border-top-right-radius
|
47
|
+
border-bottom-left-radius
|
48
|
+
border-bottom-right-radius
|
49
|
+
|
43
50
|
border-color
|
44
51
|
border-top-color
|
45
52
|
border-right-color
|
46
53
|
border-bottom-color
|
47
54
|
border-left-color
|
48
55
|
|
56
|
+
box-shadow
|
57
|
+
|
49
58
|
background
|
50
59
|
background-color
|
51
60
|
background-image
|
52
61
|
background-repeat
|
53
62
|
background-position
|
63
|
+
background-size
|
54
64
|
cursor
|
55
65
|
|
56
66
|
padding
|
@@ -83,6 +93,7 @@ text-align
|
|
83
93
|
text-indent
|
84
94
|
text-transform
|
85
95
|
text-decoration
|
96
|
+
text-rendering
|
86
97
|
|
87
98
|
line-height
|
88
99
|
word-spacing
|
@@ -14,7 +14,10 @@ module SCSSLint
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def visit_script_number(node)
|
17
|
-
|
17
|
+
# TODO: Remove once https://github.com/sass/sass/issues/1343 is fixed
|
18
|
+
return unless source = source_from_range(node.source_range)
|
19
|
+
|
20
|
+
return unless number = source[FRACTIONAL_DIGIT_REGEX, 1]
|
18
21
|
|
19
22
|
check_number(node, number)
|
20
23
|
end
|
@@ -17,7 +17,7 @@ module SCSSLint
|
|
17
17
|
# We must ignore selectors with interpolation, since there's no way to
|
18
18
|
# tell if the overall selector is valid since the interpolation could
|
19
19
|
# insert commas incorrectly. Thus we simply ignore.
|
20
|
-
return
|
20
|
+
return unless node.rule.all? { |item| item.is_a?(String) }
|
21
21
|
|
22
22
|
normalize_spacing(condense_to_string(node.rule)) =~ /\n,|,[^\n]/
|
23
23
|
end
|
@@ -31,7 +31,7 @@ module SCSSLint
|
|
31
31
|
|
32
32
|
# Removes extra spacing between lines in a comma-separated sequence due to
|
33
33
|
# comments being removed in the parse phase. This makes it easy to check if
|
34
|
-
# a comma is where belongs.
|
34
|
+
# a comma is where it belongs.
|
35
35
|
def normalize_spacing(string_sequence)
|
36
36
|
string_sequence.gsub(/,[^\S\n]*\n\s*/, ",\n")
|
37
37
|
end
|
@@ -3,30 +3,31 @@ module SCSSLint
|
|
3
3
|
class Linter::TrailingSemicolon < Linter
|
4
4
|
include LinterRegistry
|
5
5
|
|
6
|
-
def visit_prop(node)
|
7
|
-
if has_nested_properties?(node)
|
8
|
-
yield # Continue checking children
|
9
|
-
else
|
10
|
-
check_semicolon(node)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
6
|
def visit_extend(node)
|
15
7
|
check_semicolon(node)
|
16
8
|
end
|
17
9
|
|
18
|
-
def
|
10
|
+
def visit_variable(node)
|
19
11
|
check_semicolon(node)
|
20
12
|
end
|
21
13
|
|
22
|
-
def
|
23
|
-
|
14
|
+
def visit_possible_parent(node)
|
15
|
+
if has_nested_properties?(node)
|
16
|
+
yield # Continue checking children
|
17
|
+
else
|
18
|
+
check_semicolon(node)
|
19
|
+
end
|
24
20
|
end
|
25
21
|
|
22
|
+
alias_method :visit_mixin, :visit_possible_parent
|
23
|
+
alias_method :visit_prop, :visit_possible_parent
|
24
|
+
|
26
25
|
private
|
27
26
|
|
28
27
|
def has_nested_properties?(node)
|
29
|
-
node.children.any?
|
28
|
+
node.children.any? do |n|
|
29
|
+
n.is_a?(Sass::Tree::PropNode) || n.is_a?(Sass::Tree::RuleNode)
|
30
|
+
end
|
30
31
|
end
|
31
32
|
|
32
33
|
def check_semicolon(node)
|
@@ -3,7 +3,7 @@ module SCSSLint
|
|
3
3
|
class Linter::UnnecessaryParentReference < Linter
|
4
4
|
include LinterRegistry
|
5
5
|
|
6
|
-
MESSAGE = 'Unnecessary parent selector'
|
6
|
+
MESSAGE = 'Unnecessary parent selector (&)'
|
7
7
|
|
8
8
|
def visit_comma_sequence(comma_sequence)
|
9
9
|
@multiple_sequences = comma_sequence.members.size > 1
|
@@ -29,8 +29,10 @@ module SCSSLint
|
|
29
29
|
|
30
30
|
def sequence_starts_with_parent?(simple_sequence)
|
31
31
|
return unless simple_sequence.is_a?(Sass::Selector::SimpleSequence)
|
32
|
+
first = simple_sequence.members.first
|
32
33
|
simple_sequence.members.size == 1 &&
|
33
|
-
|
34
|
+
first.is_a?(Sass::Selector::Parent) &&
|
35
|
+
first.suffix.empty? # Ignore concatenated selectors, like `&-something`
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
data/lib/scss_lint/version.rb
CHANGED
@@ -81,12 +81,12 @@ describe SCSSLint::Linter::SingleLinePerSelector do
|
|
81
81
|
context 'when rule contains an interpolated selector not on its own line' do
|
82
82
|
let(:css) { <<-CSS }
|
83
83
|
.first,
|
84
|
-
.second, \#{interpolated-selector}.thing,
|
84
|
+
.second, \#{$interpolated-selector}.thing,
|
85
85
|
.fourth {
|
86
86
|
}
|
87
87
|
CSS
|
88
88
|
|
89
|
-
it {
|
89
|
+
it { should_not report_lint }
|
90
90
|
end
|
91
91
|
|
92
92
|
context 'when rule contains an inline comment' do
|
@@ -118,4 +118,13 @@ describe SCSSLint::Linter::SingleLinePerSelector do
|
|
118
118
|
|
119
119
|
it { should_not report_lint }
|
120
120
|
end
|
121
|
+
|
122
|
+
context 'when a function is used in the selector' do
|
123
|
+
let(:css) { <<-CSS }
|
124
|
+
\#{function()} {
|
125
|
+
}
|
126
|
+
CSS
|
127
|
+
|
128
|
+
it { should_not report_lint }
|
129
|
+
end
|
121
130
|
end
|
@@ -156,6 +156,32 @@ describe SCSSLint::Linter::TrailingSemicolon do
|
|
156
156
|
it { should report_lint line: 2 }
|
157
157
|
end
|
158
158
|
|
159
|
+
context 'when @include takes a block' do
|
160
|
+
let(:css) { <<-CSS }
|
161
|
+
.foo {
|
162
|
+
@include bar {
|
163
|
+
border: 0;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
CSS
|
167
|
+
|
168
|
+
it { should_not report_lint }
|
169
|
+
end
|
170
|
+
|
171
|
+
context 'when @include takes a block with nested props' do
|
172
|
+
let(:css) { <<-CSS }
|
173
|
+
.foo {
|
174
|
+
@include bar {
|
175
|
+
.bar {
|
176
|
+
border: 0;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
CSS
|
181
|
+
|
182
|
+
it { should_not report_lint }
|
183
|
+
end
|
184
|
+
|
159
185
|
context 'when @extend ends with a semicolon' do
|
160
186
|
let(:css) { <<-CSS }
|
161
187
|
.foo {
|
@@ -64,4 +64,14 @@ describe SCSSLint::Linter::UnnecessaryParentReference do
|
|
64
64
|
|
65
65
|
it { should report_lint line: 2 }
|
66
66
|
end
|
67
|
+
|
68
|
+
context 'when an ampersand is used in concatentation' do
|
69
|
+
let(:css) { <<-CSS }
|
70
|
+
.icon {
|
71
|
+
&-small {}
|
72
|
+
}
|
73
|
+
CSS
|
74
|
+
|
75
|
+
it { should_not report_lint }
|
76
|
+
end
|
67
77
|
end
|