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 message, positions, and false positives for selector-no-qualifying-type #6260

Merged

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Aug 13, 2022

Which issue, if any, is this issue related to?

Closes #4410
Closes #5020
Part of #5694

Is there anything in the PR that needs further explanation?

This PR aims to fix three problems:

  • including an invalid selector to the message, e.g. Unexpected qualifying type selector "a#id"
  • fixing reported positions (line and column)
  • fixing false positives for SCSS nested selectors

@@ -78,6 +78,10 @@ const rule = (primary, secondaryOptions) => {
return;
}

const ignoreId = optionsMatches(secondaryOptions, 'ignore', 'id');
const ignoreClass = optionsMatches(secondaryOptions, 'ignore', 'class');
const ignoreAttribute = optionsMatches(secondaryOptions, 'ignore', 'attribute');
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] Avoid repeated evaluations in the loop.

@ybiquitous ybiquitous changed the title Fix message and positions for selector-no-qualifying-type Fix message, positions, and false positives for selector-no-qualifying-type Aug 13, 2022
&.bar {}
}
}`,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] A test case for #5020.

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work closing the bugs.

LGTM.

@ybiquitous ybiquitous merged commit 39e9c2b into main Aug 14, 2022
@ybiquitous ybiquitous deleted the fix-message-positions-for-selector-no-qualifying-type branch August 14, 2022 06:35
@ybiquitous
Copy link
Member Author

Thanks for your many reviews! 😊

Changelog entry added:

  • Fixed: selector-no-qualifying-type message, positions, and false positives (#6260).

This was referenced Aug 18, 2022
ChrisBAshton added a commit to alphagov/support that referenced this pull request Aug 24, 2022
As of stylelint v14.11.0, the `stylelint-disable-line` override
no longer appears to work in this case, giving a build failure of

```
61:3 Unexpected qualifying type selector "a.ui-state-default" selector-no-qualifying-type
```

I suspect this is down to this change: stylelint/stylelint#6260

Applying the ignore to the block of CSS rather than to the line
seems to appease the linter.
ChrisBAshton added a commit to alphagov/support that referenced this pull request Aug 24, 2022
As of stylelint v14.11.0, the `stylelint-disable-line` override
no longer appears to work in this case, giving a build failure of

```
61:3 Unexpected qualifying type selector "a.ui-state-default" selector-no-qualifying-type
```

I suspect this is down to this change: stylelint/stylelint#6260

Applying the ignore to the block of CSS rather than to the line
seems to appease the linter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants