-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-unsafe-*] rules are triggered on members imported from Vue component modules #2865
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
This is expected. We are built on top of TypeScript, and TypeScript does not support Vue syntax. But why does your webpack build work? Because your webpack build doesn't use pure typescript, just like your IDE doesn't use pure typescript. Both make heavy modifications to TS so that it can understand Vue syntax. Unfortunately we simply cannot provide type information for imported Vue files (if they use vue's template syntax). The Vue eslint parser will do its magic and let you use type aware lint rules within Vue template files, but that does not help when they are imported. |
Would this be something to bring up with their team to see if anything can be done to make the TypeScript parse work? |
There's just not been a whole lot of interest from the Vue community to support Vue in linting (nobody wants to [/ has the time to] champion it) There are also issues due to lack of features from typescript (no compiler plugins means it's hard to build support). @yoyo930021 has been pitching in when able, and might have some additional insight. |
I will take a look. Vue team have a ts plugin for inject typescript. I'll talk to the Vue team. |
That would be great. |
CLosing this as there's nothing we can action. |
Repro
https://github.com/6XGate/VueTypeSciprtLinting/tree/main/src/page/home/parts
In this example project, WebPack cannot compile the project with ESLint enabled due to many of the
[no-unsafe-*]
rules. Disabling it allows it to compile just fine. You can change some of the calls or properties accessed on the Vue components to something that does not exist, and TypeScript will not allow you to compile the project demonstrating that it knows the type information.ESLint config: in repo
TS config: in repo
index.ts: in repo
HomePage component: in repo
Counter component: in repo
Expected Result
This project should compile without any problems and not have any safety holes as detected by these rules.
Actual Result
The project will display errors related to the various
[no-unsafe-*]
rules.As far as I can tell, ESLint did not throw any exceptions.
Versions
@typescript-eslint/eslint-plugin
4.9.1
@typescript-eslint/parser
4.9.1
TypeScript
4.1.2
ESLint
7.15.0
node
12.19.0
The text was updated successfully, but these errors were encountered: