Skip to content
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

SwitchAccountButton: Remove unused prop accounts. #3159

Conversation

jackrzhang
Copy link
Contributor

This is a silent type error that seems to have been introduced via b37352a#diff-73a6ef41677e3bf406fce93366e99735.

@gnprice gnprice added the review label Nov 21, 2018
@borisyankov
Copy link
Contributor

Nice. Is there a way to make these errors non-silent?

@jackrzhang
Copy link
Contributor Author

jackrzhang commented Nov 21, 2018

There is a react/no-unused-prop-types eslint rule, but that seems to be specific to the syntax React.propTypes and not flow.

(hm, still looking around...)

@jackrzhang
Copy link
Contributor Author

According to jsx-eslint/eslint-plugin-react#1412, this should be supported. Maybe there's something that's not being done with the eslint configuration?

@borisyankov
Copy link
Contributor

Possible. We did turn off some Flow and ESLint configurations.
If you are curious you can try turning on some of these offs here:
https://github.com/zulip/zulip-mobile/blob/master/.eslintrc.yaml

@gnprice gnprice force-pushed the remove-unused-switchaccountbutton-prop-accounts branch from b21e239 to 26bc7e5 Compare December 4, 2018 04:10
@gnprice gnprice merged commit 26bc7e5 into zulip:master Dec 4, 2018
@gnprice gnprice removed the review label Dec 4, 2018
@gnprice
Copy link
Member

gnprice commented Dec 4, 2018

Thanks @jackrzhang ! Merged.

I share @borisyankov 's reaction 🙂 -- it would be great to have this automatically checked. I played with it a bit just now, but didn't find a way; in particular, making that Props an exact type was no help. I suspect unfortunately a Flow-based approach won't be helpful until connect has more of a real-type signature:

  declare export function connect<
    Com: ComponentType<*>,
    S: Object,
    SP: Object,
    RSP: Object,
    CP: $Diff<OmitDispatch<ElementConfig<Com>>, RSP>,
    ST: {[_: $Keys<Com>]: any}
    >(
    mapStateToProps: MapStateToProps<S, SP, RSP>,
    mapDispatchToProps?: null
  ): (component: Com) => ComponentType<CP & SP> & $Shape<ST>;

Look at all those Objects and anys. 😢

Alternatively an ESLint-based fix would be great, if someone can find a rule that works for this.

@jackrzhang jackrzhang deleted the remove-unused-switchaccountbutton-prop-accounts branch December 6, 2018 23:11
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.

None yet

3 participants