Skip to content

Commit

Permalink
Handle valueless attribute selectors in selector-attribute-name-disal…
Browse files Browse the repository at this point in the history
…lowed-list rule (#5060)
  • Loading branch information
vkrol committed Dec 8, 2020
1 parent d6ec8d0 commit 6b06b36
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project are documented in this file.

## Head

- Fixed: `selector-attribute-name-disallowed-list` false positives for valueless attribute selectors ([#5060](https://github.com/stylelint/stylelint/pull/5060)).

## 13.8.0

- Deprecated: `StylelintStandaloneReturnValue.reportedDisables`, `.descriptionlessDisables`, `.needlessDisables`, and `.invalidScopeDisables`. `.reportedDisables` will always be empty and the other properties will always be undefined, since these errors now show up in `.results` instead ([#4973](https://github.com/stylelint/stylelint/pull/4973)).
Expand Down
Expand Up @@ -5,7 +5,7 @@ const { messages, ruleName } = require('..');
testRule({
ruleName,

config: ['class', 'id', '/^data-/'],
config: ['class', 'disabled', 'id', '/^data-/'],

accept: [
{
Expand Down Expand Up @@ -41,6 +41,12 @@ testRule({
line: 1,
column: 2,
},
{
code: '[disabled] { }',
message: messages.rejected('disabled'),
line: 1,
column: 2,
},
{
code: '[id~="bar"] { }',
message: messages.rejected('id'),
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/selector-attribute-name-disallowed-list/index.js
Expand Up @@ -34,7 +34,7 @@ function rule(listInput) {
return;
}

if (!ruleNode.selector.includes('[') || !ruleNode.selector.includes('=')) {
if (!ruleNode.selector.includes('[')) {
return;
}

Expand Down

0 comments on commit 6b06b36

Please sign in to comment.