-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
TS Parsing errors #1223
Comments
Just had a revelation. Those errors are random but always pop up in code where a lot of brackets I am guessing that the parser that splits the The last error look a little bit like the script was cut short at the As you can see in the issue, all my script blocks look like |
Guess it's the same issue as vuejs/vue-cli#4993 (comment) |
@sodatea I think you're right. Looks like my hunch about angle brackets was on point: not because of HTML parsing but because of JSX (TSX) ambiguity. That The other issue is closed but the problem seems to persist. Some guy in the other issue says it might be a bug in The only errors I have come from TS code extracted from |
I just realized the linked issue was caused by this line: https://github.com/vuejs/eslint-config-typescript/blob/9b3245240f3c97b46c3e0435b6ac1ed6041b732d/index.js#L11 It affects TypeScript's handling of But I'm not sure where your problem is from. What about explicitly setting this option to |
@sodatea Great thanks! I was looking into those options and you beat me to it! Setting I'm gonna say Turns out that this setting is ignore for known file extensions, so setting this to If you don't want to change anything in the plugin, it's probably nice to add a note in the getting started docs. |
Yeah right. Didn't notice it's already set in the base config eslint-plugin-vue/lib/configs/base.js Line 12 in a2614ef
Cc @ota-meshi |
@sodatea @jods4 Thank you for finding the cause. This I looked in the commit history for the first time and didn't know why added it. In my opinion, it makes sense to change the base config so that JSX users themselves change the Do you think you should change the base config? Or do you think it's enough to just document the |
@ota-meshi Note that the setting is only taken into account for unknown file extensions, e.g. The only case here would be someone doing JSX inside a So I'd say a better default is As it stands, typescript users can easily get into those obscure parsing errors because of casts or generics. |
I'm not sure whether there are more people encountering this problem or more people using |
Thank you for telling me your thoughts. I think |
Hey y’all, I seem to be getting the same/very similar issue (loader gives nonsense parsing errors on my Vue templates). I suspect it’s only a similar type of issue since However this is a complete show-stopper and I haven’t been able to find much online, so I thought I would post something here. My .eslint.js file:
Package versions:
EDIT: This turned out to be unrelated to the issue; at some point I must have dropped the
|
Tell us about your environment
Please show your full configuration:
What did you do?
What did you expect to happen?
Anything but parsing errors.
This code is valid typescript and compiles fine, but eslint parsing chokes on it with parsing errors (see below).
There are a few other random parsing errors in other files but always in
.vue
files.None of those seem related or new syntax. It just doesn't make sense to me.
Everything compiles and runs fine.
Unfortunately there are lots of moving pieces here, as I'm using eslint through fork-ts-checker, and I've got both the typescript and vue plugins layered on top of each other.
I put
parser: "@typescript-eslint/parser"
inparserOptions
, as the docs says.What actually happened?
This is one example of an error I'm getting:
I have a fair amount of complex TS in
.ts
files as well, but I'm only getting parser errors from.vue
files. So I figure something must be wrong when the vue plugin is involved, although I have no idea what or why.More examples of errors I'm getting:
The text was updated successfully, but these errors were encountered: