scss_lint 0.50.2 → 0.50.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/property-sort-orders/concentric.txt +21 -0
- data/data/property-sort-orders/recess.txt +1 -1
- data/data/pseudo-elements.txt +18 -0
- data/lib/scss_lint/engine.rb +1 -1
- data/lib/scss_lint/linter/border_zero.rb +5 -1
- data/lib/scss_lint/linter/color_keyword.rb +1 -2
- data/lib/scss_lint/linter/comment.rb +9 -1
- data/lib/scss_lint/linter/duplicate_property.rb +5 -4
- data/lib/scss_lint/linter/empty_line_between_blocks.rb +1 -0
- data/lib/scss_lint/linter/final_newline.rb +3 -2
- data/lib/scss_lint/linter/private_naming_convention.rb +3 -3
- data/lib/scss_lint/linter/qualifying_element.rb +1 -1
- data/lib/scss_lint/linter/shorthand.rb +5 -3
- data/lib/scss_lint/linter/space_after_comment.rb +1 -1
- data/lib/scss_lint/linter/space_before_brace.rb +5 -0
- data/lib/scss_lint/linter/zero_unit.rb +7 -0
- data/lib/scss_lint/sass/tree.rb +5 -3
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/linter/space_after_comment_spec.rb +33 -0
- data/spec/scss_lint/linter/space_before_brace_spec.rb +23 -0
- data/spec/scss_lint/linter/zero_unit_spec.rb +10 -0
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb1a4b4dfd030c6360b2bfe1a6d540662abaee0
|
4
|
+
data.tar.gz: ff64f063fdbecbcbb5fd48fc3d776f461481f8d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 254cbcaca9f62abd8011730785a71aa056330da801521f157a812528a99233279eaacddd50f63ebbe70da35b2a2d7df96deb63bb543aad7b0293f11b6e14039e
|
7
|
+
data.tar.gz: cb645fd0f5a41177a2f3a2595327f5ff0faf19420f27e4958a6e3e8adce84d2d2c091e7a9f87e236e85798a0125d38a77098e5fe02d104b3d34d6ba6fc01217f
|
@@ -8,6 +8,19 @@ right
|
|
8
8
|
bottom
|
9
9
|
left
|
10
10
|
|
11
|
+
flex
|
12
|
+
flex-basis
|
13
|
+
flex-direction
|
14
|
+
flex-flow
|
15
|
+
flex-grow
|
16
|
+
flex-shrink
|
17
|
+
flex-wrap
|
18
|
+
align-content
|
19
|
+
align-items
|
20
|
+
align-self
|
21
|
+
justify-content
|
22
|
+
order
|
23
|
+
|
11
24
|
columns
|
12
25
|
column-gap
|
13
26
|
column-fill
|
@@ -43,6 +56,10 @@ margin-bottom
|
|
43
56
|
margin-left
|
44
57
|
|
45
58
|
outline
|
59
|
+
outline-offset
|
60
|
+
outline-width
|
61
|
+
outline-style
|
62
|
+
outline-color
|
46
63
|
|
47
64
|
border
|
48
65
|
border-top
|
@@ -76,6 +93,8 @@ border-left-color
|
|
76
93
|
box-shadow
|
77
94
|
|
78
95
|
background
|
96
|
+
background-attachment
|
97
|
+
background-clip
|
79
98
|
background-color
|
80
99
|
background-image
|
81
100
|
background-repeat
|
@@ -118,6 +137,8 @@ text-shadow
|
|
118
137
|
text-overflow
|
119
138
|
|
120
139
|
line-height
|
140
|
+
word-break
|
141
|
+
word-wrap
|
121
142
|
word-spacing
|
122
143
|
letter-spacing
|
123
144
|
white-space
|
@@ -80,6 +80,7 @@ pointer-events
|
|
80
80
|
cursor
|
81
81
|
background
|
82
82
|
background-attachment
|
83
|
+
background-clip
|
83
84
|
background-color
|
84
85
|
background-image
|
85
86
|
background-position
|
@@ -150,7 +151,6 @@ transition-delay
|
|
150
151
|
transition-duration
|
151
152
|
transition-property
|
152
153
|
transition-timing-function
|
153
|
-
background-clip
|
154
154
|
backface-visibility
|
155
155
|
resize
|
156
156
|
appearance
|
data/data/pseudo-elements.txt
CHANGED
@@ -58,6 +58,24 @@
|
|
58
58
|
-webkit-inner-spin-button
|
59
59
|
-webkit-input-placeholder
|
60
60
|
-webkit-keygen-select
|
61
|
+
-webkit-media-controls-current-time-display
|
62
|
+
-webkit-media-controls-enclosure
|
63
|
+
-webkit-media-controls-fullscreen-button
|
64
|
+
-webkit-media-controls-mute-button
|
65
|
+
-webkit-media-controls-overlay-play-button
|
66
|
+
-webkit-media-controls-panel
|
67
|
+
-webkit-media-controls-play-button
|
68
|
+
-webkit-media-controls-return-to-realtime-button
|
69
|
+
-webkit-media-controls-rewind-button
|
70
|
+
-webkit-media-controls-seek-back-button
|
71
|
+
-webkit-media-controls-seek-forward-button
|
72
|
+
-webkit-media-controls-start-playback-button
|
73
|
+
-webkit-media-controls-time-remaining-display
|
74
|
+
-webkit-media-controls-timeline
|
75
|
+
-webkit-media-controls-timeline-container
|
76
|
+
-webkit-media-controls-toggle-closed-captions-button
|
77
|
+
-webkit-media-controls-volume-slider
|
78
|
+
-webkit-media-controls-volume-slider-container
|
61
79
|
-webkit-meter-bar
|
62
80
|
-webkit-meter-even-less-good-value
|
63
81
|
-webkit-meter-optimum-value
|
data/lib/scss_lint/engine.rb
CHANGED
@@ -75,7 +75,7 @@ module SCSSLint
|
|
75
75
|
|
76
76
|
def find_any_control_commands
|
77
77
|
@any_control_commands =
|
78
|
-
@lines.any? { |line| line['scss-lint:disable'] || line['scss-
|
78
|
+
@lines.any? { |line| line['scss-lint:disable'] || line['scss-lint:enable'] }
|
79
79
|
end
|
80
80
|
|
81
81
|
def preprocess_contents # rubocop:disable CyclomaticComplexity
|
@@ -17,7 +17,11 @@ module SCSSLint
|
|
17
17
|
].freeze
|
18
18
|
|
19
19
|
def visit_root(_node)
|
20
|
-
@preference = CONVENTION_TO_PREFERENCE[config['convention']]
|
20
|
+
@preference = CONVENTION_TO_PREFERENCE[config['convention'].to_s]
|
21
|
+
unless @preference
|
22
|
+
raise "Invalid `convention` specified: #{config['convention']}." \
|
23
|
+
"Must be one of [#{CONVENTION_TO_PREFERENCE.keys.join(', ')}]"
|
24
|
+
end
|
21
25
|
yield # Continue linting children
|
22
26
|
end
|
23
27
|
|
@@ -42,9 +42,8 @@ module SCSSLint
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def in_allowed_function_call?(node)
|
45
|
-
|
45
|
+
(funcall = node_ancestor(node, 2)).is_a?(Sass::Script::Tree::Funcall) &&
|
46
46
|
FUNCTIONS_ALLOWING_COLOR_KEYWORD_ARGS.include?(funcall.name)
|
47
|
-
end
|
48
47
|
end
|
49
48
|
end
|
50
49
|
end
|
@@ -4,7 +4,7 @@ module SCSSLint
|
|
4
4
|
include LinterRegistry
|
5
5
|
|
6
6
|
def visit_comment(node)
|
7
|
-
add_lint(node,
|
7
|
+
add_lint(node, message) unless valid_comment?(node)
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -31,5 +31,13 @@ module SCSSLint
|
|
31
31
|
|
32
32
|
node.value.join.match(re)
|
33
33
|
end
|
34
|
+
|
35
|
+
def message
|
36
|
+
if config.fetch('style', 'silent') == 'silent'
|
37
|
+
'Use `//` comments everywhere'
|
38
|
+
else
|
39
|
+
'Use `/* */` comments everywhere'
|
40
|
+
end
|
41
|
+
end
|
34
42
|
end
|
35
43
|
end
|
@@ -57,6 +57,7 @@ module SCSSLint
|
|
57
57
|
when Sass::Script::Funcall
|
58
58
|
value.name
|
59
59
|
when Sass::Script::String
|
60
|
+
nil
|
60
61
|
when Sass::Script::Tree::Literal
|
61
62
|
value.value
|
62
63
|
when Sass::Script::Tree::ListLiteral
|
@@ -69,13 +70,13 @@ module SCSSLint
|
|
69
70
|
def ignore_consecutive_of?(prop)
|
70
71
|
case @ignore_consecutive
|
71
72
|
when true
|
72
|
-
|
73
|
+
true
|
73
74
|
when false
|
74
|
-
|
75
|
+
false
|
75
76
|
when nil
|
76
|
-
|
77
|
+
false
|
77
78
|
when Array
|
78
|
-
|
79
|
+
@ignore_consecutive.include?(prop.name.join)
|
79
80
|
else
|
80
81
|
raise SCSSLint::Exceptions::LinterError,
|
81
82
|
"#{@ignore_consecutive.inspect} is not a valid value for ignore_consecutive."
|
@@ -9,8 +9,9 @@ module SCSSLint
|
|
9
9
|
ends_with_newline = engine.lines[-1][-1] == "\n"
|
10
10
|
|
11
11
|
if config['present']
|
12
|
-
|
13
|
-
|
12
|
+
unless ends_with_newline
|
13
|
+
add_lint(engine.lines.count, 'Files should end with a trailing newline')
|
14
|
+
end
|
14
15
|
elsif ends_with_newline
|
15
16
|
add_lint(engine.lines.count, 'Files should not end with a trailing newline')
|
16
17
|
end
|
@@ -107,11 +107,11 @@ module SCSSLint
|
|
107
107
|
|
108
108
|
return false unless node_to_look_in.node_parent
|
109
109
|
|
110
|
+
return unless node_to_look_in.node_parent
|
111
|
+
|
110
112
|
# We did not find a match yet, and haven't reached the top of the branch,
|
111
113
|
# so recurse.
|
112
|
-
|
113
|
-
node_defined_earlier_in_branch?(node_to_look_in.node_parent, looking_for)
|
114
|
-
end
|
114
|
+
node_defined_earlier_in_branch?(node_to_look_in.node_parent, looking_for)
|
115
115
|
end
|
116
116
|
|
117
117
|
def private?(node)
|
@@ -82,8 +82,10 @@ module SCSSLint
|
|
82
82
|
def check_shorthand(prop, node, values)
|
83
83
|
values = shorthand_values(values)
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
unless allowed?(values.count)
|
86
|
+
add_lint(node, "Shorthands of length `#{values.count}` are not allowed. " \
|
87
|
+
"Value was `#{values.join(' ')}`")
|
88
|
+
end
|
87
89
|
|
88
90
|
return unless (2..4).member?(values.count)
|
89
91
|
|
@@ -140,7 +142,7 @@ module SCSSLint
|
|
140
142
|
# @param right [String]
|
141
143
|
# @param left [String]
|
142
144
|
# @return [Boolean]
|
143
|
-
def condense_to_three_values?(_, right,
|
145
|
+
def condense_to_three_values?(_, right, _, left)
|
144
146
|
return unless allowed?(3)
|
145
147
|
|
146
148
|
right == left
|
@@ -14,7 +14,7 @@ module SCSSLint
|
|
14
14
|
def check_silent_comment(node, source)
|
15
15
|
source.split("\n").each_with_index do |line, index|
|
16
16
|
next if config['allow_empty_comments'] && line.strip.length <= 2
|
17
|
-
whitespace = whitespace_after_comment(line, 2)
|
17
|
+
whitespace = whitespace_after_comment(line.lstrip, 2)
|
18
18
|
check_for_space(node.line + index, whitespace)
|
19
19
|
end
|
20
20
|
end
|
@@ -7,6 +7,7 @@ module SCSSLint
|
|
7
7
|
|
8
8
|
def visit_script_string(node)
|
9
9
|
return unless node.type == :identifier
|
10
|
+
return if node.value.start_with?('calc(')
|
10
11
|
|
11
12
|
node.value.scan(ZERO_UNIT_REGEX) do |match|
|
12
13
|
next unless zero_with_length_units?(match.first)
|
@@ -21,6 +22,12 @@ module SCSSLint
|
|
21
22
|
add_lint(node, MESSAGE_FORMAT % length)
|
22
23
|
end
|
23
24
|
|
25
|
+
def visit_script_funcall(node)
|
26
|
+
# Don't report errors for values within `calc` expressions, since they
|
27
|
+
# require units in order to work
|
28
|
+
yield unless node.name == 'calc'
|
29
|
+
end
|
30
|
+
|
24
31
|
private
|
25
32
|
|
26
33
|
ZERO_UNIT_REGEX = /
|
data/lib/scss_lint/sass/tree.rb
CHANGED
@@ -122,9 +122,11 @@ module Sass::Tree
|
|
122
122
|
|
123
123
|
# Keyword mapping is String -> Expr, so convert the string to a variable
|
124
124
|
# node that supports lint reporting
|
125
|
-
|
126
|
-
|
127
|
-
|
125
|
+
if keywords.any?
|
126
|
+
keyword_exprs = keywords.as_stored.map do |var_name, var_expr|
|
127
|
+
[create_variable(var_name), var_expr]
|
128
|
+
end
|
129
|
+
end
|
128
130
|
|
129
131
|
concat_expr_lists super, args, keyword_exprs, splat
|
130
132
|
end
|
data/lib/scss_lint/version.rb
CHANGED
@@ -176,6 +176,17 @@ describe SCSSLint::Linter::SpaceAfterComment do
|
|
176
176
|
|
177
177
|
it { should report_lint line: 1 }
|
178
178
|
end
|
179
|
+
|
180
|
+
context 'when an indented block has comments on multiple lines' do
|
181
|
+
let(:scss) { <<-SCSS }
|
182
|
+
p {
|
183
|
+
// Comment one
|
184
|
+
// Comment two
|
185
|
+
}
|
186
|
+
SCSS
|
187
|
+
|
188
|
+
it { should_not report_lint }
|
189
|
+
end
|
179
190
|
end
|
180
191
|
|
181
192
|
context 'when no spaces are allowed' do
|
@@ -326,6 +337,17 @@ describe SCSSLint::Linter::SpaceAfterComment do
|
|
326
337
|
|
327
338
|
it { should report_lint line: 1 }
|
328
339
|
end
|
340
|
+
|
341
|
+
context 'when an indented block has comments on multiple lines' do
|
342
|
+
let(:scss) { <<-SCSS }
|
343
|
+
p {
|
344
|
+
//Comment one
|
345
|
+
//Comment two
|
346
|
+
}
|
347
|
+
SCSS
|
348
|
+
|
349
|
+
it { should_not report_lint }
|
350
|
+
end
|
329
351
|
end
|
330
352
|
|
331
353
|
context 'when at least one space is preferred' do
|
@@ -476,5 +498,16 @@ describe SCSSLint::Linter::SpaceAfterComment do
|
|
476
498
|
|
477
499
|
it { should_not report_lint line: 1 }
|
478
500
|
end
|
501
|
+
|
502
|
+
context 'when an indented block has comments on multiple lines' do
|
503
|
+
let(:scss) { <<-SCSS }
|
504
|
+
p {
|
505
|
+
// Comment one
|
506
|
+
// Comment two
|
507
|
+
}
|
508
|
+
SCSS
|
509
|
+
|
510
|
+
it { should_not report_lint }
|
511
|
+
end
|
479
512
|
end
|
480
513
|
end
|
@@ -494,6 +494,29 @@ describe SCSSLint::Linter::SpaceBeforeBrace do
|
|
494
494
|
end
|
495
495
|
end
|
496
496
|
|
497
|
+
context 'with an @if/@else statement' do
|
498
|
+
context 'when brace is preceded by space' do
|
499
|
+
let(:scss) { <<-SCSS }
|
500
|
+
@if some_expression {
|
501
|
+
} @else {
|
502
|
+
}
|
503
|
+
SCSS
|
504
|
+
|
505
|
+
it { should_not report_lint }
|
506
|
+
end
|
507
|
+
|
508
|
+
context 'when brace is not preceded by space' do
|
509
|
+
let(:scss) { <<-SCSS }
|
510
|
+
@if some_expression{
|
511
|
+
} @else{
|
512
|
+
}
|
513
|
+
SCSS
|
514
|
+
|
515
|
+
it { should report_lint line: 1 }
|
516
|
+
it { should report_lint line: 2 }
|
517
|
+
end
|
518
|
+
end
|
519
|
+
|
497
520
|
context 'with a mixin include with braces' do
|
498
521
|
context 'with arguments' do
|
499
522
|
context 'when brace is preceded by a space' do
|
@@ -110,4 +110,14 @@ describe SCSSLint::Linter::ZeroUnit do
|
|
110
110
|
|
111
111
|
it { should_not report_lint }
|
112
112
|
end
|
113
|
+
|
114
|
+
context 'when calc expression with zero value has units' do
|
115
|
+
let(:scss) { <<-SCSS }
|
116
|
+
p {
|
117
|
+
width: calc(0px + 1.5em);
|
118
|
+
}
|
119
|
+
SCSS
|
120
|
+
|
121
|
+
it { should_not report_lint }
|
122
|
+
end
|
113
123
|
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.50.
|
4
|
+
version: 0.50.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brigade Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -369,4 +369,3 @@ test_files:
|
|
369
369
|
- spec/spec_helper.rb
|
370
370
|
- spec/support/isolated_environment.rb
|
371
371
|
- spec/support/matchers/report_lint.rb
|
372
|
-
has_rdoc:
|