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 shadow part ident falsly parsed as type selector #4828

Merged
merged 1 commit into from Jun 16, 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 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