Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix false positives for valueless attribute selectors in selector-attribute-name-disallowed-list #5060

Merged
merged 1 commit into from Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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