File tree Expand file tree Collapse file tree 2 files changed +21
-13
lines changed
lib/rules/no-duplicate-selectors Expand file tree Collapse file tree 2 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,14 @@ testRule({
358358 code : 'a { background: { color: red } }' ,
359359 description : 'Non standard SCSS nested property' ,
360360 } ,
361+ {
362+ code : '.#{foo} { &:last-child { &, & > .#{foo}-bar {} } }' ,
363+ description : 'Non standard SCSS nested interpolation' ,
364+ } ,
365+ {
366+ code : 'a { b, .#{var} {} b {} }' ,
367+ description : 'Non standard SCSS nested interpolation (2' ,
368+ } ,
361369 ] ,
362370} ) ;
363371
@@ -371,5 +379,13 @@ testRule({
371379 code : '.@{foo} { .@{foo}-bar {} }' ,
372380 description : 'Non standard Less nested interpolation' ,
373381 } ,
382+ {
383+ code : '.@{foo} { &:last-child { &, & > .@{foo}-bar {} } }' ,
384+ description : 'Non standard Less nested interpolation (2' ,
385+ } ,
386+ {
387+ code : 'a { b, .@{var} {} b {} }' ,
388+ description : 'Non standard Less nested interpolation (3' ,
389+ } ,
374390 ] ,
375391} ) ;
Original file line number Diff line number Diff line change @@ -63,18 +63,10 @@ const rule = (primary, secondaryOptions) => {
6363 ) ;
6464 const resolvedSelectorList = [
6565 ...new Set (
66- ruleNode . selectors . flatMap ( ( selector ) => {
67- return isStandardSyntaxSelector ( selector )
68- ? resolvedNestedSelector ( selector , ruleNode )
69- : [ ] ;
70- } ) ,
66+ ruleNode . selectors . flatMap ( ( selector ) => resolvedNestedSelector ( selector , ruleNode ) ) ,
7167 ) ,
7268 ] ;
7369
74- if ( resolvedSelectorList . length === 0 ) {
75- return ;
76- }
77-
7870 const normalizedSelectorList = resolvedSelectorList . map ( normalize ) ;
7971
8072 // Sort the selectors list so that the order of the constituents
@@ -133,10 +125,6 @@ const rule = (primary, secondaryOptions) => {
133125
134126 // Or complain if one selector list contains the same selector more than once
135127 for ( const selector of ruleNode . selectors ) {
136- if ( ! isStandardSyntaxSelector ( selector ) ) {
137- continue ;
138- }
139-
140128 const normalized = normalize ( selector ) ;
141129
142130 if ( presentedSelectors . has ( normalized ) ) {
@@ -175,6 +163,10 @@ const rule = (primary, secondaryOptions) => {
175163 * @returns {string }
176164 */
177165function normalize ( selector ) {
166+ if ( ! isStandardSyntaxSelector ( selector ) ) {
167+ return selector ;
168+ }
169+
178170 return selectorParser ( ) . processSync ( selector , { lossless : false } ) ;
179171}
180172
You can’t perform that action at this time.
0 commit comments