Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/new-meals-win.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": patch
---

fix: show proper parse error position
5 changes: 5 additions & 0 deletions src/parser/template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {} from "svelte"; // FIXME: Workaround to get type information for "svelte/compiler"

Check warning on line 1 in src/parser/template.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected 'fixme' comment: 'FIXME: Workaround to get type...'
import { parse } from "svelte/compiler";
import type * as Compiler from "./svelte-ast-types-for-v5.js";
import type * as SvAST from "./svelte-ast-types.js";
Expand Down Expand Up @@ -43,6 +43,11 @@
(err as any).svelteCompilerError = e;
throw err;
}
if (Array.isArray(e.position) && typeof e.position[0] === "number") {
const err = new ParseError(e.message, e.position[0], ctx);
(err as any).svelteCompilerError = e;
throw err;
}
throw e;
}
}
Loading