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

no-unused-prop-types fails even that props is used in mapDispatchToProps #1832

Closed
muhabalwan opened this issue Jun 19, 2018 · 1 comment
Closed

Comments

@muhabalwan
Copy link

muhabalwan commented Jun 19, 2018

"react": "^16.2.0", "eslint-plugin-react": "^7.9.1",

// @flow
type Props = {
  accountId: number, 
}

class ExampleCompnent extends React.Component<Props> { 
// I am NOT using props.accountId here 
}

const mapDispatchToProps = (dispatch, ownProps: Props) => ({
console.log(ownProps.accoutnId);
})

but I get the following error message:
[eslint] 'accountId' PropType is defined but prop is never used (react/no-unused-prop-types)

defining another type specially for mapDispatchToProps does not make sense, since OwnProps is coming from ExampleCompnent, what should I do ?

@ljharb
Copy link
Member

ljharb commented Jun 19, 2018

This is something very specific to connect; see #811 (comment)

I think you’ll need an override comment for this one.

@ljharb ljharb closed this as completed Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants