.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / selector-nested-pattern / README.md
1 # selector-nested-pattern
2
3 Specify a pattern for the selectors of rules nested within rules.
4
5 ```css
6     a {
7       color: orange;
8       &:hover { color: pink; }
9     } ↑
10 /**   ↑
11  * These nested selectors */
12 ```
13
14 Non-standard selectors (e.g. selectors with Sass or Less interpolation) and selectors of rules nested within at-rules are ignored.
15
16 ## Options
17
18 `regex|string`
19
20 A string will be translated into a RegExp — `new RegExp(yourString)` — so *be sure to escape properly*.
21
22 The selector value will be checked in its entirety. If you'd like to allow for combinators and commas, you must incorporate them into your pattern.
23
24 Given the string:
25
26 ```js
27 "^&:(?:hover|focus)$"
28 ```
29
30 The following patterns are considered violations:
31
32 ```css
33 a {
34   .bar {}
35 }
36 ```
37
38 ```css
39 a {
40   .bar:hover {}
41 }
42 ```
43
44 ```css
45 a {
46   &:hover,
47   &:focus {}
48 }
49 ```
50
51 The following patterns are *not* considered violations:
52
53 ```css
54 a {
55   &:hover {}
56 }
57 ```
58
59 ```css
60 a {
61   &:focus {}
62 }
63 ```
64
65 ```css
66 a {
67   &:hover {}
68   &:focus {}
69 }
70 ```