UNPKG

2.6 kBMarkdownView Raw
1# property-no-unknown
2
3Disallow unknown properties.
4
5<!-- prettier-ignore -->
6```css
7a { heigth: 100%; }
8/** ↑
9 * This property */
10```
11
12This rule considers properties defined in the [CSS Specifications and browser specific properties](https://github.com/betit/known-css-properties#source) to be known.
13
14This rule ignores:
15
16- variables (`$sass`, `@less`, `--custom-property`)
17- vendor-prefixed properties (e.g., `-moz-align-self`, `-webkit-align-self`)
18
19Use option `checkPrefixed` described below to turn on checking of vendor-prefixed properties.
20
21## Options
22
23### `true`
24
25The following patterns are considered violations:
26
27<!-- prettier-ignore -->
28```css
29a {
30 colr: blue;
31}
32```
33
34<!-- prettier-ignore -->
35```css
36a {
37 my-property: 1;
38}
39```
40
41The following patterns are _not_ considered violations:
42
43<!-- prettier-ignore -->
44```css
45a {
46 color: green;
47}
48```
49
50<!-- prettier-ignore -->
51```css
52a {
53 fill: black;
54}
55```
56
57<!-- prettier-ignore -->
58```css
59a {
60 -moz-align-self: center;
61}
62```
63
64<!-- prettier-ignore -->
65```css
66a {
67 -webkit-align-self: center;
68}
69```
70
71<!-- prettier-ignore -->
72```css
73a {
74 align-self: center;
75}
76```
77
78## Optional secondary options
79
80### `ignoreProperties: ["/regex/", /regex/, "string"]`
81
82Given:
83
84```
85["/^my-/", "custom"]
86```
87
88The following patterns are _not_ considered violations:
89
90<!-- prettier-ignore -->
91```css
92a {
93 my-property: 10px;
94}
95```
96
97<!-- prettier-ignore -->
98```css
99a {
100 my-other-property: 10px;
101}
102```
103
104<!-- prettier-ignore -->
105```css
106a {
107 custom: 10px;
108}
109```
110
111### `ignoreSelectors: ["/regex/", /regex/, "string"]`
112
113Skips checking properties of the given selectors against this rule.
114
115Given:
116
117```
118[":root"]
119```
120
121The following patterns are _not_ considered violations:
122
123<!-- prettier-ignore -->
124```css
125:root {
126 my-property: blue;
127}
128```
129
130### `ignoreAtRules: ["/regex/", /regex/, "string"]`
131
132Ignores properties nested within specified at-rules.
133
134Given:
135
136```
137["supports"]
138```
139
140The following patterns are _not_ considered violations:
141
142<!-- prettier-ignore -->
143```css
144@supports (display: grid) {
145 a {
146 my-property: 1;
147 }
148}
149```
150
151### `checkPrefixed: true | false` (default: `false`)
152
153If `true`, this rule will check vendor-prefixed properties.
154
155For example with `true`:
156
157The following patterns are _not_ considered violations:
158
159<!-- prettier-ignore -->
160```css
161a {
162 -webkit-overflow-scrolling: auto;
163}
164```
165
166<!-- prettier-ignore -->
167```css
168a {
169 -moz-box-flex: 0;
170}
171```
172
173The following patterns are considered violations:
174
175<!-- prettier-ignore -->
176```css
177a {
178 -moz-align-self: center;
179}
180```
181
182<!-- prettier-ignore -->
183```css
184a {
185 -moz-overflow-scrolling: center;
186}
187```