-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Wrong detection of unused operator #33
Comments
A couple of things:
|
Thanks for the update. I do indeed use Angular CLI. A few weeks ago, it was working without any problem for this rule, but then it changed. It's hard to tell if this is related to having upgraded your package, or refactored a big part of the application. |
If you use npm (or yarn) with a lockfile, you could temporarily revert to an older commit and re-install. If that solves the problem, it might offer some clues. There is also this bug that I found, today, but I think that's unlikely to be your problem. (It seems to be upstream; either in TSLint or TypeScript.) Also, you should be aware of this gotcha. If all else fails, you could try replicating the problem by adding imports - similar to the problematic imports you are using in your app - to the Angular CLI example that's in this repo. If you're able to use the example to create a repro, I can likely be of more help. Good luck. |
I'll give a try to reverting to a previous build that did not show the problem. My concern is that the fix was probably some old code containing the Right now, the
In case it gives you a clue about the potential issue. |
Try adding some redundant usage of const foo = Observable.from([]); If that solves the problem then you'll know that it is the usage in |
Curiously, replacing the return call to |
Put the redundant usage outside of the function - i.e. at the start or end of the file. |
I put it as the first element of the file :
Still, no improvement :( |
I also put this redundant code in the |
Enable one of the rules that will let you force an error in that file - e g. |
I just added
|
Try to reproduce the problem with the example in this repo. It doesn't use https://github.com/cartant/rxjs-tslint-rules/blob/master/examples/ng-cli-example/src/rxjs.imports.ts If you cannot reproduce it, I don't think I can solve it. |
I just made a copy of my app... Problem was still reproducible as expected... |
I've added a fixture for this issue to ensure that In doing so, I've recalled how the Do you have a program that compiles without error? With TSLint, an AST can be produced even if there are some errors. However, the AST might be missing type information and if there are unknowns in it, the rules will be unable to determine what's observable and what isn't. I would set I've just seen your last comment. No, I don't have any suggestions. I think there is a general TypeScript/typing-related problem somewhere that's not specific to |
Closing this in the absence of a repro. |
I use this configuration for tslint :
It detects an unused operator in a file:
If I comment this operator in my global file, I then have the following error :
Which is correct since the
from
operator is used in this file.The text was updated successfully, but these errors were encountered: