Skip to content

Commit 6c48085

Browse files
authored
Add *-allowed-list/*-disallowed-list/*-required-list names for *-whitelist/*-blacklist/*-requirelist rules (stylelint#4845)
1 parent ba4701c commit 6c48085

File tree

98 files changed

+560
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+560
-333
lines changed

docs/maintainer-guide/issues.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Rename the title into a consistent format.
3434
You should:
3535

3636
- lead with the [CHANGELOG group names](pull-requests.md), but in the present tense:
37-
- "Remove y", e.g. "Remove unit-blacklist"
37+
- "Remove y", e.g. "Remove unit-disallowed-list"
3838
- "Deprecate x in y", e.g. "Deprecate resolvedNested option in selector-class-pattern"
39-
- "Add y", e.g. "Add unit-blacklist"
40-
- "Add x to y", e.g. "Add ignoreProperties: [] to property-blacklist"
39+
- "Add y", e.g. "Add unit-disallowed-list"
40+
- "Add x to y", e.g. "Add ignoreProperties: [] to property-disallowed-list"
4141
- "Fix false positives/negatives for x in y", e.g. "Fix false positives for Less mixins in color-no-hex"
4242
- use `*` if the issue applies to a group of rules, e.g. "Fix false negatives for SCSS variables in selector-\*-pattern"
4343

docs/maintainer-guide/pull-requests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ When merging a PR, you should:
2929
2. Prefix the item with either: "Removed", "Changed", "Deprecated", "Added", or "Fixed".
3030
3. Order the item within the group by the widest-reaching first to the smallest, and then alphabetically by rule name.
3131
4. Suffix the item with the relevant pull request number, using the complete GitHub URL so that it works on [the website](https://stylelint.io/CHANGELOG/).
32-
5. If applicable, lead the item with the name of the rule, e.g. "Fixed: `unit-blacklist` false positives for SCSS nested properties".
32+
5. If applicable, lead the item with the name of the rule, e.g. "Fixed: `unit-disallowed-list` false positives for SCSS nested properties".
3333
3. Post this update as a comment to the pull request.

docs/user-guide/configure.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can add any number of keys in the object. For example, you can:
6161

6262
- turn off `block-no-empty`
6363
- turn on `comment-empty-line-before` with a primary and secondary option
64-
- turn on `max-empty-lines` and `unit-whitelist` with primary options
64+
- turn on `max-empty-lines` and `unit-allowed-list` with primary options
6565

6666
```json
6767
{
@@ -74,7 +74,7 @@ You can add any number of keys in the object. For example, you can:
7474
}
7575
],
7676
"max-empty-lines": 2,
77-
"unit-whitelist": ["em", "rem", "%", "s"]
77+
"unit-allowed-list": ["em", "rem", "%", "s"]
7878
}
7979
}
8080
```

docs/user-guide/get-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ To further customize your stylelint configuration, you can adapt your:
4343
- [shared configs](configure.md#extends)
4444
- [plugins](configure.md#plugins)
4545

46-
We recommend you add [rules that limit language features](rules/list.md#limit-language-features) to your configuration, e.g. [`unit-whitelist`](../../lib/rules/unit-whitelist/README.md), [`selector-class-pattern`](../../lib/rules/selector-class-pattern/README.md) and [`selector-max-id`](../../lib/rules/selector-max-id/README.md). These are powerful rules that you can use to enforce non-stylistic consistency in your code.
46+
We recommend you add [rules that limit language features](rules/list.md#limit-language-features) to your configuration, e.g. [`unit-allowed-list`](../../lib/rules/unit-allowed-list/README.md), [`selector-class-pattern`](../../lib/rules/selector-class-pattern/README.md) and [`selector-max-id`](../../lib/rules/selector-max-id/README.md). These are powerful rules that you can use to enforce non-stylistic consistency in your code.
4747

4848
### Your usage
4949

docs/user-guide/rules/combine.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -275,33 +275,33 @@ You can do that with:
275275
}
276276
```
277277

278-
## `*-whitelist`, `*-blacklist`, `color-named` and applicable `*-no-*` rules
278+
## `*-allowed-list`, `*-disallowed-list`, `color-named` and applicable `*-no-*` rules
279279

280280
These rules work together to (dis)allow language features and constructs.
281281

282-
There are `*-whitelist` and `*-blacklist` rules that target the constructs of the CSS language: at-rules, functions, declarations (i.e. property-value pairs), properties and units. These rules (dis)allow any language features that make use of these constructs (e.g. `@media`, `rgb()`). However, there are features not caught by these `*-whitelist` and `*-blacklist` rules (or are, but would require complex regex to configure). There are individual rules, usually a `*-no-*` rule (e.g. `color-no-hex` and `selector-no-id`), to disallow each of these features.
282+
There are `*-allowed-list` and `*-disallowed-list` rules that target the constructs of the CSS language: at-rules, functions, declarations (i.e. property-value pairs), properties and units. These rules (dis)allow any language features that make use of these constructs (e.g. `@media`, `rgb()`). However, there are features not caught by these `*-allowed-list` and `*-disallowed-list` rules (or are, but would require complex regex to configure). There are individual rules, usually a `*-no-*` rule (e.g. `color-no-hex` and `selector-no-id`), to disallow each of these features.
283283

284-
Say you want to disallow the `@debug` language extension. You can do that using either the `at-rule-blacklist` or `at-rule-whitelist` rules because the `@debug` language extension uses the at-rule construct e.g.
284+
Say you want to disallow the `@debug` language extension. You can do that using either the `at-rule-disallowed-list` or `at-rule-allowed-list` rules because the `@debug` language extension uses the at-rule construct e.g.
285285

286286
```json
287287
{
288-
"at-rule-blacklist": ["debug"]
288+
"at-rule-disallowed-list": ["debug"]
289289
}
290290
```
291291

292292
Say you want to, for whatever reason, disallow the whole at-rule construct. You can do that using:
293293

294294
```json
295295
{
296-
"at-rule-whitelist": []
296+
"at-rule-allowed-list": []
297297
}
298298
```
299299

300-
Say you want to disallow the value `none` for the `border` properties. You can do that using either the `declaration-property-value-blacklist` or `declaration-property-value-whitelist` e.g.
300+
Say you want to disallow the value `none` for the `border` properties. You can do that using either the `declaration-property-value-disallowed-list` or `declaration-property-value-allowed-list` e.g.
301301

302302
```json
303303
{
304-
"declaration-property-value-blacklist": [
304+
"declaration-property-value-disallowed-list": [
305305
{
306306
"/^border/": ["none"]
307307
}
@@ -311,7 +311,7 @@ Say you want to disallow the value `none` for the `border` properties. You can d
311311

312312
## `color-*` and `function-*` rules
313313

314-
Most `<color>` values are _functions_. As such, they can be (dis)allowed using either the `function-blacklist` or `function-whitelist` rules. Two other color representations aren't functions: named colors and hex colors. There are two specific rules that (dis)allow these: `color-named` and `color-no-hex`, respectively.
314+
Most `<color>` values are _functions_. As such, they can be (dis)allowed using either the `function-allowed-list` or `function-disallowed-list` rules. Two other color representations aren't functions: named colors and hex colors. There are two specific rules that (dis)allow these: `color-named` and `color-no-hex`, respectively.
315315

316316
Say you want to enforce using a named color _if one exists for your chosen color_ and use `hwb` color if one does not, e.g.:
317317

@@ -323,23 +323,23 @@ a {
323323
}
324324
```
325325

326-
If you're taking a whitelisting approach, you can do that with:
326+
If you're taking an allow approach, you can do that with:
327327

328328
```json
329329
{
330330
"color-named": "always-where-possible",
331331
"color-no-hex": true,
332-
"function-whitelist": ["hwb"]
332+
"function-allowed-list": ["hwb"]
333333
}
334334
```
335335

336-
Or, if you're taking a blacklisting approach:
336+
Or, if you're taking a disallow approach:
337337

338338
```json
339339
{
340340
"color-named": "always-where-possible",
341341
"color-no-hex": true,
342-
"function-blacklist": ["/^rgb/", "/^hsl/", "gray"]
342+
"function-disallowed-list": ["/^rgb/", "/^hsl/", "gray"]
343343
}
344344
```
345345

@@ -349,12 +349,12 @@ This approach scales to when language extensions (that use the two built-in exte
349349
{
350350
"color-named": "never",
351351
"color-no-hex": true,
352-
"function-whitelist": ["my-color"]
352+
"function-allowed-list": ["my-color"]
353353
}
354354
```
355355

356356
## Manage conflicts
357357

358-
Each rule stands alone, so sometimes it's possible to configure rules such that they conflict with one another. For example, you could turn on two conflicting blacklist and whitelist rules, e.g. `unit-blacklist` and `unit-whitelist`.
358+
Each rule stands alone, so sometimes it's possible to configure rules such that they conflict with one another. For example, you could turn on two conflicting allow and disallow list rules, e.g. `unit-allowed-list` and `unit-disallowed-list`.
359359

360360
It's your responsibility as the configuration author to resolve these conflicts.

docs/user-guide/rules/list.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ Grouped first by the following categories and then by the [_thing_](http://apps.
101101

102102
### Function
103103

104-
- [`function-blacklist`](../../../lib/rules/function-blacklist/README.md): Specify a blacklist of disallowed functions.
104+
- [`function-allowed-list`](../../../lib/rules/function-allowed-list/README.md): Specify a list of allowed functions.
105+
- [`function-disallowed-list`](../../../lib/rules/function-disallowed-list/README.md): Specify a list of disallowed functions.
105106
- [`function-url-no-scheme-relative`](../../../lib/rules/function-url-no-scheme-relative/README.md): Disallow scheme-relative urls.
106-
- [`function-url-scheme-blacklist`](../../../lib/rules/function-url-scheme-blacklist/README.md): Specify a blacklist of disallowed URL schemes.
107-
- [`function-url-scheme-whitelist`](../../../lib/rules/function-url-scheme-whitelist/README.md): Specify a whitelist of allowed URL schemes.
108-
- [`function-whitelist`](../../../lib/rules/function-whitelist/README.md): Specify a whitelist of allowed functions.
107+
- [`function-url-scheme-allowed-list`](../../../lib/rules/function-url-scheme-allowed-list/README.md): Specify a list of allowed URL schemes.
108+
- [`function-url-scheme-disallowed-list`](../../../lib/rules/function-url-scheme-disallowed-list/README.md): Specify a list of disallowed URL schemes.
109109

110110
### Keyframes
111111

@@ -121,8 +121,8 @@ Grouped first by the following categories and then by the [_thing_](http://apps.
121121

122122
### Unit
123123

124-
- [`unit-blacklist`](../../../lib/rules/unit-blacklist/README.md): Specify a blacklist of disallowed units.
125-
- [`unit-whitelist`](../../../lib/rules/unit-whitelist/README.md): Specify a whitelist of allowed units.
124+
- [`unit-allowed-list`](../../../lib/rules/unit-allowed-list/README.md): Specify a list of allowed units.
125+
- [`unit-disallowed-list`](../../../lib/rules/unit-disallowed-list/README.md): Specify a list of disallowed units.
126126

127127
### Shorthand property
128128

@@ -138,30 +138,30 @@ Grouped first by the following categories and then by the [_thing_](http://apps.
138138

139139
### Property
140140

141-
- [`property-blacklist`](../../../lib/rules/property-blacklist/README.md): Specify a blacklist of disallowed properties.
141+
- [`property-allowed-list`](../../../lib/rules/property-allowed-list/README.md): Specify a list of allowed properties.
142+
- [`property-disallowed-list`](../../../lib/rules/property-disallowed-list/README.md): Specify a list of disallowed properties.
142143
- [`property-no-vendor-prefix`](../../../lib/rules/property-no-vendor-prefix/README.md): Disallow vendor prefixes for properties.
143-
- [`property-whitelist`](../../../lib/rules/property-whitelist/README.md): Specify a whitelist of allowed properties.
144144

145145
### Declaration
146146

147147
- [`declaration-block-no-redundant-longhand-properties`](../../../lib/rules/declaration-block-no-redundant-longhand-properties/README.md): Disallow longhand properties that can be combined into one shorthand property.
148148
- [`declaration-no-important`](../../../lib/rules/declaration-no-important/README.md): Disallow `!important` within declarations.
149-
- [`declaration-property-unit-blacklist`](../../../lib/rules/declaration-property-unit-blacklist/README.md): Specify a blacklist of disallowed property and unit pairs within declarations.
150-
- [`declaration-property-unit-whitelist`](../../../lib/rules/declaration-property-unit-whitelist/README.md): Specify a whitelist of allowed property and unit pairs within declarations.
151-
- [`declaration-property-value-blacklist`](../../../lib/rules/declaration-property-value-blacklist/README.md): Specify a blacklist of disallowed property and value pairs within declarations.
152-
- [`declaration-property-value-whitelist`](../../../lib/rules/declaration-property-value-whitelist/README.md): Specify a whitelist of allowed property and value pairs within declarations.
149+
- [`declaration-property-unit-allowed-list`](../../../lib/rules/declaration-property-unit-allowed-list/README.md): Specify a list of allowed property and unit pairs within declarations.
150+
- [`declaration-property-unit-disallowed-list`](../../../lib/rules/declaration-property-unit-disallowed-list/README.md): Specify a list of disallowed property and unit pairs within declarations.
151+
- [`declaration-property-value-allowed-list`](../../../lib/rules/declaration-property-value-allowed-list/README.md): Specify a list of allowed property and value pairs within declarations.
152+
- [`declaration-property-value-disallowed-list`](../../../lib/rules/declaration-property-value-disallowed-list/README.md): Specify a list of disallowed property and value pairs within declarations.
153153

154154
### Declaration block
155155

156156
- [`declaration-block-single-line-max-declarations`](../../../lib/rules/declaration-block-single-line-max-declarations/README.md): Limit the number of declarations within a single-line declaration block.
157157

158158
### Selector
159159

160-
- [`selector-attribute-operator-blacklist`](../../../lib/rules/selector-attribute-operator-blacklist/README.md): Specify a blacklist of disallowed attribute operators.
161-
- [`selector-attribute-operator-whitelist`](../../../lib/rules/selector-attribute-operator-whitelist/README.md): Specify a whitelist of allowed attribute operators.
160+
- [`selector-attribute-operator-allowed-list`](../../../lib/rules/selector-attribute-operator-allowed-list/README.md): Specify a list of allowed attribute operators.
161+
- [`selector-attribute-operator-disallowed-list`](../../../lib/rules/selector-attribute-operator-disallowed-list/README.md): Specify a list of disallowed attribute operators.
162162
- [`selector-class-pattern`](../../../lib/rules/selector-class-pattern/README.md): Specify a pattern for class selectors.
163-
- [`selector-combinator-blacklist`](../../../lib/rules/selector-combinator-blacklist/README.md): Specify a blacklist of disallowed combinators.
164-
- [`selector-combinator-whitelist`](../../../lib/rules/selector-combinator-whitelist/README.md): Specify a whitelist of allowed combinators.
163+
- [`selector-combinator-allowed-list`](../../../lib/rules/selector-combinator-allowed-list/README.md): Specify a list of allowed combinators.
164+
- [`selector-combinator-disallowed-list`](../../../lib/rules/selector-combinator-disallowed-list/README.md): Specify a list of disallowed combinators.
165165
- [`selector-id-pattern`](../../../lib/rules/selector-id-pattern/README.md): Specify a pattern for ID selectors.
166166
- [`selector-max-attribute`](../../../lib/rules/selector-max-attribute/README.md): Limit the number of attribute selectors in a selector.
167167
- [`selector-max-class`](../../../lib/rules/selector-max-class/README.md): Limit the number of classes in a selector.
@@ -176,33 +176,33 @@ Grouped first by the following categories and then by the [_thing_](http://apps.
176176
- [`selector-nested-pattern`](../../../lib/rules/selector-nested-pattern/README.md): Specify a pattern for the selectors of rules nested within rules.
177177
- [`selector-no-qualifying-type`](../../../lib/rules/selector-no-qualifying-type/README.md): Disallow qualifying a selector by type.
178178
- [`selector-no-vendor-prefix`](../../../lib/rules/selector-no-vendor-prefix/README.md): Disallow vendor prefixes for selectors.
179-
- [`selector-pseudo-class-blacklist`](../../../lib/rules/selector-pseudo-class-blacklist/README.md): Specify a blacklist of disallowed pseudo-class selectors.
180-
- [`selector-pseudo-class-whitelist`](../../../lib/rules/selector-pseudo-class-whitelist/README.md): Specify a whitelist of allowed pseudo-class selectors.
181-
- [`selector-pseudo-element-blacklist`](../../../lib/rules/selector-pseudo-element-blacklist/README.md): Specify a blacklist of disallowed pseudo-element selectors.
179+
- [`selector-pseudo-class-allowed-list`](../../../lib/rules/selector-pseudo-class-allowed-list/README.md): Specify a list of allowed pseudo-class selectors.
180+
- [`selector-pseudo-class-disallowed-list`](../../../lib/rules/selector-pseudo-class-disallowed-list/README.md): Specify a list of disallowed pseudo-class selectors.
181+
- [`selector-pseudo-element-allowed-list`](../../../lib/rules/selector-pseudo-element-allowed-list/README.md): Specify a list of allowed pseudo-element selectors.
182182
- [`selector-pseudo-element-colon-notation`](../../../lib/rules/selector-pseudo-element-colon-notation/README.md): Specify single or double colon notation for applicable pseudo-elements (Autofixable).
183-
- [`selector-pseudo-element-whitelist`](../../../lib/rules/selector-pseudo-element-whitelist/README.md): Specify a whitelist of allowed pseudo-element selectors.
183+
- [`selector-pseudo-element-disallowed-list`](../../../lib/rules/selector-pseudo-element-disallowed-list/README.md): Specify a list of disallowed pseudo-element selectors.
184184

185185
### Media feature
186186

187-
- [`media-feature-name-blacklist`](../../../lib/rules/media-feature-name-blacklist/README.md): Specify a blacklist of disallowed media feature names.
187+
- [`media-feature-name-allowed-list`](../../../lib/rules/media-feature-name-allowed-list/README.md): Specify a list of allowed media feature names.
188+
- [`media-feature-name-disallowed-list`](../../../lib/rules/media-feature-name-disallowed-list/README.md): Specify a list of disallowed media feature names.
188189
- [`media-feature-name-no-vendor-prefix`](../../../lib/rules/media-feature-name-no-vendor-prefix/README.md): Disallow vendor prefixes for media feature names.
189-
- [`media-feature-name-value-whitelist`](../../../lib/rules/media-feature-name-value-whitelist/README.md): Specify a whitelist of allowed media feature name and value pairs.
190-
- [`media-feature-name-whitelist`](../../../lib/rules/media-feature-name-whitelist/README.md): Specify a whitelist of allowed media feature names.
190+
- [`media-feature-name-value-allowed-list`](../../../lib/rules/media-feature-name-value-allowed-list/README.md): Specify a list of allowed media feature name and value pairs.
191191

192192
### Custom media
193193

194194
- [`custom-media-pattern`](../../../lib/rules/custom-media-pattern/README.md): Specify a pattern for custom media query names.
195195

196196
### At-rule
197197

198-
- [`at-rule-blacklist`](../../../lib/rules/at-rule-blacklist/README.md): Specify a blacklist of disallowed at-rules.
198+
- [`at-rule-allowed-list`](../../../lib/rules/at-rule-allowed-list/README.md): Specify a list of allowed at-rules.
199+
- [`at-rule-disallowed-list`](../../../lib/rules/at-rule-disallowed-list/README.md): Specify a list of disallowed at-rules.
199200
- [`at-rule-no-vendor-prefix`](../../../lib/rules/at-rule-no-vendor-prefix/README.md): Disallow vendor prefixes for at-rules.
200-
- [`at-rule-property-requirelist`](../../../lib/rules/at-rule-property-requirelist/README.md): Specify a requirelist of properties for an at-rule.
201-
- [`at-rule-whitelist`](../../../lib/rules/at-rule-whitelist/README.md): Specify a whitelist of allowed at-rules.
201+
- [`at-rule-property-required-list`](../../../lib/rules/at-rule-property-required-list/README.md): Specify a list of required properties for an at-rule.
202202

203203
### Comment
204204

205-
- [`comment-word-blacklist`](../../../lib/rules/comment-word-blacklist/README.md): Specify a blacklist of disallowed words within comments.
205+
- [`comment-word-disallowed-list`](../../../lib/rules/comment-word-disallowed-list/README.md): Specify a list of disallowed words within comments.
206206

207207
### General / Sheet
208208

docs/user-guide/rules/regex.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
The following classes of rules support regex:
44

5-
- `*-blacklist`
6-
- `*-whitelist`
5+
- `*-allowed-list`
6+
- `*-disallowed-list`
77
- `*-pattern`
88

99
As does the `ignore*` secondary options.

example.png

-1.35 KB
Loading

0 commit comments

Comments
 (0)