Skip to content

Commit 3ba8379

Browse files
authored
feat: to parse using project: true instead if projectService is specified (#348)
* feat: to parse using `project: true` instead if `projectService` is specified * Create thin-humans-lay.md * fix
1 parent 2d45e8a commit 3ba8379

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.changeset/thin-humans-lay.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"astro-eslint-parser": minor
3+
---
4+
5+
feat: to parse using `project: true` instead if `projectService` is specified

explorer-v3/src/components/Header.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function isActive(path) {
3232
baseUrl: {JSON.stringify(baseUrl)}
3333
</div>
3434
<><SnsBar client:only="svelte" /></>
35-
<a href="https://github.com/ota-meshi/astro-eslint-parser" class="github-link"
35+
<a class="github-link" href="https://github.com/ota-meshi/astro-eslint-parser"
3636
>View on GitHub
3737
</a>
3838
</header>

explorer-v3/src/layouts/Layout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const { title } = Astro.props as Props;
1111
<html lang="en">
1212
<head>
1313
<meta charset="UTF-8" />
14-
<meta name="viewport" content="width=device-width" />
15-
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
14+
<meta content="width=device-width" name="viewport" />
15+
<link href="/favicon.ico" rel="icon" type="image/x-icon" />
1616
<title>{title}</title>
17-
<meta name="description" content="Astro component parser for ESLint" />
17+
<meta content="Astro component parser for ESLint" name="description" />
1818
</head>
1919
<body>
2020
<Header />

src/parser/script.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,20 @@ function parseScriptInternal(
9898
parserOptions.project
9999
) {
100100
patchResult = tsPatch(parserOptions, parserOptionsCtx.getTSParserName()!);
101+
} else if (
102+
parserOptionsCtx.isTypeScript() &&
103+
parserOptions.filePath &&
104+
parserOptions.projectService
105+
) {
106+
console.warn(
107+
"`astro-eslint-parser` does not support the `projectService` option, it will parse it as `project: true` instead.",
108+
);
109+
patchResult = tsPatch(
110+
{ ...parserOptions, project: true },
111+
parserOptionsCtx.getTSParserName()!,
112+
);
101113
}
114+
102115
const result = isEnhancedParserObject(parser)
103116
? patchResult?.parse
104117
? patchResult.parse(code, parser)

0 commit comments

Comments
 (0)