Skip to content

Commit 2edb983

Browse files
committed
fix: simplify oxlint literal guard
1 parent 36200f0 commit 2edb983

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

packages/cli/src/oxlint-plugin.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,10 @@ import {
66
VITE_PLUS_OXLINT_PLUGIN_NAME,
77
} from './oxlint-plugin-config.ts';
88

9-
function isStringLiteralLike(value: unknown): value is ESTree.StringLiteral {
10-
return (
11-
typeof value === 'object' &&
12-
value !== null &&
13-
'type' in value &&
14-
value.type === 'Literal' &&
15-
'value' in value &&
16-
typeof value.value === 'string'
17-
);
9+
function isStringLiteralLike(
10+
value: ESTree.Expression | ESTree.TSModuleDeclaration['id'],
11+
): value is ESTree.StringLiteral {
12+
return value.type === 'Literal';
1813
}
1914

2015
function rewriteVitePlusImportSpecifier(specifier: string): string | null {

0 commit comments

Comments
 (0)