noUnusedVariableRule should apply the ignorePattern to imports #3187
Conversation
Thanks for your interest in palantir/tslint, @brandf! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request. |
I'm happy to add tests/doc changes, but will need some direction on getting setup to run them. I just did a quick 'fork and edit this file' on github. |
Regarding documentation: docs are generated from the metadata in the rule. That means you can simply replace line 41 with
Regarding tests: you can add a test case in To test this locally, you need to
|
Sorry for the delay on this, I will follow up with ajafff's suggestions soon. In laws are in town, so not a lot of time atm ;-) |
@ajafff, apologies again for the delay on this. The latest includes the easier fix, docs updated, test case, and tests passing. |
Container 3 in circleci is failing - I can repro it locally with:
...but I'm not sure how to fix it. It looks like the error message is different in typescript@next:
|
After looking at other PR's, the CI failure appears to be unrelated to my change. It's just a coincidence that it was failing in the rule I modified :-/ For example, same failure here: |
Please merge master into your branch to fix the CI failures |
I'm not able to turn this rule on for my project because we use tsx with a custom namespace. The namespace must be imported, but the sugar'ed code doesn't use it. I tried applying the ignore-pattern to this namespace and it didn't work without this change. adding a test case, doc fix, and easier fix that ajafff suggested
Should be all set - green CI after rebasing |
@adidahiya, you can remove the 'waiting on author' tag. Should be good to merge. |
Thanks @brandf |
I have a import that I need to ignore (custom reactNamespace), however ignore-pattern is not applied to imports.
PR checklist
Overview of change:
applies the importPattern to importNames (in addition to the existing behavior)
Is there anything you'd like reviewers to focus on?
not sure if importName.text is the correct thing to test against, but it seems to work.