From 47b9f564e66f4ad2802db0cb1214c89fd505f463 Mon Sep 17 00:00:00 2001 From: doing-art Date: Sun, 22 Aug 2021 17:12:49 +0300 Subject: [PATCH 01/17] Add new rule-selector-property-disallowed-list rule --- docs/user-guide/rules/list.md | 4 ++ lib/rules/index.js | 3 + .../README.md | 62 +++++++++++++++++ .../__tests__/index.js | 60 ++++++++++++++++ .../index.js | 69 +++++++++++++++++++ 5 files changed, 198 insertions(+) create mode 100644 lib/rules/rule-selector-property-disallowed-list/README.md create mode 100644 lib/rules/rule-selector-property-disallowed-list/__tests__/index.js create mode 100644 lib/rules/rule-selector-property-disallowed-list/index.js diff --git a/docs/user-guide/rules/list.md b/docs/user-guide/rules/list.md index 171f9e3015..94a8cb34e3 100644 --- a/docs/user-guide/rules/list.md +++ b/docs/user-guide/rules/list.md @@ -194,6 +194,10 @@ Grouped first by the following categories and then by the [_thing_](http://apps. - [`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). - [`selector-pseudo-element-disallowed-list`](../../../lib/rules/selector-pseudo-element-disallowed-list/README.md): Specify a list of disallowed pseudo-element selectors. +### Rules + +- [`rule-selector-property-disallowed-list`](../../../lib/rules/rule-selector-property-disallowed-list/README.md): Specify a list of disallowed properties for selectors within rules. + ### Media feature - [`media-feature-name-allowed-list`](../../../lib/rules/media-feature-name-allowed-list/README.md): Specify a list of allowed media feature names. diff --git a/lib/rules/index.js b/lib/rules/index.js index 1a5cb09e28..2295815ebc 100644 --- a/lib/rules/index.js +++ b/lib/rules/index.js @@ -235,6 +235,9 @@ const rules = { 'property-no-unknown': importLazy(() => require('./property-no-unknown'))(), 'property-no-vendor-prefix': importLazy(() => require('./property-no-vendor-prefix'))(), 'rule-empty-line-before': importLazy(() => require('./rule-empty-line-before'))(), + 'rule-selector-property-disallowed-list': importLazy(() => + require('./rule-selector-property-disallowed-list'), + )(), 'selector-attribute-brackets-space-inside': importLazy(() => require('./selector-attribute-brackets-space-inside'), )(), diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md new file mode 100644 index 0000000000..e6e4f0e344 --- /dev/null +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -0,0 +1,62 @@ +# rule-selector-property-disallowed-list + +Specify a list of disallowed properties for selectors within rules. + + +```css + html.custom { background-color: red; } +/** ↑ ↑ + * Selector and property name */ +``` + +## Options + +`object`: `{ "selector": ["array", "of", "properties"]` + +If a selector name is surrounded with `"/"` (e.g. `"/anchor/"`), it is interpreted as a regular expression. This allows, for example, easy targeting of all the potential anchors: `/anchor/` will match `.anchor`, `[data-anchor]`, etc. + +The same goes for properties. Keep in mind that a regular expression value is matched against the entire property name, not specific parts of it. For example, a value like `"animation-duration"` will _not_ match `"/^duration/"` (notice beginning of the line boundary) but _will_ match `"/duration/"`. + +Given: + +```json +{ + "a": ["background-color"], + "html": ["/color/"], + "/test/": ["/size/"] +} +``` + +The following patterns are considered violations: + + +```css +a { background-color: red; } +``` + + +```css +html { background-color: red; } +``` + + +```css +html[data-test] { font-size: 1px; } +``` + +The following patterns are _not_ considered violations: + + +```css +a { background: red; color: red; } +``` + + +```css +a[href="#"] { background-color: red; } +``` + + +```css +html[data-test] { background-color: red; } +``` diff --git a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js new file mode 100644 index 0000000000..f71d49af35 --- /dev/null +++ b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js @@ -0,0 +1,60 @@ +'use strict'; + +const { messages, ruleName } = require('..'); + +testRule({ + ruleName, + config: { + a: ['background-color'], + html: ['/color/'], + '/test/': ['/size/'], + }, + + accept: [ + { + code: 'a { background: red; }', + }, + { + code: 'a { color: red; }', + }, + { + code: 'a { background: red; color: red; }', + }, + { + code: 'a[href="#"] { background-color: red; }', + }, + { + code: 'html.foo { background-color: red; }', + }, + { + code: 'html[data-test] { background-color: red; }', + }, + ], + + reject: [ + { + code: 'a { background-color: red; }', + message: messages.rejected('background-color', 'a'), + line: 1, + column: 5, + }, + { + code: 'html { background-color: red; }', + message: messages.rejected('background-color', 'html'), + line: 1, + column: 8, + }, + { + code: '[data-test] { font-size: 1rem; }', + message: messages.rejected('font-size', '[data-test]'), + line: 1, + column: 15, + }, + { + code: 'html[data-test] { font-size: 1px; }', + message: messages.rejected('font-size', 'html[data-test]'), + line: 1, + column: 19, + }, + ], +}); diff --git a/lib/rules/rule-selector-property-disallowed-list/index.js b/lib/rules/rule-selector-property-disallowed-list/index.js new file mode 100644 index 0000000000..a379160b48 --- /dev/null +++ b/lib/rules/rule-selector-property-disallowed-list/index.js @@ -0,0 +1,69 @@ +// @ts-nocheck + +'use strict'; + +const isStandardSyntaxRule = require('../../utils/isStandardSyntaxRule'); +const matchesStringOrRegExp = require('../../utils/matchesStringOrRegExp'); +const report = require('../../utils/report'); +const ruleMessages = require('../../utils/ruleMessages'); +const validateOptions = require('../../utils/validateOptions'); +const { isPlainObject } = require('is-plain-object'); + +const ruleName = 'rule-selector-property-disallowed-list'; + +const messages = ruleMessages(ruleName, { + rejected: (property, selector) => `Unexpected property "${property}" for selector "${selector}"`, +}); + +function rule(primary) { + return (root, result) => { + const validOptions = validateOptions(result, ruleName, { + actual: primary, + possible: [isPlainObject], + }); + + if (!validOptions) { + return; + } + + const selectors = Object.keys(primary); + + root.walkRules((ruleNode) => { + if (!isStandardSyntaxRule(ruleNode)) { + return; + } + + const selectorKey = selectors.find((selector) => + matchesStringOrRegExp(ruleNode.selector, selector), + ); + + if (!selectorKey) { + return; + } + + const disallowedProperties = primary[selectorKey]; + + for (const node of ruleNode.nodes) { + const isDisallowedProperty = + node.type === 'decl' && matchesStringOrRegExp(node.prop, disallowedProperties); + + if (isDisallowedProperty) { + report({ + message: messages.rejected(node.prop, ruleNode.selector), + node, + result, + ruleName, + }); + + break; + } + } + }); + }; +} + +rule.primaryOptionArray = true; + +rule.ruleName = ruleName; +rule.messages = messages; +module.exports = rule; From 65515a88b2b2e2893311b4b08a647d438e266e63 Mon Sep 17 00:00:00 2001 From: doing-art Date: Thu, 7 Oct 2021 17:17:31 +0300 Subject: [PATCH 02/17] Add typecheck --- lib/rules/rule-selector-property-disallowed-list/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/index.js b/lib/rules/rule-selector-property-disallowed-list/index.js index a379160b48..5c5eca4b5f 100644 --- a/lib/rules/rule-selector-property-disallowed-list/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/index.js @@ -1,5 +1,3 @@ -// @ts-nocheck - 'use strict'; const isStandardSyntaxRule = require('../../utils/isStandardSyntaxRule'); @@ -15,6 +13,7 @@ const messages = ruleMessages(ruleName, { rejected: (property, selector) => `Unexpected property "${property}" for selector "${selector}"`, }); +/** @type {import('stylelint').StylelintRule} */ function rule(primary) { return (root, result) => { const validOptions = validateOptions(result, ruleName, { From 481a94b9b35a8e698aa6e0ec5eb24371044a9327 Mon Sep 17 00:00:00 2001 From: doing-art Date: Thu, 7 Oct 2021 17:24:58 +0300 Subject: [PATCH 03/17] Fix typecheck issue --- lib/rules/rule-selector-property-disallowed-list/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/index.js b/lib/rules/rule-selector-property-disallowed-list/index.js index 5c5eca4b5f..5e389db429 100644 --- a/lib/rules/rule-selector-property-disallowed-list/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/index.js @@ -14,7 +14,7 @@ const messages = ruleMessages(ruleName, { }); /** @type {import('stylelint').StylelintRule} */ -function rule(primary) { +const rule = (primary) => { return (root, result) => { const validOptions = validateOptions(result, ruleName, { actual: primary, @@ -59,7 +59,7 @@ function rule(primary) { } }); }; -} +}; rule.primaryOptionArray = true; From efdd72366839646b0c3432bb602d329d7a31e47f Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:12 +0300 Subject: [PATCH 04/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index e6e4f0e344..b1b74e603d 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -4,8 +4,8 @@ Specify a list of disallowed properties for selectors within rules. ```css - html.custom { background-color: red; } -/** ↑ ↑ + a { color: red; } +/** ↑ ↑ * Selector and property name */ ``` From a772f273dd0f88927963041cf9ea59d8e102686a Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:21 +0300 Subject: [PATCH 05/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index b1b74e603d..97fa5bd5c6 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -31,7 +31,7 @@ The following patterns are considered violations: ```css -a { background-color: red; } +a { color: red; } ``` From 4116e5ca978ab6fc4d88c6d33d2cd42234bd0c3a Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:29 +0300 Subject: [PATCH 06/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 97fa5bd5c6..028da261ef 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -21,9 +21,8 @@ Given: ```json { - "a": ["background-color"], - "html": ["/color/"], - "/test/": ["/size/"] + "a": ["color", "/margin/"], + "/foo/": ["/size/"] } ``` From 11b2741c8fccca785a868b6aa32468c4dae6d2a4 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:36 +0300 Subject: [PATCH 07/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 028da261ef..7ad5891e96 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -35,7 +35,7 @@ a { color: red; } ```css -html { background-color: red; } +a { margin-top: 0px; } ``` From 4a627dbdedc7cfdbbdaab61d223354461dcec9c8 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:41 +0300 Subject: [PATCH 08/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 7ad5891e96..d0b4cde456 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -40,7 +40,7 @@ a { margin-top: 0px; } ```css -html[data-test] { font-size: 1px; } +html[data-foo] { font-size: 1px; } ``` The following patterns are _not_ considered violations: From 5f61d43bd28a3ede21dc7759c7e5d34d9cf4f4ce Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:18:55 +0300 Subject: [PATCH 09/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index d0b4cde456..fd9c957d0e 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -47,7 +47,7 @@ The following patterns are _not_ considered violations: ```css -a { background: red; color: red; } +a { background: red; } ``` From e2863f2671601c5e30cbb547c6cf7440b898992c Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:19:00 +0300 Subject: [PATCH 10/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index fd9c957d0e..41c98a2cf3 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -52,7 +52,7 @@ a { background: red; } ```css -a[href="#"] { background-color: red; } +a { padding-top: 0px; } ``` From 6be7d4a53b4775b62f7bf099320ec4ceb661626d Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:19:11 +0300 Subject: [PATCH 11/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 41c98a2cf3..4040416bca 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -57,5 +57,5 @@ a { padding-top: 0px; } ```css -html[data-test] { background-color: red; } +html[data-foo] { color: red; } ``` From 264893ee6ac9baac369d2638b33de2500bad4e77 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:19:58 +0300 Subject: [PATCH 12/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 4040416bca..08a18e6aaf 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -26,7 +26,7 @@ Given: } ``` -The following patterns are considered violations: +The following patterns are considered problems: ```css From 538f8fe0ccf9ae2e3f284ff771362e9777d8d040 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:20:05 +0300 Subject: [PATCH 13/17] Update lib/rules/rule-selector-property-disallowed-list/README.md Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/README.md b/lib/rules/rule-selector-property-disallowed-list/README.md index 08a18e6aaf..1a98194335 100644 --- a/lib/rules/rule-selector-property-disallowed-list/README.md +++ b/lib/rules/rule-selector-property-disallowed-list/README.md @@ -43,7 +43,7 @@ a { margin-top: 0px; } html[data-foo] { font-size: 1px; } ``` -The following patterns are _not_ considered violations: +The following patterns are _not_ considered problems: ```css From b67c6b81b39914e88a16757f72775a163ee34d5e Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:20:20 +0300 Subject: [PATCH 14/17] Update lib/rules/rule-selector-property-disallowed-list/index.js Co-authored-by: Richard Hallows --- lib/rules/rule-selector-property-disallowed-list/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/index.js b/lib/rules/rule-selector-property-disallowed-list/index.js index 5e389db429..f45edc7c24 100644 --- a/lib/rules/rule-selector-property-disallowed-list/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/index.js @@ -13,7 +13,7 @@ const messages = ruleMessages(ruleName, { rejected: (property, selector) => `Unexpected property "${property}" for selector "${selector}"`, }); -/** @type {import('stylelint').StylelintRule} */ +/** @type {import('stylelint').Rule} */ const rule = (primary) => { return (root, result) => { const validOptions = validateOptions(result, ruleName, { From acb229aa0d47332721be529f8683f52bc9593ab9 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:20:44 +0300 Subject: [PATCH 15/17] Update lib/rules/rule-selector-property-disallowed-list/__tests__/index.js Co-authored-by: Richard Hallows --- .../rule-selector-property-disallowed-list/__tests__/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js index f71d49af35..334c435b2c 100644 --- a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js @@ -5,8 +5,7 @@ const { messages, ruleName } = require('..'); testRule({ ruleName, config: { - a: ['background-color'], - html: ['/color/'], + a: ['color', "/margin/"], '/test/': ['/size/'], }, From f42f492a37d152493e90306604cc101928acc3f4 Mon Sep 17 00:00:00 2001 From: doing-art Date: Fri, 15 Oct 2021 14:58:48 +0300 Subject: [PATCH 16/17] Update tests for rule-selector-property-disallowed-list rule --- .../__tests__/index.js | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js index 334c435b2c..ba51ff2224 100644 --- a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js @@ -5,8 +5,8 @@ const { messages, ruleName } = require('..'); testRule({ ruleName, config: { - a: ['color', "/margin/"], - '/test/': ['/size/'], + a: ['color', '/margin/'], + '/foo/': ['/size/'], }, accept: [ @@ -14,46 +14,58 @@ testRule({ code: 'a { background: red; }', }, { - code: 'a { color: red; }', + code: 'a { padding-top: 0px; }', }, { - code: 'a { background: red; color: red; }', + code: 'a { background-color: red; }', }, { - code: 'a[href="#"] { background-color: red; }', + code: 'a[href="#"] { color: red; }', }, { - code: 'html.foo { background-color: red; }', + code: 'html.foo { color: red; }', }, { - code: 'html[data-test] { background-color: red; }', + code: 'html[data-foo] { color: red; }', }, ], reject: [ { - code: 'a { background-color: red; }', - message: messages.rejected('background-color', 'a'), + code: 'a { color: red; }', + message: messages.rejected('color', 'a'), + line: 1, + column: 5, + }, + { + code: 'a { background: red; color: red; }', + message: messages.rejected('color', 'a'), + line: 1, + column: 22, + }, + { + code: 'a { margin-top: 0px; }', + message: messages.rejected('margin-top', 'a'), line: 1, column: 5, }, { - code: 'html { background-color: red; }', - message: messages.rejected('background-color', 'html'), + code: 'a { color: red; margin-top: 0px; }', + message: messages.rejected('color', 'a'), line: 1, - column: 8, + column: 5, }, { - code: '[data-test] { font-size: 1rem; }', - message: messages.rejected('font-size', '[data-test]'), + code: '[data-foo] { font-size: 1rem; }', + message: messages.rejected('font-size', '[data-foo]'), line: 1, - column: 15, + column: 14, }, { - code: 'html[data-test] { font-size: 1px; }', - message: messages.rejected('font-size', 'html[data-test]'), + code: 'html[data-foo] { font-size: 1px; }', + message: messages.rejected('font-size', 'html[data-foo]'), line: 1, - column: 19, + column: 18, }, ], }); From 584c8c7a229423395ddbdcc1ab5a902f9d5cb4e0 Mon Sep 17 00:00:00 2001 From: doing-art Date: Sun, 31 Oct 2021 15:16:46 +0200 Subject: [PATCH 17/17] Support multiple errors for several properties in one block --- .../__tests__/index.js | 5 ++++- lib/rules/rule-selector-property-disallowed-list/index.js | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js index ba51ff2224..1cda63712c 100644 --- a/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/__tests__/index.js @@ -51,7 +51,10 @@ testRule({ }, { code: 'a { color: red; margin-top: 0px; }', - message: messages.rejected('color', 'a'), + warnings: [ + { message: messages.rejected('color', 'a'), line: 1, column: 5 }, + { message: messages.rejected('margin-top', 'a'), line: 1, column: 17 }, + ], line: 1, column: 5, }, diff --git a/lib/rules/rule-selector-property-disallowed-list/index.js b/lib/rules/rule-selector-property-disallowed-list/index.js index f45edc7c24..ef5e0cf44d 100644 --- a/lib/rules/rule-selector-property-disallowed-list/index.js +++ b/lib/rules/rule-selector-property-disallowed-list/index.js @@ -53,8 +53,6 @@ const rule = (primary) => { result, ruleName, }); - - break; } } });