UNPKG

904 BMarkdownView Raw
1# selector-pseudo-element-whitelist
2
3Specify a whitelist of allowed pseudo-element selectors.
4
5<!-- prettier-ignore -->
6```css
7 a::before {}
8/** ↑
9 * This pseudo-element selector */
10```
11
12This rule ignores:
13
14- CSS2 pseudo-elements i.e. those prefixed with a single colon
15- selectors that use variable interpolation e.g. `::#{$variable} {}`
16
17## Options
18
19`array|string|regex`: `["array", "of", "unprefixed", "pseudo-elements" or "regex"]|"pseudo-element"|/regex/`
20
21Given:
22
23```
24["before", "/^my-/i"]
25```
26
27The following patterns are considered violations:
28
29<!-- prettier-ignore -->
30```css
31a::after {}
32```
33
34<!-- prettier-ignore -->
35```css
36a::not-my-pseudo-element {}
37```
38
39The following patterns are _not_ considered violations:
40
41<!-- prettier-ignore -->
42```css
43a::before {}
44```
45
46<!-- prettier-ignore -->
47```css
48a::my-pseudo-element {}
49```
50
51<!-- prettier-ignore -->
52```css
53a::MY-OTHER-pseudo-element {}
54```