.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / declaration-block-no-redundant-longhand-properties / README.md
1 # declaration-block-no-redundant-longhand-properties
2
3 Disallow longhand properties that can be combined into one shorthand property.
4
5 ```css
6   a {
7     padding-top: 1px;
8     padding-right: 2px;
9     padding-bottom: 3px;
10     padding-left: 4px; }
11 /** ↑
12  *  These longhand properties */
13 ```
14
15 The longhand properties in the example above can be more concisely written as:
16
17 ```css
18 a {
19   padding: 1px 2px 3px 4px;
20 }
21 ```
22
23 This rule will only complain if you've used the longhand equivalent of *all* the properties that the shorthand will set.
24
25 This rule complains when the following shorthand properties can be used:
26
27 -   `margin`
28 -   `padding`
29 -   `background`
30 -   `font`
31 -   `border`
32 -   `border-top`
33 -   `border-bottom`
34 -   `border-left`
35 -   `border-right`
36 -   `border-width`
37 -   `border-style`
38 -   `border-color`
39 -   `list-style`
40 -   `border-radius`
41 -   `transition`
42 -   `animation`
43 -   `border-block-end`
44 -   `border-block-start`
45 -   `border-image`
46 -   `border-inline-end`
47 -   `border-inline-start`
48 -   `column-rule`
49 -   `columns`
50 -   `flex`
51 -   `flex-flow`
52 -   `grid`
53 -   `grid-area`
54 -   `grid-column`
55 -   `grid-gap`
56 -   `grid-row`
57 -   `grid-template`
58 -   `outline`
59 -   `text-decoration`
60 -   `text-emphasis`
61 -   `mask`
62
63 ## Options
64
65 ### `true`
66
67 The following patterns are considered violations:
68
69 ```css
70 a {
71   margin-top: 1px;
72   margin-right: 2px;
73   margin-bottom: 3px;
74   margin-left: 4px;
75 }
76 ```
77
78 ```css
79 a {
80   font-style: italic;
81   font-variant: normal;
82   font-weight: bold;
83   font-stretch: normal;
84   font-size: 14px;
85   line-height: 1.2;
86   font-family: serif;
87 }
88 ```
89
90 ```css
91 a {
92   -webkit-transition-property: top;
93   -webkit-transition-duration: 2s;
94   -webkit-transition-timing-function: ease;
95   -webkit-transition-delay: 0.5s;
96 }
97 ```
98
99 The following patterns are *not* considered violations:
100
101 ```css
102 a {
103   margin: 1px 2px 3px 4px;
104 }
105 ```
106
107 ```css
108 a {
109   font: italic normal bold normal 14px/1.2 serif;
110 }
111 ```
112
113 ```css
114 a {
115   -webkit-transition: top 2s ease 0.5s;
116 }
117 ```
118
119 ```css
120 a {
121   margin-top: 1px;
122   margin-right: 2px;
123 }
124 ```
125
126 ```css
127 a {
128   margin-top: 1px;
129   margin-right: 2px;
130   margin-bottom: 3px;
131 }
132 ```
133
134 ## Optional secondary options
135
136 ### `ignoreShorthands: ["/regex/", "string"]`
137
138 Given:
139
140 ```js
141 ["padding", "/border/"]
142 ```
143
144 The following patterns are *not* considered violations:
145
146 ```css
147 a {
148   padding-top: 20px;
149   padding-right: 10px;
150   padding-bottom: 30px;
151   padding-left: 10px;
152 }
153 ```
154
155 ```css
156 a {
157   border-top-width: 1px;
158   border-bottom-width: 1px;
159   border-left-width: 1px;
160   border-right-width: 1px;
161 }
162 ```
163
164 ```css
165 a {
166   border-top-width: 1px;
167   border-bottom-width: 1px;
168   border-left-width: 1px;
169   border-right-width: 1px;
170 }
171 ```
172
173 ```css
174 a {
175   border-top-color: green;
176   border-top-style: double;
177   border-top-width: 7px;
178 }
179 ```