scss-lint 0.26.0 → 0.26.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e07cf784e2e32fc05bf8294608db2d3bcf2951b2
4
- data.tar.gz: d1577b62811661ad24efa01dfeeffc6ca19a573b
3
+ metadata.gz: 35968261ce332fb768bb4718428cae2dbc1ac092
4
+ data.tar.gz: 4ca8c381e68d044cc215c7a282c0cf638d5b7549
5
5
  SHA512:
6
- metadata.gz: a3179febbb5fce02dee1044be6ea7b05f312e833e8bb61d4c8cb23f9ab84eb07c9458f9492f6918a2766a8c42e10ae89debd3a20959ca7778bc38787eccc96e2
7
- data.tar.gz: e50715f6dbbf827a29b1f079d520ec6011e8318f3b89ea9d7d31afb09c8bf68a32f3cea66ab7a8da926ab2556c4a34fb3023a8393ae10aea89ef3889e5a34f19
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
- return unless number = source_from_range(node.source_range)[FRACTIONAL_DIGIT_REGEX, 1]
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 if node.rule.any? { |item| item.is_a?(Sass::Script::Variable) }
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 visit_mixin(node)
10
+ def visit_variable(node)
19
11
  check_semicolon(node)
20
12
  end
21
13
 
22
- def visit_variable(node)
23
- check_semicolon(node)
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? { |n| n.is_a?(Sass::Tree::PropNode) }
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
- simple_sequence.members.first.is_a?(Sass::Selector::Parent)
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
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.26.0'
3
+ VERSION = '0.26.1'
4
4
  end
@@ -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 { should report_lint line: 1 }
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scss-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Causes Engineering