Skip to content

feat: Ignore args required for strong typing correctness #53

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

Merged
merged 4 commits into from
May 11, 2019

Conversation

matthargett
Copy link
Contributor

Summary

In our codebase, we have this pattern:

animate = (_: ?number) => {};

That triggers the unused-vars warning due to the argument being unused. In this instance, the argument is there to pass strong-type checks, and we have a code style guideline that uses prepending of underscore to signify that the argument (or catch variable) is unused.

This PR adds a narrowing and widening of the no-unused-vars rule:

  1. to ignore unused arguments that begin with an underscore (a narrowing)
  2. to report unused caught exceptions that don't begin with an underscore (a widening since unused caught errors was previously OFF by default)

Test plan

Added code examples to test JS file, verified no errors.

In our codebase, we have this pattern:
```js
animate = (_: ?number) => {};
```

That triggers the unused-vars warning due to the argument being unused. In this instance, the argument is there to pass strong-type checks, and we have a code style guideline that uses prepending of underscore to signify  that the argument (or catch variable) is unused.

This PR adds a narrowing and widening of the no-unused-vars rule:
1.  to ignore unused arguments that begin with an underscore (a narrowing)
2. to report unused caught exceptions that don't begin with an underscore (a widening since unused caught errors was previously OFF by default)
Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

@thymikee thymikee changed the title Ignore args required for strong typing correctness feat: Ignore args required for strong typing correctness May 11, 2019
@thymikee thymikee merged commit 6d10db2 into callstack:master May 11, 2019
@thymikee
Copy link
Member

Based on 2. we should release a major version

@thymikee
Copy link
Member

@matthargett matthargett deleted the patch-3 branch May 12, 2019 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants