Skip to content

Commit

Permalink
Re-instate *-blacklist/*-requirelist/*-whitelist rules
Browse files Browse the repository at this point in the history
The aliasing approach taken for these rule renaming presented user
experience problems [1]. To resolve these problems the preference is to
revert on the aliasing strategy and instead return to a deprecation
strategy. The first step towards this is re-instating these rules.

As per the preference of jeddy3 [2] these rules are re-instated using a copy
and paste strategy, with the expectation these will be removed in the
next major release. An approach that didn't involve copy and pasting was
previously introduced in [3] and could be looked at again if maintaining this
duplicate code proves problematic.

[1]: stylelint#4854 (comment)
[2]: stylelint#4854 (comment)
[3]: stylelint@e93e44c
  • Loading branch information
kevindew committed Aug 24, 2020
1 parent 42c68d6 commit af05f79
Show file tree
Hide file tree
Showing 85 changed files with 81 additions and 299 deletions.
41 changes: 0 additions & 41 deletions lib/__tests__/aliasedRules.test.js

This file was deleted.

13 changes: 0 additions & 13 deletions lib/__tests__/integration.test.js
Expand Up @@ -143,19 +143,6 @@ it('Scss integration test', () => {
});
});

it('rule aliasing integration test', () => {
return postcss()
.use(stylelint({ rules: { 'unit-blacklist': ['px'] } }))
.process('a { top: 10px; }', { from: undefined })
.then((result) => {
const error = result.messages[0];

expect(error).toBeTruthy();
expect(error.rule).toBe('unit-disallowed-list');
expect(error.text).toBe('Unexpected unit "px" (unit-disallowed-list)');
});
});

describe('integration test null option', () => {
let results;

Expand Down
2 changes: 0 additions & 2 deletions lib/rules/at-rule-allowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ Specify a list of allowed at-rules.
* At-rules like this */
```

This rule was previously called, and is aliased as, `at-rule-whitelist`.

## Options

`array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/at-rule-blacklist/README.md
@@ -1,4 +1,4 @@
# at-rule-disallowed-list
# at-rule-blacklist

Specify a list of disallowed at-rules.

Expand All @@ -9,8 +9,6 @@ Specify a list of disallowed at-rules.
* At-rules like this */
```

This rule was previously called, and is aliased as, `at-rule-blacklist`.

## Options

`array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/at-rule-blacklist/index.js
Expand Up @@ -9,7 +9,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'at-rule-disallowed-list';
const ruleName = 'at-rule-blacklist';

