You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ Setup plugin in [stylelint config](http://stylelint.io/user-guide/configuration/
35
35
-[atrules](#atrules)
36
36
-[properties](#properties)
37
37
-[types](#types)
38
-
-[ignore](#ignore)
38
+
-[ignore](#ignore) (deprecated)
39
39
-[ignoreAtrules](#ignoreatrules)
40
40
-[ignoreProperties](#ignoreproperties)
41
41
-[ignoreValue](#ignorevalue)
@@ -175,10 +175,10 @@ Works the same as [`ignoreProperties`](#ignoreproperties) but **deprecated**, us
175
175
176
176
#### ignoreAtrules
177
177
178
-
Type: `Array<string>` or `false`
178
+
Type: `Array<string|RegExp>` or `false`
179
179
Default: `false`
180
180
181
-
Defines a list of at-rules names that should be ignored by the plugin. Ignorance for an at-rule means no validation for its name, prelude or descriptors. The names provided are used for full case-insensitive matching, i.e. a vendor prefix is mandatory and prefixed names should be provided as well if you need to ignore them.
181
+
Defines a list of at-rules names that should be ignored by the plugin. Ignorance for an at-rule means no validation for its name, prelude or descriptors. The names provided are used for full case-insensitive matching, i.e. a vendor prefix is mandatory and prefixed names should be provided as well if you need to ignore them. You can use [RegExp patterns](#regexp-patterns) in the list as well.
182
182
183
183
```json
184
184
{
@@ -195,7 +195,7 @@ Defines a list of at-rules names that should be ignored by the plugin. Ignorance
195
195
196
196
#### ignoreProperties
197
197
198
-
Type: `Array<string>` or `false`
198
+
Type: `Array<string|RegExp>` or `false`
199
199
Default: `false`
200
200
201
201
Defines a list of property names that should be ignored by the plugin. The names provided are used for full case-insensitive matching, i.e. a vendor prefix is mandatory and prefixed names should be provided as well if you need to ignore them.
@@ -213,7 +213,7 @@ Defines a list of property names that should be ignored by the plugin. The names
213
213
}
214
214
```
215
215
216
-
In this example, plugin will not test declarations with a property name `composes`, `mask` or `-webkit-mask`, i.e. no warnings for these declarations would be raised.
216
+
In this example, plugin will not test declarations with a property name `composes`, `mask` or `-webkit-mask`, i.e. no warnings for these declarations would be raised. You can use [RegExp patterns](#regexp-patterns) in the list as well.
217
217
218
218
#### ignoreValue
219
219
@@ -237,6 +237,18 @@ Defines a pattern for values that should be ignored by the validator.
237
237
238
238
For this example, the plugin will not report warnings for values which is matched the given pattern. However, warnings will still be reported for unknown properties.
239
239
240
+
## RegExp patterns
241
+
242
+
In some cases a more general match patterns are needed instead of exact name matching. In such cases a RegExp pattern can be used.
243
+
244
+
Since CSS names are an indentifiers which can't contain any RegExp special character, distiguish between a regular name and RegExp is a trivial problem. When the plugins meets a string in a ignore pattern list which contains any character other than `a-z` (case-insensitive), `0-9` or `-`, it produce a RegExp using the expression `new RegExp('^(' + pattern + ')$', 'i')`. In other words, the pattern should be fully matched case-insensitive.
245
+
246
+
To have a full control over a RegExp pattern, a regular RegExp instance or its stringified version (i.e. `"/pattern/flags?"`) can be used.
247
+
248
+
-`"foo|bar"` transforms into `/^(foo|bar)$/i`
249
+
-`"/foo|bar/i"` transforms into `/foo|bar/i` (note: it's not the same as previous RegExp, since not requires a full match with a name)
250
+
-`/foo|bar/` used as is (note: with no `i` flag a matching will be case-sensitive which makes no sense in CSS)
0 commit comments