-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Newly created Vue SFC File: Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser #1303
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
Comments
If you try to upgrade TypeScript ? Talk your |
@yoyo930021 PS. Also, my Typescript is 3.7.3 now and the same is still happening. |
This also happens to me too in VS Code when a new file is added. Have to restart VS Code each time for it to go away.
|
@eyedean @demisx @yoyo930021 today we merged pr (#1412) that fixes ~similar issue (not in vue sfc), can you re-test it with |
@armano2 I tested typescript-estree version 2.15.1-alpha.7 and it still has the issue with newly created ts/tsx files when using the vscode extension |
@robbiespeed can you tell me step by step what are you doing (files/folders wise), or is this happening for any |
Thanks for looking into this @armano2 . I just tested All I do is I duplicate one of the files I have (basically create a new file with some .ts content) and it errors on the first character of the first line with the same parsing error as above. It goes away when I restart my VS Code (cmd+shift+P, Reload Window). I am on Mac OS 10.14.5 and VS Code 1.41.1. I have this issue constantly since like a month ago and I didn't have this issue like 3 months ago. My feeling is for some reason the eslint service in the background (both for VS code and my Quasar CLI front-end compiler) doesn't recognize the new files when they are created while the service is up. But after a restart, when it does a full new scan, it's fine with the file being already there. |
i was able to reproduce this in simple example project, i will take a look into this |
Also, since it's only happening to some of us, I wonder if it might be something in the config that we are doing wrong. (Screenshot removed for personal security concerns) |
this is completly unrelated to rules or vue plugin if someone is interested repo: https://github.com/armano2/typescript-eslint-1394 |
It seems to only happen randomly now when creating a file in a newly created folder. Here's one of the errors with debug enabled:
System / Project Detailsos: Linux (Fedora 30) vscode: 1.14.0 eslint extension: microsoft/eslint 2.0.13 eslint: 6.7.2 typescript-eslint/eslint-plugin: 2.15.0 typescript-eslint/parser: 2.15.0 typescript-eslint/typescript-estree: 2.15.1-alpha.7 tsconfig.json:
(Also tried adding .eslintrc.json:
|
Small update about my research:
|
What is meant by custom extension? |
custom -> not supported natively by typescript (ts, tsx, js, jsx, json) in vscode settings i changed file association of *.test to typescript and added it to project configs, // edit: i hate typing on phone |
as for ts and tsx files: vscode is starting failing on all files after first custom (eg. vue) file is created |
@armano2 I have only tsx and ts files in my project and it's still happening. I'll try and create an example project to reproduce. |
My temporary solution: additional tsconfigs for files with errors. In my case one tsconfig for every problem directory. |
Thanks for working on this @armano2 and @bradzacher. Please let me know when it's going to be out, so I can verify and confirm that the fix is working for both my .ts and .vue projects. Thanks! 🙌 |
it should be live already you can check alpha version |
Magic! 🎉 I confirm that it's now fixed for both |
What code were you trying to parse?
I run into the infamous error of not finding the parser (similar to #1159 and #883) for new Vue files I create in my project. NOTE: a restart of VS and my live compiler eliminates the problem until the next time I create a new
.vue
file.I am using Quasar, and vue-class-component for my SFC Vue files.
Error details:
Per the request at #1159 (comment) I am creating this new ticket.
What did you expect to happen?
The new Vue file should be picked up normally. Again, a restart of live tsc and VS code fixes it, but it kinda takes 1 minute for my project.
What actually happened?
It used to work flawlessly until I upgraded typescript-eslint, after a few months, recently. Looking at e3f3448 which was the fix for a similar problem, the symptom I am seeing is very related to
parsedFilesSeen
not picking up the newly created file.vue
on-the-fly.Additional Notes
Per https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser for parsing Vue files, I have the following in my
.eslintrc
:And then it is in my
tsconfig.eslint.json
that I am mentioning all the Vue files should be picked:Versions
@typescript-eslint/parser
2.10.0
(was the same on2.8.0
)TypeScript
3.3.3
ESLint
5.16.0
(It's on purpose to be on 5, rather than 6)node
12.3.1
npm
6.13.0
The text was updated successfully, but these errors were encountered: