#ESLint "Parsing error: Type expected" erroring on '.astro/types.d.ts'

14 messages · Page 1 of 1 (latest)

arctic temple
#

I'm currently running into an issue with ESLint failing for a repo due to types in Astro's generated type file. Not really sure how to debug what's wrong here, any help would be appreciated 🙏

#

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",
  },
});
arctic temple
#

Was able to partially resolve this by adding ...tseslint.configs.recommended to the config and pointing parserOptions project to my tsconfig.json file.

fossil salmon
#

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…

warm python
#

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?

warm python
fossil salmon
#

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 ^^

warm python
#

It's not an error to have unclosed tags in Astro

#

Astro follows HTML's rules on that regard

arctic temple