Skip to content

Commit 961ba4e

Browse files
committed
add basic examples to doc page
1 parent d5c321f commit 961ba4e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,32 @@ Warns about unused component prop declarations.
2222

2323
### Failing
2424

25+
```tsx
26+
interface Props {
27+
abc: string; // used
28+
hello: string; // NOT used
29+
}
30+
31+
function Component(props: Props) {
32+
const { abc } = props; // `hello` isn't accessed from `props`
33+
return null;
34+
}
35+
```
36+
2537
### Passing
2638

39+
```tsx
40+
interface Props {
41+
abc: string; // used
42+
hello: string; // used
43+
}
44+
45+
function Component(props: Props) {
46+
const { abc, hello } = props;
47+
return null;
48+
}
49+
```
50+
2751
## Implementation
2852

2953
- [Rule source](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x/src/rules/no-unused-props.ts)

0 commit comments

Comments
 (0)