ota-meshi / eslint-plugin-astro

ESLint plugin for Astro component
https://ota-meshi.github.io/eslint-plugin-astro/
MIT License
317 stars 23 forks source link

[parsing error] Typescript Parsing errors silently on `<script>` tags. Requires `--debug`. (`ESLint was configured to run on... .astro/1_2.ts`, TSConfig does not include this file ) #402

Open alexrecuenco opened 4 months ago

alexrecuenco commented 4 months ago

Before You File a Bug Report Please Confirm You Have Done The Following...

What version of ESLint are you using?

^8.57.0

What version of eslint-plugin-astro are you using?

^1.2.2

What did you do?

Please find the minimal reproducible case in the repository linked below

package.json ```json { "name": "astro-eslint-plugin-issue-report", "type": "module", "version": "0.0.2", "scripts": { "dev": "astro dev", "start": "astro dev", "build": "astro check && astro build", "preview": "astro preview", "astro": "astro", "lint": "eslint ." }, "dependencies": { "@astrojs/check": "^0.7.0", "astro": "^4.11.3", "typescript": "^5.5.2" }, "devDependencies": { "@typescript-eslint/parser": "^7.14.1", "eslint": "^8.57.0", "eslint-plugin-astro": "^1.2.2", "typescript-eslint": "^7.14.1" } } ```
eslint.config.mjs ```js import eslintPluginAstro from 'eslint-plugin-astro'; import tseslint from "typescript-eslint"; /** @type {import("@typescript-eslint/utils").TSESLint.FlatConfig.ConfigArray} */ export default [ {ignores: ["*.config.*"]}, ...tseslint.configs.strictTypeChecked, ...tseslint.configs.stylisticTypeChecked, // First issue, eslintPluginAstro MUST be defined after, since it overrides the typescript parser ...eslintPluginAstro.configs["flat/all"], { rules: { '@typescript-eslint/await-thenable': "error", // Error: Error while loading rule '@typescript-eslint/await-thenable': You have used a rule which requires parserServices to be generated. You must therefore provide a value for the "parserOptions.project" property for @typescript-eslint/parser. "@typescript-eslint/no-explicit-any": "error", }, }, { languageOptions: { parserOptions: { project: ["./tsconfig.json", "./tsconfig.eslint.json"], // When typescript/eslint v8 comes out this will become projectService // https://github.com/typescript-eslint/typescript-eslint/issues/9141 // EXPERIMENTAL_useProjectService: true, // DEPRECATED__createDefaultProgram: true, tsconfigRootDir: import.meta.dirname, }, }, } ]; ```
src/index.astro ```astro --- const a = 1; console.log("b"); const c: any = 1; const b = 0; --- Astro

Astro {a}

```

What did you expect to happen?

The code in Githubissues.

  • Githubissues is a development platform for aggregating issues.