-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[no-unused-expressions] false positive on dynamic import() #2108
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
yeah this is just not handled yet - it's not a common case at all. OOC - how often do you have a dangling (note - adding an |
We use dynamic imports to accomplish code-splitting in webpack and to enable prefetching/preloading via webpack. To my understanding, the example I gave doesn't need a To be honest, I'm not an expert in webpack so maybe these are bad reasons haha, but hopefully that answers your question. |
That makes sense yeah. It wouldn't be a difficult fix if you'd like to give it a go! |
I've never contributed to an open source project before, but I'd love to take a crack at it. Unfortunately I won't be able to start for a couple weeks, but if the issue is still open at that point I'll definitely come back to it. |
I believe I'm getting a false positive for
no-unused-expressions
when I use dynamic import statements.Repro
Expected Result
No linting error. The dynamic import is not unused or unnecessary.
Actual Result
The line is marked as a "no-unused-expressions" error.
Additional Info
Adding a
.then()
removes the error.This error only appeared after I upgraded from v2.34.0 to v3.0.1. I didn't see anything in the release notes about this rule changing.
Versions
@typescript-eslint/eslint-plugin
3.0.1
@typescript-eslint/parser
3.0.1
TypeScript
3.9.3
ESLint
7.1.0
node
13.11.0
npm
6.13.7
The text was updated successfully, but these errors were encountered: