Skip to content

Commit

Permalink
🐛 FIX: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jycouet committed May 2, 2023
1 parent 0aabf17 commit 3dd94cc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ query {id}`);
consoleErrorSpy.mockRestore();
});

it('no crash in Svelte files with empty <script>', async () => {
it('no crash in Svelte files with empty <script> (typescript)', async () => {
const text = `<script lang="ts"></script>`;

const consoleErrorSpy = jest
Expand Down
20 changes: 9 additions & 11 deletions packages/graphql-language-service-server/src/findGraphQLTags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,16 @@ function parseVueSFC(source: string): ParseVueSFCResult {
try {
scriptBlock = VueParser.compileScript(descriptor, { id: 'foobar' });
} catch (error) {
if (error instanceof Error) {
if (
error.message === '[@vue/compiler-sfc] SFC contains no <script> tags.'
) {
return {
type: 'ok',
scriptSetupAst: [],
scriptAst: [],
};
}
if (
error instanceof Error &&
error.message === '[@vue/compiler-sfc] SFC contains no <script> tags.'
) {
return {
type: 'ok',
scriptSetupAst: [],
scriptAst: [],
};
}

return { type: 'error', errors: [error as Error] };
}

Expand Down

0 comments on commit 3dd94cc

Please sign in to comment.