File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 11module . exports = function getContainingNode ( node ) {
2- // For styled-components: declarations are children of Root node
3- if ( node . type !== 'rule' && node . type !== 'atrule' && node . parent . type === 'root' ) {
2+ if ( node . type === 'rule' || node . type === 'atrule' ) {
3+ return node ;
4+ }
5+
6+ // postcss-styled-syntax: declarations are children of Root node
7+ if ( node . parent ?. type === 'root' && node . parent ?. raws . styledSyntaxIsComponent ) {
8+ return node . parent ;
9+ }
10+
11+ // @stylelint /postcss-css-in-js: declarations are children of Root node
12+ if ( node . parent ?. document ?. nodes ?. some ( ( item ) => item . type === 'root' ) ) {
413 return node . parent ;
514 }
615
Original file line number Diff line number Diff line change @@ -496,6 +496,17 @@ groupTest([
496496 }
497497 ` ,
498498 } ,
499+ {
500+ description : 'should not change in the root' ,
501+ fixture : `
502+ display: none;
503+ @include hello;
504+ ` ,
505+ expected : `
506+ display: none;
507+ @include hello;
508+ ` ,
509+ } ,
499510 {
500511 fixture : `
501512 a {
You can’t perform that action at this time.
0 commit comments