scss_lint 0.54.0 → 0.55.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +2 -1
- data/data/properties.txt +2 -0
- data/data/pseudo-elements.txt +1 -0
- data/lib/scss_lint/linter/selector_format.rb +10 -0
- data/lib/scss_lint/version.rb +1 -1
- data/spec/scss_lint/linter/selector_format_spec.rb +82 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01a5421ff7215339318f8408e67d4b9825280594
|
4
|
+
data.tar.gz: 7186bfb3c48b30597044c58f5626be8bd93bf278
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a58456b3a1dc059e1b03ad9066a5ce6d3efa3be4f313d982dc5dbe3d5b9ab20b9fa1733097f3ae23579b50aa01bb1d1e4707220de6fe67f60563c4a88d1fb8e
|
7
|
+
data.tar.gz: cdd7914be549c8c39a1ed144bb52d23d5c6141f3d345eb02fce248929502591ac22674f703adba17ffa94c38c3543e950023040287bf2ca7de4652a48c4b51a2
|
data/config/default.yml
CHANGED
@@ -142,6 +142,7 @@ linters:
|
|
142
142
|
'ch', 'em', 'ex', 'rem', # Font-relative lengths
|
143
143
|
'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths
|
144
144
|
'vh', 'vw', 'vmin', 'vmax', # Viewport-percentage lengths
|
145
|
+
'fr', # Grid fractional lengths
|
145
146
|
'deg', 'grad', 'rad', 'turn', # Angle
|
146
147
|
'ms', 's', # Duration
|
147
148
|
'Hz', 'kHz', # Frequency
|
@@ -164,7 +165,7 @@ linters:
|
|
164
165
|
|
165
166
|
SelectorFormat:
|
166
167
|
enabled: true
|
167
|
-
convention: hyphenated_lowercase # or '
|
168
|
+
convention: hyphenated_lowercase # or 'classic_BEM', or 'hyphenated_BEM', or 'snake_case', or 'camel_case', or a regex pattern
|
168
169
|
|
169
170
|
Shorthand:
|
170
171
|
enabled: true
|
data/data/properties.txt
CHANGED
@@ -186,6 +186,7 @@ flood-opacity
|
|
186
186
|
flow-from
|
187
187
|
flow-into
|
188
188
|
font
|
189
|
+
font-display
|
189
190
|
font-family
|
190
191
|
font-feature-settings
|
191
192
|
font-kerning
|
@@ -244,6 +245,7 @@ inline-box-align
|
|
244
245
|
inline-size
|
245
246
|
isolation
|
246
247
|
justify-content
|
248
|
+
justify-items
|
247
249
|
justify-self
|
248
250
|
kerning
|
249
251
|
left
|
data/data/pseudo-elements.txt
CHANGED
@@ -53,6 +53,16 @@ module SCSSLint
|
|
53
53
|
explanation: 'should be written in camelCase format',
|
54
54
|
validator: ->(name) { name =~ /^[a-z][a-zA-Z0-9]*$/ },
|
55
55
|
},
|
56
|
+
'classic_BEM' => {
|
57
|
+
explanation: 'should be written in classic BEM (Block Element Modifier) format',
|
58
|
+
validator: lambda do |name|
|
59
|
+
name =~ /
|
60
|
+
^[a-z]([-]?[a-z0-9]+)*
|
61
|
+
(__[a-z0-9]([-]?[a-z0-9]+)*)?
|
62
|
+
((_[a-z0-9]([-]?[a-z0-9]+)*){1,2})?$
|
63
|
+
/x
|
64
|
+
end
|
65
|
+
},
|
56
66
|
'hyphenated_BEM' => {
|
57
67
|
explanation: 'should be written in hyphenated BEM (Block Element Modifier) format',
|
58
68
|
validator: ->(name) { name !~ /[A-Z]|-{3}|_{3}|[^_]_[^_]/ },
|
data/lib/scss_lint/version.rb
CHANGED
@@ -454,6 +454,88 @@ describe SCSSLint::Linter::SelectorFormat do
|
|
454
454
|
end
|
455
455
|
end
|
456
456
|
|
457
|
+
context 'when the classic_BEM convention is specified' do
|
458
|
+
let(:linter_config) { { 'convention' => 'classic_BEM' } }
|
459
|
+
|
460
|
+
context 'when a name contains no underscores or hyphens' do
|
461
|
+
let(:scss) { '.block {}' }
|
462
|
+
|
463
|
+
it { should_not report_lint }
|
464
|
+
end
|
465
|
+
|
466
|
+
context 'when a name contains single hyphen' do
|
467
|
+
let(:scss) { '.b-block {}' }
|
468
|
+
|
469
|
+
it { should_not report_lint }
|
470
|
+
end
|
471
|
+
|
472
|
+
context 'when a name contains multiple hyphens' do
|
473
|
+
let(:scss) { '.b-block-name {}' }
|
474
|
+
|
475
|
+
it { should_not report_lint }
|
476
|
+
end
|
477
|
+
|
478
|
+
context 'when a name contains multiple hyphens in a row' do
|
479
|
+
let(:scss) { '.b-block--modifier {}' }
|
480
|
+
|
481
|
+
it { should report_lint }
|
482
|
+
end
|
483
|
+
|
484
|
+
context 'when a name contains a single underscore' do
|
485
|
+
let(:scss) { '.block_modifier {}' }
|
486
|
+
|
487
|
+
it { should_not report_lint }
|
488
|
+
end
|
489
|
+
|
490
|
+
context 'when a block has name-value modifier' do
|
491
|
+
let(:scss) { '.block_modifier_value {}' }
|
492
|
+
|
493
|
+
it { should_not report_lint }
|
494
|
+
end
|
495
|
+
|
496
|
+
context 'when a block has name-value modifier with lots of hyphens' do
|
497
|
+
let(:scss) { '.b-block-name_modifier-name-here_value-name-here {}' }
|
498
|
+
|
499
|
+
it { should_not report_lint }
|
500
|
+
end
|
501
|
+
|
502
|
+
context 'when a name has double underscores' do
|
503
|
+
let(:scss) { '.b-block__element {}' }
|
504
|
+
|
505
|
+
it { should_not report_lint }
|
506
|
+
end
|
507
|
+
|
508
|
+
context 'when element goes after block with modifier' do
|
509
|
+
let(:scss) { '.block_modifier_value__element {}' }
|
510
|
+
|
511
|
+
it { should report_lint }
|
512
|
+
end
|
513
|
+
|
514
|
+
context 'when element has modifier' do
|
515
|
+
let(:scss) { '.block__element_modifier_value {}' }
|
516
|
+
|
517
|
+
it { should_not report_lint }
|
518
|
+
end
|
519
|
+
|
520
|
+
context 'when element has not paired modifier' do
|
521
|
+
let(:scss) { '.block__element_modifier {}' }
|
522
|
+
|
523
|
+
it { should_not report_lint }
|
524
|
+
end
|
525
|
+
|
526
|
+
context 'when element has hypenated modifier' do
|
527
|
+
let(:scss) { '.block__element--modifier {}' }
|
528
|
+
|
529
|
+
it { should report_lint }
|
530
|
+
end
|
531
|
+
|
532
|
+
context 'when element has hypenated paired modifier' do
|
533
|
+
let(:scss) { '.block__element--modifier_value {}' }
|
534
|
+
|
535
|
+
it { should report_lint }
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
457
539
|
context 'when the strict_BEM convention is specified' do
|
458
540
|
let(:linter_config) { { 'convention' => 'strict_BEM' } }
|
459
541
|
|
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.
|
4
|
+
version: 0.55.0
|
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: 2017-
|
12
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -272,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
272
272
|
version: '0'
|
273
273
|
requirements: []
|
274
274
|
rubyforge_project:
|
275
|
-
rubygems_version: 2.6.
|
275
|
+
rubygems_version: 2.6.13
|
276
276
|
signing_key:
|
277
277
|
specification_version: 4
|
278
278
|
summary: SCSS lint tool
|
@@ -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:
|