const messages = ruleMessages(ruleName, {
rejected: (name) => `Unexpected at-rule "${name}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/at-rule-disallowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ Specify a list of disallowed at-rules.
* At-rules like this */
```

This rule was previously called, and is aliased as, `at-rule-blacklist`.

## Options

`array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"`
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/at-rule-property-required-list/README.md
Expand Up @@ -9,8 +9,6 @@ Specify a list of required properties for an at-rule.
* At-rule and required property names */
```

This rule was previously called, and is aliased as, `at-rule-requirelist`.

## Options

`object`: `{ "at-rule-name": ["array", "of", "properties"] }`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/at-rule-property-requirelist/README.md
@@ -1,4 +1,4 @@
# at-rule-property-required-list
# at-rule-property-requirelist

Specify a list of required properties for an at-rule.

Expand All @@ -9,8 +9,6 @@ Specify a list of required properties for an at-rule.
* At-rule and required property names */
```

This rule was previously called, and is aliased as, `at-rule-requirelist`.

## Options

`object`: `{ "at-rule-name": ["array", "of", "properties"] }`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/at-rule-property-requirelist/index.js
Expand Up @@ -8,7 +8,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'at-rule-property-required-list';
const ruleName = 'at-rule-property-requirelist';

const messages = ruleMessages(ruleName, {
expected: (property, atRule) => `Expected property "${property}" for at-rule "${atRule}"`,
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/at-rule-whitelist/README.md
@@ -1,4 +1,4 @@
# at-rule-allowed-list
# at-rule-whitelist

Specify a list of allowed at-rules.

Expand All @@ -9,8 +9,6 @@ Specify a list of allowed at-rules.
* At-rules like this */
```

This rule was previously called, and is aliased as, `at-rule-whitelist`.

## Options

`array|string`: `["array", "of", "unprefixed", "at-rules"]|"at-rule"`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/at-rule-whitelist/index.js
Expand Up @@ -9,7 +9,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'at-rule-allowed-list';
const ruleName = 'at-rule-whitelist';

const messages = ruleMessages(ruleName, {
rejected: (name) => `Unexpected at-rule "${name}"`,
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/comment-word-blacklist/README.md
@@ -1,4 +1,4 @@
# comment-word-disallowed-list
# comment-word-blacklist

Specify a list of disallowed words within comments.

Expand All @@ -9,8 +9,6 @@ Specify a list of disallowed words within comments.
* These three words */
```

This rule was previously called, and is aliased as, `comment-word-blacklist`.

**Caveat:** Comments within _selector and value lists_ are currently ignored.

## Options
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/comment-word-blacklist/index.js
Expand Up @@ -9,7 +9,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'comment-word-disallowed-list';
const ruleName = 'comment-word-blacklist';

const messages = ruleMessages(ruleName, {
rejected: (pattern) => `Unexpected word matching pattern "${pattern}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/comment-word-disallowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ Specify a list of disallowed words within comments.
* These three words */
```

This rule was previously called, and is aliased as, `comment-word-blacklist`.

**Caveat:** Comments within _selector and value lists_ are currently ignored.

## Options
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/declaration-property-unit-allowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { width: 100px; }
* These properties and these units */
```

This rule was previously called, and is aliased as, `declaration-property-unit-whitelist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "units"] }`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/declaration-property-unit-blacklist/README.md
@@ -1,4 +1,4 @@
# declaration-property-unit-disallowed-list
# declaration-property-unit-blacklist

Specify a list of disallowed property and unit pairs within declarations.

Expand All @@ -9,8 +9,6 @@ a { width: 100px; }
* These properties and these units */
```

This rule was previously called, and is aliased as, `declaration-property-unit-blacklist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "units"] }`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/declaration-property-unit-blacklist/index.js
Expand Up @@ -12,7 +12,7 @@ const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const valueParser = require('postcss-value-parser');

const ruleName = 'declaration-property-unit-disallowed-list';
const ruleName = 'declaration-property-unit-blacklist';

const messages = ruleMessages(ruleName, {
rejected: (property, unit) => `Unexpected unit "${unit}" for property "${property}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/declaration-property-unit-disallowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { width: 100px; }
* These properties and these units */
```

This rule was previously called, and is aliased as, `declaration-property-unit-blacklist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "units"] }`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/declaration-property-unit-whitelist/README.md
@@ -1,4 +1,4 @@
# declaration-property-unit-allowed-list
# declaration-property-unit-whitelist

Specify a list of allowed property and unit pairs within declarations.

Expand All @@ -9,8 +9,6 @@ a { width: 100px; }
* These properties and these units */
```

This rule was previously called, and is aliased as, `declaration-property-unit-whitelist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "units"] }`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/declaration-property-unit-whitelist/index.js
Expand Up @@ -12,7 +12,7 @@ const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const valueParser = require('postcss-value-parser');

const ruleName = 'declaration-property-unit-allowed-list';
const ruleName = 'declaration-property-unit-whitelist';

const messages = ruleMessages(ruleName, {
rejected: (property, unit) => `Unexpected unit "${unit}" for property "${property}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/declaration-property-value-allowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { text-transform: uppercase; }
* These properties and these values */
```

This rule was previously called, and is aliased as, `declaration-property-value-whitelist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "values"], "unprefixed-property-name": ["/regex/", "non-regex"] }`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/declaration-property-value-blacklist/README.md
@@ -1,4 +1,4 @@
# declaration-property-value-disallowed-list
# declaration-property-value-blacklist

Specify a list of disallowed property and value pairs within declarations.

Expand All @@ -9,8 +9,6 @@ a { text-transform: uppercase; }
* These properties and these values */
```

This rule was previously called, and is aliased as, `declaration-property-value-blacklist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "values"], "unprefixed-property-name": ["/regex/", "non-regex", /regex/] }`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/declaration-property-value-blacklist/index.js
Expand Up @@ -9,7 +9,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'declaration-property-value-disallowed-list';
const ruleName = 'declaration-property-value-blacklist';

const messages = ruleMessages(ruleName, {
rejected: (property, value) => `Unexpected value "${value}" for property "${property}"`,
Expand Down
Expand Up @@ -9,8 +9,6 @@ a { text-transform: uppercase; }
* These properties and these values */
```

This rule was previously called, and is aliased as, `declaration-property-value-blacklist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "values"], "unprefixed-property-name": ["/regex/", "non-regex", /regex/] }`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/declaration-property-value-whitelist/README.md
@@ -1,4 +1,4 @@
# declaration-property-value-allowed-list
# declaration-property-value-whitelist

Specify a list of allowed property and value pairs within declarations.

Expand All @@ -9,8 +9,6 @@ a { text-transform: uppercase; }
* These properties and these values */
```

This rule was previously called, and is aliased as, `declaration-property-value-whitelist`.

## Options

`object`: `{ "unprefixed-property-name": ["array", "of", "values"], "unprefixed-property-name": ["/regex/", "non-regex"] }`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/declaration-property-value-whitelist/index.js
Expand Up @@ -9,7 +9,7 @@ const report = require('../../utils/report');
const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');

const ruleName = 'declaration-property-value-allowed-list';
const ruleName = 'declaration-property-value-whitelist';

const messages = ruleMessages(ruleName, {
rejected: (property, value) => `Unexpected value "${value}" for property "${property}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/function-allowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { transform: scale(1); }
* This function */
```

This rule was previously called, and is aliased as, `function-whitelist`.

## Options

`array|string`: `["array", "of", "unprefixed", /functions/ or "regex"]|"function"|"/regex/"`
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/function-blacklist/README.md
@@ -1,4 +1,4 @@
# function-disallowed-list
# function-blacklist

Specify a list of disallowed functions.

Expand All @@ -9,8 +9,6 @@ a { transform: scale(1); }
* This function */
```

This rule was previously called, and is aliased as, `function-blacklist`.

## Options

`array|string`: `["array", "of", "unprefixed", /functions/ or "regex"]|"function"|"/regex/"`
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/function-blacklist/index.js
Expand Up @@ -12,7 +12,7 @@ const ruleMessages = require('../../utils/ruleMessages');
const validateOptions = require('../../utils/validateOptions');
const valueParser = require('postcss-value-parser');

const ruleName = 'function-disallowed-list';
const ruleName = 'function-blacklist';

const messages = ruleMessages(ruleName, {
rejected: (name) => `Unexpected function "${name}"`,
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/function-disallowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { transform: scale(1); }
* This function */
```

This rule was previously called, and is aliased as, `function-blacklist`.

## Options

`array|string`: `["array", "of", "unprefixed", /functions/ or "regex"]|"function"|"/regex/"`
Expand Down
2 changes: 0 additions & 2 deletions lib/rules/function-url-scheme-allowed-list/README.md
Expand Up @@ -9,8 +9,6 @@ a { background-image: url('http://www.example.com/file.jpg'); }
* This URL scheme */
```

This rule was previously called, and is aliased as, `function-url-scheme-whitelist`.

A [URL scheme](https://url.spec.whatwg.org/#syntax-url-scheme) consists of alphanumeric, `+`, `-`, and `.` characters. It can appear at the start of a URL and is followed by `:`.

This rule ignores:
Expand Down
4 changes: 1 addition & 3 deletions lib/rules/function-url-scheme-blacklist/README.md
@@ -1,4 +1,4 @@
# function-url-scheme-disallowed-list
# function-url-scheme-blacklist

Specify a list of disallowed URL schemes.

Expand All @@ -9,8 +9,6 @@ a { background-image: url('http://www.example.com/file.jpg'); }
* This URL scheme */
```

This rule was previously called, and is aliased as, `function-url-scheme-blacklist`.

A [URL scheme](https://url.spec.whatwg.org/#syntax-url-scheme) consists of alphanumeric, `+`, `-`, and `.` characters. It can appear at the start of a URL and is followed by `:`.

This rule ignores:
Expand Down

0 comments on commit af05f79

Please sign in to comment.