We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It appears the react/destructuring-assignment rule is not behaving consistently with type definitions.
react/destructuring-assignment
type Props = { text: string }; export const MyComponent: React.FC<Props> = (props) => { return <div>{props.text}</div>; // ^^^^^^^^^^ }; export const MyOtherComponent: React.FC<Props> = (props) => { const { text } = props; type MyType = typeof props.text; return <div>{text as MyType}</div>; };
MyComponent
MyOtherComponent
To me this appears as an unexpected inconsistency.
Using the code example above;
npx eslint ./eslint-test.tsx
I would expect both components to trigger the linter rule.
v7.34.3
v8.57.0
v18.20.2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is there an existing issue for this?
Description Overview
Brief description
It appears the
react/destructuring-assignment
rule is not behaving consistently with type definitions.Code example
What is happening? / What is the error?
MyComponent
, linter gives areact/destructuring-assignment
error.MyOtherComponent
linter stays silent.To me this appears as an unexpected inconsistency.
What command(s) did you run to reproduce issue?
Using the code example above;
Expected Behavior
I would expect both components to trigger the linter rule.
eslint-plugin-react version
v7.34.3
eslint version
v8.57.0
node version
v18.20.2
The text was updated successfully, but these errors were encountered: