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