1- import {
1+ import type {
22 AstAtRule ,
33 AstNode ,
44 FunctionToken ,
55 MediaFeatureToken ,
66 ParensToken ,
77 Token ,
88 ValidationOptions
9- } from "../../../@types" ;
9+ } from "../../../@types/index.d.ts " ;
1010import type { ValidationSyntaxResult } from "../../../@types/validation.d.ts" ;
1111import { EnumToken , ValidationLevel } from "../../ast" ;
1212import { consumeWhitespace , splitTokenList } from "../utils" ;
@@ -112,30 +112,29 @@ export function validateAtRuleMediaQueryList(tokenList: Token[], atRule: AstAtRu
112112 previousToken = tokens [ 0 ] ;
113113
114114 // media-condition | media-type | custom-media
115- if ( ! ( validateMediaCondition ( tokens [ 0 ] , atRule ) || validateMediaFeature ( tokens [ 0 ] ) || validateCustomMediaCondition ( tokens [ 0 ] , atRule ) ) ) {
115+ if ( ! ( validateMediaCondition ( tokens [ 0 ] , atRule ) || validateMediaFeature ( tokens [ 0 ] ) || validateCustomMediaCondition ( tokens [ 0 ] , atRule ) ) ) {
116116
117- if ( tokens [ 0 ] . typ == EnumToken . ParensTokenType ) {
117+ if ( tokens [ 0 ] . typ == EnumToken . ParensTokenType ) {
118118
119- result = validateAtRuleMediaQueryList ( tokens [ 0 ] . chi , atRule ) ;
120- }
121- else {
119+ result = validateAtRuleMediaQueryList ( tokens [ 0 ] . chi , atRule ) ;
120+ } else {
122121
123- result = {
124- valid : ValidationLevel . Drop ,
125- matches : [ ] ,
126- node : tokens [ 0 ] ?? atRule ,
127- syntax : '@media' ,
128- error : 'expecting media feature or media condition' ,
129- tokens : [ ]
130- }
131- }
122+ result = {
123+ valid : ValidationLevel . Drop ,
124+ matches : [ ] ,
125+ node : tokens [ 0 ] ?? atRule ,
126+ syntax : '@media' ,
127+ error : 'expecting media feature or media condition' ,
128+ tokens : [ ]
129+ }
130+ }
132131
133- if ( result . valid == ValidationLevel . Drop ) {
132+ if ( result . valid == ValidationLevel . Drop ) {
134133
135- break ;
136- }
134+ break ;
135+ }
137136
138- result = null ;
137+ result = null ;
139138 }
140139
141140 match . push ( tokens . shift ( ) as Token ) ;
@@ -161,9 +160,7 @@ export function validateAtRuleMediaQueryList(tokenList: Token[], atRule: AstAtRu
161160
162161 break ;
163162 }
164- }
165-
166- else if ( ! [ EnumToken . MediaFeatureOrTokenType , EnumToken . MediaFeatureAndTokenType ] . includes ( tokens [ 0 ] . typ ) ) {
163+ } else if ( ! [ EnumToken . MediaFeatureOrTokenType , EnumToken . MediaFeatureAndTokenType ] . includes ( tokens [ 0 ] . typ ) ) {
167164
168165 // @ts -ignore
169166 result = {
@@ -308,7 +305,7 @@ export function validateMediaCondition(token: Token, atRule: AstAtRule): boolean
308305 return validateMediaCondition ( token . val , atRule ) ;
309306 }
310307
311- if ( token . typ != EnumToken . ParensTokenType && ! ( [ 'when' , 'else' ] . includes ( atRule . nam ) && token . typ == EnumToken . FunctionTokenType && [ 'media' , 'supports' ] . includes ( token . val ) ) ) {
308+ if ( token . typ != EnumToken . ParensTokenType && ! ( [ 'when' , 'else' ] . includes ( atRule . nam ) && token . typ == EnumToken . FunctionTokenType && [ 'media' , 'supports' ] . includes ( token . val ) ) ) {
312309
313310 return false ;
314311 }
0 commit comments