-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
Comments
.astro/n_m.ts
files<script>
tags. Requires --debug
. (ESLint was configured to run on... .astro/1_2.ts
, TSConfig does not include this file )
<script>
tags. Requires --debug
. (ESLint was configured to run on... .astro/1_2.ts
, TSConfig does not include this file )<script>
tags. Requires --debug
. (ESLint was configured to run on... .astro/1_2.ts
, TSConfig does not include this file )
Got it. I can reproduce it by commenting out The problem is that the virtual files generated by the eslint processor cannot be parsed with types using For now, you must disable type checking for virtual files. {
files: ["**/*.astro/*.ts"],
languageOptions: {
parserOptions: {
project: null
},
},
...tseslint.configs.disableTypeChecked
} |
It is related to this issue. |
Thank you for your time Is it possible to provide feedback when it fails? Now it is failing silently and that makes it hard to understand what was going on I was looking at the internals already, so I could try to help... see if I find how to feed the virtual file information and do a PR? I don't know if I have enough time, but any hints/guidance on how I might be able to get started? Or maybe you want to wait for es lint 9 and typescript-eslint 8 |
I don't know yet if there is a way to solve them. Maybe there are other problems besides this plugin, so we need to look into them one by one. |
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
eslint.config.mjs
src/index.astro
What did you expect to happen?
The code in <script> tags is linted
What actually happened?
The code in between
---
is linted, but not the one insidescript
tagsLink to Minimal Reproducible Example
Minimal reproducible example can be found at the tag
minimal-error
on this repo (See this last commit for extra details on the exact steps taken): https://github.com/alexrecuenco/astro-eslint-plugin-report-issue/tree/minimal-errorOn top of that, I did some further exploration and I describe my brief findings on the commit message(s) at this tag https://github.com/alexrecuenco/astro-eslint-plugin-report-issue/tree/type-discrepancy
__
Additional comments
First of all, I reported an issue that seems to have disappeared with a related problem. I had thought it was fixed, but it turns out it isn't.
In that thread, —which I can't reference anymore since it must've gotten cleaned/cleared— by following the recommendations of this plugin's authors I added
That seems to have done the trick, I stopped getting typescript-eslint crashing when running. Unbeknownst to us, it turns out, the issue was still hiding away. By running with
--debug
you can see that all the "virtual typescript files" (*.astro/1_1.ts
) are not parsed. These represent thescript
tags, and because the error happens in a file that isn't real, eslint doesn't report you the issue, it simply crashes silently while processing those files.Here is the result running with
--debug
:I have tried to solve this by:
includes
projectService
is meant to process files that are "outside the project" it should be able to help, but that didn't work due to some other incompatibility between versions, I believe eslint-plugin-astro still doesn't regard eslint 9 as a valid peer dependency.EXPERIMENTAL_useProjectService
. Funnily enough, that makes the top section of an astro file fail with a parsing error, even thoughscript
tags now report linting appropriately ./node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js
Well, looking at that section, by using
DEPRECATED__createDefaultProgram: true
in the settings it "works". It can parse both script tags and the top section of an .astro file.But of course, once you do that, the recommended trick to create a
jsx.d.ts
stops working, it regards everything as "any" (that is what the tag [type-discrepancy
] explores)For context, the full debug output of eslint that I have described can be found in the repo linked on the files
/results-*.md
I hope this report is helpful to find how to fix this
The text was updated successfully, but these errors were encountered: