Open balassy opened 7 years ago
I've (only quickly) read your issue and would like to confirm whether or not you've read and followed the Angular CLI recommendations in the README.md.
Yes, I did, thank you. If I understand correctly, it is about the case when only an application file is using an operator, but not any test file, and your recommendation helps fixing the problem when linting the test files. This issue is about the opposite direction: only a test file is using an operator, but any application file, and the linting of the application files is failing.
Off the top of my head, I cannot think of an ideal solution to this. The linting of the application and test files uses the same tslint.json
configuration and, therefore, the same central file of imports.
A hacky solution would be to create an unused.ts
file that will be matched in the linting of the application, but not the tests and include in that file a function that 'uses' whichever operators are not used in the application. Of course, that means that said operators will be linked into the application even though they are not really needed. Not ideal.
Alternatively, you could look into what's involved in getting Angular's CLI to use a different tslint.json
file for the test linting, but that's probably something that cannot be changed without ejecting. If tests could be linted using their own tslint.json
- like the e2e tests - this would be easy to solve, but they cannot be, as they are in the same directory as the application files (so creating a local, relative tslint.json
won't work).
On the plus side, the good news is that this sort of annoyance will be a thing of the past with the lettable/pipeable operators in RxJS 5.5.
Thanks for your reply, Nicholas.
@balassy Any stuff in tsconfig? I had a few unused variable rules in there which threw that error.
I have the following
rxjs.imports.ts
file in an Angular 4 project:I have the following rule in the
tslint.json
file:The following error is thrown when I run
tslint
:I am using
Observable.of(...)
in my code, however only in one single.spec.ts
file. It seems that the error is thrown during linting the application files, because if I remove the following block from thelint
section of the.angular-cli.json
file, the error disappears:Do you have any recommendation on how can I fix this, or this is just another gotcha that would be useful to add to the README?
Thank you!