⚠️ Read this about TS parsing errors before submitting an issue ⚠️
#1111There have been reports of the error "Parsing error: Unexpected token {", which occurs due to missing configurations in eslint.config.js
.
Please refer to the documentation and ensure your settings are correct. If the error persists despite correct configuration, feel free to open an issue.
https://github.com/sveltejs/eslint-plugin-svelte?tab=readme-ov-file#typescript-project
If it helps anyone:
{
files: ["**/*.svelte", "**/*.svelte.ts"],
languageOptions: {
parserOptions: {
projectService: true,
extraFileExtensions: [".svelte", ".svelte.ts"],
parser: ts.parser,
svelteFeatures: {
experimentalGenerics: true,
},
svelteConfig,
},
},
},
I'm still getting this with config from README (without svelteConfig
).
It happens when I have on
inline handlers that are multiline.
onchange={async event => {
const input = event.target as HTMLInputElement
const file = input.files?.[0]
if (file) {
const img = document.querySelectorAll(`form img`)[
index
] as HTMLImageElement
img.src = URL.createObjectURL(file)
}
}}
It happens when I have
on
inline handlers that are multiline.
Scratch that, it happens with TS inside handlers.
...and it looks like also when you have async
functions in handlers:
onsubmit={async ()=> {}}
@Lippiece I can not reproduce this. Can you create a new issue with reproduction?
@Lippiece I can not reproduce this. Can you create a new issue with reproduction?
Thanks for checking this out. I couldn't do it. The same config works if eslint is installed locally, but not globally. Maybe someone else will have an idea.
...looks like the problem was in svelte
package missing globally. Silly me.