.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / declaration-block-no-duplicate-properties / README.md
1 # declaration-block-no-duplicate-properties
2
3 Disallow duplicate properties within declaration blocks.
4
5 ```css
6 a { color: pink; color: orange; }
7 /** ↑            ↑
8  * These duplicated properties */
9 ```
10
11 This rule ignores variables (`$sass`, `@less`, `--custom-property`).
12
13 ## Options
14
15 ### `true`
16
17 The following patterns are considered violations:
18
19 ```css
20 a { color: pink; color: orange; }
21 ```
22
23 ```css
24 a { color: pink; background: orange; color: orange }
25 ```
26
27 The following patterns are *not* considered violations:
28
29 ```css
30 a { color: pink; }
31 ```
32
33 ```css
34 a { color: pink; background: orange; }
35 ```
36
37 ## Optional secondary options
38
39 ### `ignore: ["consecutive-duplicates"]`
40
41 Ignore consecutive duplicated properties.
42
43 They can prove to be useful fallbacks for older browsers.
44
45 The following patterns are considered violations:
46
47 ```css
48 p {
49   font-size: 16px;
50   font-weight: 400;
51   font-size: 1rem;
52 }
53 ```
54
55 The following patterns are *not* considered violations:
56
57 ```css
58 p {
59   font-size: 16px;
60   font-size: 1rem;
61   font-weight: 400;
62 }
63 ```
64
65 ### `ignore: ["consecutive-duplicates-with-different-values"]`
66
67 Ignore consecutive duplicated properties with different values.
68
69 Including duplicate properties (fallbacks) is useful to deal with older browsers support for CSS properties. E.g. using 'px' units when 'rem' isn't available.
70
71 The following patterns are considered violations:
72
73 ```css
74 /* properties with the same value */
75 p {
76   font-size: 16px;  
77   font-size: 16px;
78   font-weight: 400;
79 }
80 ```
81
82 ```css
83 /* nonconsecutive duplicates */
84 p {
85   font-size: 16px;
86   font-weight: 400;
87   font-size: 1rem;
88 }
89 ```
90
91 The following patterns are *not* considered violations:
92
93 ```css
94 p {
95   font-size: 16px;
96   font-size: 1rem;
97   font-weight: 400;
98 }
99 ```
100
101 ### `ignoreProperties: ["/regex/", "non-regex"]`
102
103 Ignore duplicates of specific properties.
104
105 Given:
106
107 ```js
108 ["color", "/background\-/"]
109 ```
110
111 The following patterns are considered violations:
112
113 ```css
114 a { color: pink; background: orange; background: white; }
115 ```
116
117 ```css
118 a { background: orange; color: pink; background: white; }
119 ```
120
121 The following patterns are *not* considered violations:
122
123 ```css
124 a { color: pink; color: orange; background-color: orange; background-color: white; }
125 ```
126
127 ```css
128 a { color: pink; background-color: orange; color: orange; background-color: white; }
129 ```