.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / selector-class-pattern / README.md
1 # selector-class-pattern
2
3 Specify a pattern for class selectors.
4
5 ```css
6     .foo, #bar.baz span, #hoo[disabled] { color: pink; }
7 /** ↑         ↑
8  * These class selectors */
9 ```
10
11 This rule ignores non-outputting Less mixin definitions and called Less mixins.
12
13 Escaped selectors (e.g. `.u-size-11\/12\@sm`) are parsed as escaped twice (e.g. `.u-size-11\\/12\\@sm`). Your RegExp should account for that.
14
15 ## Options
16
17 `regex|string`
18
19 A string will be translated into a RegExp — `new RegExp(yourString)` — so *be sure to escape properly*.
20
21 The selector value *after `.`* will be checked. No need to include `.` in your pattern.
22
23 Given the string:
24
25 ```js
26 "foo-[a-z]+"
27 ```
28
29 The following patterns are considered violations:
30
31 ```css
32 .foop {}
33 ```
34
35 ```css
36 .foo-BAR {}
37 ```
38
39 ```css
40 div > #zing + .foo-BAR {}
41 ```
42
43 The following patterns are *not* considered violations:
44
45 ```css
46 .foo-bar {}
47 ```
48
49 ```css
50 div > #zing + .foo-bar {}
51 ```
52
53 ```css
54 #foop {}
55 ```
56
57 ```css
58 [foo='bar'] {}
59 ```
60
61 ```less
62 .foop() {}
63 ```
64
65 ```less
66 .foo-bar {
67   .foop;
68 }
69 ```
70
71 ## Optional secondary options
72
73 ### `resolveNestedSelectors: true | false` (default: `false`)
74
75 This option will resolve nested selectors with `&` interpolation.
76
77 For example, with `true`.
78
79 Given the string:
80
81 ```js
82 "^[A-Z]+$"
83 ```
84
85 The following patterns are considered violations:
86
87 ```css
88 .A {
89   &__B {} /* resolved to ".A__B" */
90 }
91 ```
92
93 The following patterns are *not* considered violations:
94
95 ```css
96 .A {
97   &B {} /* resolved to ".AB" */
98 }
99 ```