Open vegerot opened 3 years ago
Copy/paste the code from #3145 (comment)
Asking us to generate a project with your listed dependencies (hopefully with the right options that you chose), copy-paste code (hopefully in the right place, hopefully using dependencies correctly) - that's not a runnable reproduction.
Please respect the issue guidelines and provide a runnable reproduction.
@LinusBorg apologies. Will do
Link to reproduction repo: https://github.com/vegerot/vue-cli-6320
@LinusBorg should I make a new issue, or continue using this one?
@LinusBorg I see you tagged this as "needs team repro". Is there anything I can do to help with that?
that tag means that a team member has to check out your repro. You can only way that someone can pick it up. I won't be able to look into this as I have a few other bases to cover.
@LinusBorg it's been a few months now and this bug is preventing our team from upgrading ESLint and TypeScript. I'm wondering what I can do to help get this fixed. Do you have a project board where you are tracking the order these issues get completed in?
Hi @vegerot,
thanks for the patience. I couldn't make the time back then to look into it, and thing get drowned out quickly.
I ran your reproduction repository and couldn't reproduce the error/warning in question, neither during serve
nor build
:
Is there anything special I need to do?
Edit: I was able to get the error switching import type
to import
. But with import type
I don't get any eslint errors.
I also read the discussion in the typescript-eslint repo, but personally can't claim to have fully understood - I don't really use decorators and have zero knowledge about decorator metadata and the intricacies of that.
Do these warnings only happen for the decorators you are using from vuex-class
, though? Maybe the issue is to be found there - that lib hasn't been updated in 3 years, maybe something needs to be updated - TS upgrades have a tendency to break stuff even in minor releases as well. Taking into account that this type of problem hasn't been reported by other users of vue-class-component
or vue-cli, my suspicion would be in that direction.
If you can help come up with a reproduction that actually demonstrates the problem, and provided that it's only happening for the decorators from @vuex-class
, I'd ask you to open an issue there and I'll ping its maintainer, ktsn - he's a team member.
I don't really see an early indication how/where this can be solved on vue-cli's end, as we don't do anything fancy with TS - vue-loader
delegates compilation of TS code to the ts-loader
and outputs that result as-is. But #3145 shows there are multiple of these instances, though they seem rare (It's hard to judge which scenarios are affected as you are the first person in over 2 years to actually submit a reproduction).
@LinusBorg let me explain a bit more clearly the issue:
If I use import type
, typescript-eslint
complains that I should be using import
instead.
If I use import
, vue-cli
complains that export "foo" was not found in 'bar'
I understand that.
But for me, eslint complains when I use import
, and doesn't when I use import type
:
import
:
import type
:
...and when using import type
, everything builds fine, too, and don't get any eslint warnings when running npm run lint
or anything.
So I can't really reproduce the problem with the repo you provided.
I may need to update eslint in the demo repo
@LinusBorg my apologies. I have updated the dependencies to reflect the bug
Thanks, that makes it reproducible in the way you describe it.
So, I'll try and recap the situation:
Typescript/Build warnings about exports not being found
import type ...
for the affected type imports or emitDecoratorMetaData: false
in tsconfig.json
.typescript-eslint
misinterprets it as an errortypecript-eslint
warnings
import type ...
syntaxtypescript-eslint
isn't able to detect that properly (See https://github.com/typescript-eslint/typescript-eslint/issues/3108#issuecomment-785414796)./* eslint-disable-next-line @typescript-eslint/consistent-type-imports */
import type { ActionMethod } from 'vuex';
outside of these options, I wouldn't count on a quick resolution of this issue given its wider history, and I would presume that it's not something we can fix in Vue-CLI itself anyway.
Not sure where to go next, TBH.
@ktsn Have you come across problems like these, maybe?
- The underlying issue seems to be resolvable by either using
import type ...
for the affected type imports oremitDecoratorMetaData: false
intsconfig.json
.- You (presumably) can't use the latter because your codebase relies on it (even though it seems to have no negative effect in the reproduction repo).
I believe vue-property-decorator
uses type annotations for prop type-checking. Meaning emitDecoratorMetaData
probably has no effect in production, but would affect development
@LinusBorg @ktsn any thoughts on how we should proceed?
I find the "export 'ActionMethod' was not found in"
warnings very annoying (getting literally hundreds of them), and the typescript-eslint
errors are preventing us from releasing.
Should I bring this issue somewhere else? How can I help unblock my team?
Version
4.5.11
Reproduction link
https://github.com/vegerot/vue-cli-6320
https://github.com/vuejs/vue-cli/issues/3145#issuecomment-785268090
Environment info
Steps to reproduce
Copy/paste the code from https://github.com/vuejs/vue-cli/issues/3145#issuecomment-785268090
Run
vue-cli-service serve
What is expected?
Get no warnings in the console
What is actually happening?
Please read https://github.com/typescript-eslint/typescript-eslint/issues/3108#issuecomment-785414796 and https://github.com/vuejs/vue-cli/issues/3145#issuecomment-785268090