UNPKG

2.31 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### `checkPrefixed: true | false` (default: `false`)
131
132If `true`, this rule will check vendor-prefixed properties.
133
134For example with `true`:
135
136The following patterns are _not_ considered violations:
137
138<!-- prettier-ignore -->
139```css
140a {
141 -webkit-overflow-scrolling: auto;
142}
143```
144
145<!-- prettier-ignore -->
146```css
147a {
148 -moz-box-flex: 0;
149}
150```
151
152The following patterns are considered violations:
153
154<!-- prettier-ignore -->
155```css
156a {
157 -moz-align-self: center;
158}
159```
160
161<!-- prettier-ignore -->
162```css
163a {
164 -moz-overflow-scrolling: center;
165}
166```