@@ -2,11 +2,11 @@ import stylelint from 'stylelint';
22import configPromise , { configure } from '@deot/dev-stylelint' ;
33
44// @vitest -environment node
5- const lint = async ( text : string , codeFilename ?: string ) => {
5+ const lint = async ( text : string , options ?: stylelint . LinterOptions ) => {
66 const resultObject = await stylelint . lint ( {
77 config : await configPromise ,
88 code : text ,
9- codeFilename
9+ ... options
1010 } ) ;
1111 return resultObject ;
1212} ;
@@ -65,7 +65,7 @@ describe('index.js', () => {
6565 code += `a { color: color(1); }\n` ;
6666 code += '</style>' ;
6767
68- const data = await lint ( code , './any.vue' ) ;
68+ const data = await lint ( code , { codeFilename : './any.vue' } ) ;
6969 expect ( data . errored ) . toBe ( false ) ;
7070 } ) ;
7171
@@ -97,6 +97,39 @@ describe('index.js', () => {
9797 const data = await lint ( code ) ;
9898 expect ( data . report ) . toMatch ( 'Expected \\"top\\" to come before \\"bottom\\" (order/properties-order)' ) ;
9999 } ) ;
100+
101+ it ( 'nesting-selector-no-missing-scoping-root/ignore' , async ( ) => {
102+ expect . hasAssertions ( ) ;
103+
104+ let code = '' ;
105+ code += `@include b(any) {\n` ;
106+ code += ` @include when(any) {\n` ;
107+ code += ` &:hover {\n` ;
108+ code += ` color: red;\n` ;
109+ code += ` }\n` ;
110+ code += ` }\n` ;
111+ code += `}\n` ;
112+
113+ const data = await lint ( code ) ;
114+ expect ( data . errored ) . toBe ( false ) ;
115+ } ) ;
116+ it ( 'block-no-redundant-nested-style-rule/ignore' , async ( ) => {
117+ expect . hasAssertions ( ) ;
118+
119+ let code = '' ;
120+ code += `@include b(any) {\n` ;
121+ code += ` @include when(any) {\n` ;
122+ code += ` & {\n` ;
123+ code += ` ::after {\n` ;
124+ code += ` color: red;\n` ;
125+ code += ` }\n` ;
126+ code += ` }\n` ;
127+ code += ` }\n` ;
128+ code += `}\n` ;
129+
130+ const data = await lint ( code , { fix : true } ) ;
131+ expect ( data . errored ) . toBe ( false ) ;
132+ } ) ;
100133} ) ;
101134
102135/**
0 commit comments