#ESLint "Parsing error: Type expected" erroring on '.astro/types.d.ts'
14 messages · Page 1 of 1 (latest)
Using Astro 4.11.5. Here's my ESLint config:
// eslint.config.mjs
// @ts-check
import unusedImports from "eslint-plugin-unused-imports";
import tseslint from "typescript-eslint";
import eslintPluginAstro from "eslint-plugin-astro";
export default tseslint.config(...eslintPluginAstro.configs.recommended, {
plugins: {
"unused-imports": unusedImports,
},
rules: {},
languageOptions: {
sourceType: "module",
},
});
Was able to partially resolve this by adding ...tseslint.configs.recommended to the config and pointing parserOptions project to my tsconfig.json file.
Does eslint-plugin-astro work well, for you? For me it chokes on my base layout, it's weird. Apparently the preprocessor that turns the .astro to a Javascript source code has some bugs…
The generated types look wrong
It's supposed to look like this?
I can't help but notice you have different quotes, is it possible you ran a formatter on it and it destroyed the content perhaps?
It works for me, but if you can reproduce the issue consistenly on a certain file, I'd suggest creating an issue with a reproduction: https://github.com/ota-meshi/astro-eslint-parser
Thanks. There was actually an error in that file, that astro check never reported. Once I fixed it the eslint plugin had no problem parsing it. If you look at the screenshot, you can see <slot name="title"> is never closed.
The error message sure is confusing though ^^
It's not an error to have unclosed tags in Astro
Astro follows HTML's rules on that regard
Would a formatter remove content? That’s so strange…