Skip to content

Commit 9010cf4

Browse files
authored
test: add multiple components case
Signed-off-by: REL1CX <[email protected]>
1 parent d229530 commit 9010cf4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/plugins/eslint-plugin-react-x/src/rules/no-unused-props.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,22 @@ ruleTesterWithTypes.run(RULE_NAME, rule, {
790790
return <div ref={ref}>{props.foo}</div>;
791791
};
792792
`,
793+
// TODO: How should we handle situations where multiple components in a single file use the same props type definition, but each component uses a different part of it?
794+
tsx`
795+
interface Props {
796+
foo: string;
797+
bar: string;
798+
baz: string;
799+
}
800+
801+
function Component1({ foo, bar }: Props) {
802+
return <div>{foo}</div>;
803+
}
804+
805+
function Component2({ bar, baz }: Props) {
806+
return <div>{bar}</div>;
807+
}
808+
`,
793809
...allValid,
794810
],
795811
});

0 commit comments

Comments
 (0)