-
-
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 Error warnings for Unused patched operator in ./rxjs.imports.ts #8
Comments
Have you seen #4? Are you definitely not using |
I think the only way to resolve it would be to include in the tests a file that contains an uncalled function that uses the unused operators. Unless the CLI's linting can be configured differently for each if the three runs, I cannot see an easy way around the problem. Or you could aim for 100% test coverage. 😀 |
I saw #4 and it makes no difference either I use Ok thank you for your information, I will try to dig deeper in the documentation/code of the CLI if I can configure the three run's (but don't think so). 100% test coverage with also testing the RxJS operators 😀 Now Way 😀 |
So my solution (for now) is: Because it is a For the .spec linting run no rxjs operators unused linting errors are reported (because all files with *.spec.ts are included). To fix the rxjs operators unused linting errors also for the e2e run I just added to the
If anyone reads this and knows a better solution I would be happy to hear it 😀 |
I'm contemplating whether or not to implement something to better manage this - as using I can see how the e2e tests will always be a problem, but how is it that you have application files that use RxJS operators that are not present in the second run of TSLint? That is, why are they not included when linting the test files from |
Sorry, I am not sure if I got your question right. But in the "second" run, the .spec run, only the *.spec.ts files are included (or if I import components or services that I want to test or to mock they are also included) from my app. |
Thanks. That makes sense. I'll have a dig around for the actual TSLint configurations, but you are surely correct. The application files will be loaded, by TypeScript, to build the program, but that doesn't mean they will be checked by TSLint. I'll give it some thought. |
Currently, I would be happy if the rxjs-operators linting would just run for the "app" linting (the first run?). Or if it is possible to configure something that it runs with Btw. thanks a lot for the really fast replies. |
If you need a pretty easy project setup to try and play around with it, I could prepare something, or you just try it with a new created angular project with |
I've had a quick look at this and I've added some notes to the README.md. When using the Closing this, but feel free to re-open if there are further problems. Happy to continue the conversation without re-opening, too. |
Thank you a lot. Just a short information to the
|
It's possible that it depends upon the version of {
"extends": ["../tslint.json"],
"rules": {
"rxjs-add": { "severity": "off" }
}
} The CLI's lint task should look for |
Oh cool. |
@carcant - regarding your comment #8 (comment)
I've got this issue where Interestingly it appears that chaining operators & reduce might be to blame, as if if separate my statement into multiple statements it doesn't throw up the unused error:
|
@chriswhite199 It's not clear from you comment whether or not the linting works as expected on the main source file alone. If it, too, fails, then it's a separate issue to this one. If it does not, I suspect it's related to either:
The |
Sorry for being unclear:
I guess the long and the short of it is it must be something similar to the gotcha as splitting over two lines means that the TypeChecker finds an Observable after the first line (as the const is explicitly typed). |
It's still not clear whether or not it's related to this issue. This issue is specific to the Angular CLI's multi-pass approach to linting. If splitting it into two lines completely solves your problem, it's a separate issue to this one. In which case, it would be preferable to open another issue. |
Can you please open this Issue? I have the following in my
Still getting |
@kamok Please refer to the README and the repo's example Angular CLI configuration. Note that the commit that adds the If none of that helps, please open a new issue, with specifics regarding your versions and configuration, etc. Particularly, if said configuration differs from the example. |
It turned out to be the unused variable stuff in tsconfig. I didn't know they were there, as well as tslint.json. Thanks... |
@kamok No worries. I appreciate your reading through the issues to find one related to your problem, but I think I speak for most maintainers in recommending that instead of commenting on a closed issue, a new issue should be opened with references to any relevant/related issues. As you can see from your resolution, it was not the same issue. Anyway, glad to hear that you have it working. |
Hello,
first I want to say thank you for your really good work here. 👍
So now to my problem:
I am using the rxjs-add rule like this:
So I use the approach to have all rxjs operators in on central file and nowhere else it is allowed to have them and don't have unused imports for the rxjs operators in the central rxjs operator import file.
That worked fine I just got the same error that was mentioned here: #5
I could fix that, but now I am getting linting errors for Unused patched operator although they are for sure used in my project.
I think this problem is related to the stuff that it is an angular project created with angular-cli and calling ng lint and that run's tslint three times (like you explained it):
src/
;src/
;e2e/
.So I think because not all application files are there for the second and third run I get the errors with the Unused patched operators.
For now, my only solution is to use
"allowUnused": true
.Do you have an idea or hint how I could fix this problem?
The text was updated successfully, but these errors were encountered: