Skip to content
This repository was archived by the owner on Feb 25, 2021. It is now read-only.

Commit 610f236

Browse files
authored
feat: update selector-pseudo-element-colon-notation to use double
2 parents 08a6c9f + fd0d34d commit 610f236

File tree

8 files changed

+62
-8
lines changed

8 files changed

+62
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Changed: Improved `no-duplicate-selectors` tests.
66
- Removed: Jest snapshots.
77
- Removed: `stylelint < 9.1.3` compatibility.
8+
- Updated: `selector-pseudo-element-colon-notation` to use `double`
89
- Updated: `stylelint-config-recommended` to `2.1.0`.
910
- Updated: `stylelint-scss` to `2.1.0`.
1011
- Updated: Bump minimum Node.js required version to `8.9.3`.

__tests__/selectors-invalid.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,7 @@ input[type='text'] { /* Should be [type="text"] */
2525
.selectorA {
2626
color: #000;
2727
}
28+
29+
.selector:after {
30+
color: #000;
31+
}

__tests__/selectors-invalid.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,10 @@ p {
2525
margin: 0;
2626
}
2727
}
28+
29+
span {
30+
31+
& .class:after {
32+
margin: 0;
33+
}
34+
}

__tests__/selectors-scss.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ describe( 'flags warnings with invalid selectors scss', () => {
4545
) );
4646
});
4747

48-
it( 'flags four warnings', () => {
48+
it( 'flags six warnings', () => {
4949
return result.then( data => (
50-
expect( data.results[0].warnings ).toHaveLength( 4 )
50+
expect( data.results[0].warnings ).toHaveLength( 6 )
5151
) );
5252
});
5353

__tests__/selectors-valid.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
input[type="text"] {
66
line-height: 1.1;
77
}
8+
9+
.selector::after {
10+
color: #000;
11+
}

__tests__/selectors-valid.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ p {
2727
margin: 0;
2828
}
2929
}
30+
31+
span {
32+
33+
&,
34+
.foo::after {
35+
color: #000;
36+
}
37+
}

__tests__/selectors.test.js

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe( 'flags warnings with invalid selectors css', () => {
4747

4848
it( 'flags warnings', () => {
4949
return result.then( data => (
50-
expect( data.results[0].warnings ).toHaveLength( 3 )
50+
expect( data.results[0].warnings ).toHaveLength( 4 )
5151
) );
5252
});
5353

@@ -113,13 +113,13 @@ describe( 'flags warnings with invalid selectors css', () => {
113113

114114
it( 'correct third warning text', () => {
115115
return result.then( data => (
116-
expect( data.results[0].warnings[2].text ).toBe( 'Expected double quotes (string-quotes)' )
116+
expect( data.results[0].warnings[2].text ).toBe( 'Expected double colon pseudo-element notation (selector-pseudo-element-colon-notation)' )
117117
) );
118118
});
119119

120120
it( 'correct third warning rule flagged', () => {
121121
return result.then( data => (
122-
expect( data.results[0].warnings[2].rule ).toBe( 'string-quotes' )
122+
expect( data.results[0].warnings[2].rule ).toBe( 'selector-pseudo-element-colon-notation' )
123123
) );
124124
});
125125

@@ -131,13 +131,43 @@ describe( 'flags warnings with invalid selectors css', () => {
131131

132132
it( 'correct third warning line number', () => {
133133
return result.then( data => (
134-
expect( data.results[0].warnings[2].line ).toBe( 17 )
134+
expect( data.results[0].warnings[2].line ).toBe( 29 )
135135
) );
136136
});
137137

138138
it( 'correct third warning column number', () => {
139139
return result.then( data => (
140-
expect( data.results[0].warnings[2].column ).toBe( 12 )
140+
expect( data.results[0].warnings[2].column ).toBe( 10 )
141+
) );
142+
});
143+
144+
it( 'correct fourth warning text', () => {
145+
return result.then( data => (
146+
expect( data.results[0].warnings[3].text ).toBe( 'Expected double quotes (string-quotes)' )
147+
) );
148+
});
149+
150+
it( 'correct fourth warning rule flagged', () => {
151+
return result.then( data => (
152+
expect( data.results[0].warnings[3].rule ).toBe( 'string-quotes' )
153+
) );
154+
});
155+
156+
it( 'correct fourth warning severity flagged', () => {
157+
return result.then( data => (
158+
expect( data.results[0].warnings[3].severity ).toBe( 'error' )
159+
) );
160+
});
161+
162+
it( 'correct fourth warning line number', () => {
163+
return result.then( data => (
164+
expect( data.results[0].warnings[3].line ).toBe( 17 )
165+
) );
166+
});
167+
168+
it( 'correct fourth warning column number', () => {
169+
return result.then( data => (
170+
expect( data.results[0].warnings[3].column ).toBe( 12 )
141171
) );
142172
});
143173
});

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ module.exports = {
9494
'selector-pseudo-class-case': 'lower',
9595
'selector-pseudo-class-parentheses-space-inside': 'never',
9696
'selector-pseudo-element-case': 'lower',
97-
'selector-pseudo-element-colon-notation': 'single',
97+
'selector-pseudo-element-colon-notation': 'double',
9898
'selector-type-case': 'lower',
9999
'string-quotes': 'double',
100100
'unit-case': 'lower',

0 commit comments

Comments
 (0)