Skip to content

Commit 69c9912

Browse files
authored
Merge pull request #62 from tbela99/m0.9.0
git type import #52
2 parents 9803e2b + 78d59c3 commit 69c9912

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

src/lib/validation/at-rules/media.ts

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
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";
1010
import type {ValidationSyntaxResult} from "../../../@types/validation.d.ts";
1111
import {EnumToken, ValidationLevel} from "../../ast";
1212
import {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
}

src/lib/validation/at-rules/when.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {AstAtRule, type AstNode, FunctionToken, Token, type ValidationOptions} from "../../../@types";
1+
import type {AstAtRule, AstNode, FunctionToken, Token, ValidationOptions} from "../../../@types";
22
import type {ValidationSyntaxResult} from "../../../@types/validation";
33
import {EnumToken, ValidationLevel} from "../../ast";
44
import {consumeWhitespace, splitTokenList} from "../utils";
@@ -111,7 +111,7 @@ export function validateAtRuleWhenQueryList(tokenList: Token[], atRule: AstAtRul
111111
break;
112112
}
113113

114-
} else if (['supports', 'font-tech', 'font-format'].includes(split[0].val) ) {
114+
} else if (['supports', 'font-tech', 'font-format'].includes(split[0].val)) {
115115

116116
// result = valida
117117
if (!validateSupportCondition(atRule, split[0])) {

src/lib/validation/syntaxes/image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ValidationSyntaxResult} from "../../../@types/validation";
2-
import {type FunctionImageToken, Token} from "../../../@types";
2+
import type {FunctionImageToken, Token} from "../../../@types/index.d.ts";
33
import {EnumToken, ValidationLevel} from "../../ast";
44
import {validateSyntax} from "../syntax";
55
import {getParsedSyntax} from "../config";

0 commit comments

Comments
 (0)