scss_lint 0.43.1 → 0.43.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e6187740250928694fb6a0deda93e0d3c38019a
|
4
|
+
data.tar.gz: 5e779311f77ca29e8f2e1ddbafc1ad4c41650351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe7b37e6ad330637fe0a6266fd5695fa2c8ae84e47426b0f77b28c599694e1cc81df334308380f447ccffa13a668264e665ef2936e12e3741f27c73b68d1f350
|
7
|
+
data.tar.gz: b9773b48c133d3c02e91446a150b595a95941c52301957548a13a6e9e3d1f21148c63dff87d0773e9d72279af13127818c1f105dd0261efa57f344176847aa64
|
data/lib/scss_lint/engine.rb
CHANGED
@@ -47,7 +47,7 @@ module SCSSLint
|
|
47
47
|
# given
|
48
48
|
def build_from_file(options)
|
49
49
|
@filename = options[:path]
|
50
|
-
@contents = options[:file] ? file.read : File.read(@filename)
|
50
|
+
@contents = options[:file] ? options[:file].read : File.read(@filename)
|
51
51
|
@engine = Sass::Engine.new(@contents, ENGINE_OPTIONS.merge(filename: @filename))
|
52
52
|
end
|
53
53
|
|
@@ -4,9 +4,11 @@ module SCSSLint
|
|
4
4
|
include LinterRegistry
|
5
5
|
|
6
6
|
def visit_sequence(sequence)
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
line_offset = 0
|
8
|
+
sequence.members.each do |member|
|
9
|
+
line_offset += 1 if member =~ /\n/
|
10
|
+
next unless chained_class?(member)
|
11
|
+
add_lint(member.line + line_offset,
|
10
12
|
'Prefer using a distinct class over chained classes ' \
|
11
13
|
'(e.g. .new-class over .foo.bar')
|
12
14
|
end
|
@@ -15,6 +17,7 @@ module SCSSLint
|
|
15
17
|
private
|
16
18
|
|
17
19
|
def chained_class?(simple_sequence)
|
20
|
+
return unless simple_sequence.is_a?(Sass::Selector::SimpleSequence)
|
18
21
|
simple_sequence.members.count { |member| member.is_a?(Sass::Selector::Class) } >= 2
|
19
22
|
end
|
20
23
|
end
|
data/lib/scss_lint/version.rb
CHANGED
@@ -42,4 +42,13 @@ describe SCSSLint::Linter::ChainedClasses do
|
|
42
42
|
|
43
43
|
it { should report_lint line: 1 }
|
44
44
|
end
|
45
|
+
|
46
|
+
context 'with a chained class in a multiline comma sequence' do
|
47
|
+
let(:scss) { <<-SCSS }
|
48
|
+
.one,
|
49
|
+
.two.three {}
|
50
|
+
SCSS
|
51
|
+
|
52
|
+
it { should report_lint line: 2 }
|
53
|
+
end
|
45
54
|
end
|