scss-lint 0.36.0 → 0.36.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f923a4288fb1d256d16d482a77e3c73a8aff84d
4
- data.tar.gz: 2da5da450f72c3947f454bafe1c33d5244dfc304
3
+ metadata.gz: c3a2b1ee0f782f66cb555280a0b7be06a2a4ff5f
4
+ data.tar.gz: 9b92adbf68a21311695432d0357ea6805b632be1
5
5
  SHA512:
6
- metadata.gz: 868fe445178e21cd235460029c6ab6ab914bc271a1e66c6fd462df517fd0deca3b08b2a974ddb3f362056da510d928f0e64c7aac33dbd6e932dc4752b2db042c
7
- data.tar.gz: b7086af86736d1470bf627c7cd65cafeead516855e2431417eb1b6d4a4fd6283fff34157b59bea8eb19ccaddfe95c20722cce80565354fcda134859f911a51de
6
+ metadata.gz: 01b85e9caee70645b1cc8da766b24cf0a5db2bca10c0d5fe1fd004492c27605a8cf08b194298dc20e5f0e1d6f56376fc68f4a4889df62e90295f7be36e88e1ec
7
+ data.tar.gz: 96aafd6d3d5a8fb34d99aebbf0f15ffe8216f482e785ff157266f9d1fa3dcff4014b53ef43aee95c11881d21a93cd047c6e3f767206c64e1ef62150c5b751fe5
@@ -100,7 +100,16 @@ linters:
100
100
 
101
101
  PropertyUnits:
102
102
  enabled: true
103
- global: ['em', 'ex', '%', 'px', 'ch', 'cm', 'mm', 'in', 'pt', 'pc', 'rem', 'vh', 'vw', 'vmin', 'vmax']
103
+ global: [
104
+ 'ch', 'em', 'ex', 'rem', # Font-relative lengths
105
+ 'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths
106
+ 'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths
107
+ 'deg', 'grad', 'rad', 'turn', # Angle
108
+ 'ms', 's', # Duration
109
+ 'Hz', 'kHz', # Frequency
110
+ 'dpi', 'dpcm', 'dppx', # Resolution
111
+ '%', # Other
112
+ ]
104
113
  properties: {}
105
114
 
106
115
  PropertySortOrder:
@@ -34,11 +34,12 @@ module SCSSLint
34
34
  end
35
35
 
36
36
  def check_node(node)
37
- children = node.children.select { |n| important_node?(n) }
38
- .map { |n| [n, node_declaration_type(n)] }
37
+ children = node.children.each_with_index
38
+ .select { |n, _| important_node?(n) }
39
+ .map { |n, i| [n, node_declaration_type(n), i] }
39
40
 
40
- sorted_children = children.sort do |(_, a_type), (_, b_type)|
41
- DECLARATION_ORDER.index(a_type) <=> DECLARATION_ORDER.index(b_type)
41
+ sorted_children = children.sort do |(_, a_type, i), (_, b_type, j)|
42
+ [DECLARATION_ORDER.index(a_type), i] <=> [DECLARATION_ORDER.index(b_type), j]
42
43
  end
43
44
 
44
45
  check_children_order(sorted_children, children)
@@ -18,7 +18,8 @@ module SCSSLint
18
18
  property = "#{@nested_under}-#{property}"
19
19
  end
20
20
 
21
- if units = node.value.value.to_s[/(?:\d+|\d*\.?\d+)([a-z%]+)/i, 1]
21
+ if node.value.respond_to?(:value) &&
22
+ units = node.value.value.to_s[/(?:^|\s)(?:\d+|\d*\.?\d+)([a-z%]+)/i, 1]
22
23
  check_units(node, property, units)
23
24
  end
24
25
 
@@ -1,4 +1,4 @@
1
1
  # Defines the gem version.
2
2
  module SCSSLint
3
- VERSION = '0.36.0'
3
+ VERSION = '0.36.1'
4
4
  end
@@ -196,4 +196,34 @@ describe SCSSLint::Linter::PropertyUnits do
196
196
  it { should report_lint line: 3 }
197
197
  end
198
198
  end
199
+
200
+ context 'when property contains a function call' do
201
+ let(:scss) { <<-SCSS }
202
+ p {
203
+ color: my-special-color(5);
204
+ }
205
+ SCSS
206
+
207
+ it { should_not report_lint }
208
+ end
209
+
210
+ context 'when property contains a unicode sequence' do
211
+ let(:scss) { <<-SCSS }
212
+ p {
213
+ content: "\\25be";
214
+ }
215
+ SCSS
216
+
217
+ it { should_not report_lint }
218
+ end
219
+
220
+ context 'when property contains a string in quotes that looks like a value' do
221
+ let(:scss) { <<-SCSS }
222
+ p {
223
+ content: "This is 12px";
224
+ }
225
+ SCSS
226
+
227
+ it { should_not report_lint }
228
+ end
199
229
  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.36.0
4
+ version: 0.36.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brigade Engineering
@@ -306,8 +306,8 @@ test_files:
306
306
  - spec/scss_lint/linter/vendor_prefix_spec.rb
307
307
  - spec/scss_lint/linter/zero_unit_spec.rb
308
308
  - spec/scss_lint/linter/color_variable_spec.rb
309
- - spec/scss_lint/linter/property_units_spec.rb
310
309
  - spec/scss_lint/linter/declaration_order_spec.rb
310
+ - spec/scss_lint/linter/property_units_spec.rb
311
311
  - spec/scss_lint/linter_registry_spec.rb
312
312
  - spec/scss_lint/linter_spec.rb
313
313
  - spec/scss_lint/location_spec.rb