Skip to content

Commit

Permalink
Fix false positives for idents within ::part pseudo-elements in selec…
Browse files Browse the repository at this point in the history
…tor-type-no-unknown (#4828)
  • Loading branch information
runarberg committed Jun 16, 2020
1 parent 547ea7f commit 1404260
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/rules/selector-type-no-unknown/__tests__/index.js
Expand Up @@ -422,6 +422,10 @@ testRule({
code: 'x-foo {}',
description: 'custom element',
},
{
code: 'custom-element::part(foo) {}',
description: 'shadow parts',
},
],

reject: [
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/__tests__/isStandardSyntaxTypeSelector.test.js
Expand Up @@ -75,6 +75,11 @@ describe('isStandardSyntaxTypeSelector', () => {
expect(isStandardSyntaxTypeSelector(func)).toBeFalsy();
});
});
it('shadow-parts ident', () => {
rules('::part(foo) {}', (func) => {
expect(isStandardSyntaxTypeSelector(func)).toBeFalsy();
});
});
it('lowercase reference combinators', () => {
rules('.foo /for/ .bar {}', (func) => {
expect(isStandardSyntaxTypeSelector(func)).toBeFalsy();
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/isStandardSyntaxTypeSelector.js
Expand Up @@ -27,7 +27,8 @@ module.exports = function (node) {
if (
parentType === 'pseudo' &&
(keywordSets.aNPlusBNotationPseudoClasses.has(normalisedParentName) ||
keywordSets.linguisticPseudoClasses.has(normalisedParentName))
keywordSets.linguisticPseudoClasses.has(normalisedParentName) ||
keywordSets.shadowTreePseudoElements.has(normalisedParentName))
) {
return false;
}
Expand Down

0 comments on commit 1404260

Please sign in to comment.