Skip to content

Commit b820d71

Browse files
committed
docs: add 'jsx-no-duplicate-props'
1 parent 2607671 commit b820d71

File tree

4 files changed

+27
-0
lines changed

4 files changed

+27
-0
lines changed

packages/plugins/eslint-plugin-react-x/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default [
3030
rules: {
3131
// react-x recommended rules
3232
"react-x/ensure-forward-ref-using-ref": "warn",
33+
"react-x/jsx-no-duplicate-props": "warn",
3334
"react-x/jsx-uses-vars": "warn",
3435
"react-x/no-access-state-in-setstate": "error",
3536
"react-x/no-array-index-key": "warn",
@@ -75,6 +76,7 @@ export default [
7576
| `avoid-shorthand-boolean` | Prevents using shorthand syntax for boolean attributes. | 🎨 | | |
7677
| `avoid-shorthand-fragment` | Prevents using shorthand syntax for fragments. | 🎨 | | |
7778
| `ensure-forward-ref-using-ref` | Requires that components wrapped with `forwardRef` must have a `ref` parameter. | ✔️ | | |
79+
| `jsx-no-duplicate-props` | Prevents duplicate props in JSX. | ✔️ | | |
7880
| `jsx-uses-vars` | Prevents variables used in JSX to be marked as unused. | ✔️ | | |
7981
| `no-access-state-in-setstate` | Prevents accessing `this.state` inside `setState` calls. | ✔️ | | |
8082
| `no-array-index-key` | Prevents using array `index` as `key`. | 🧐 | | |

website/pages/docs/rules/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default {
99
type: "separator",
1010
},
1111
"ensure-forward-ref-using-ref": "ensure-forward-ref-using-ref",
12+
"jsx-no-duplicate-props": "jsx-no-duplicate-props",
1213
"jsx-uses-vars": "jsx-uses-vars",
1314
"no-access-state-in-setstate": "no-access-state-in-setstate",
1415
"no-array-index-key": "no-array-index-key",
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# jsx-no-duplicate-props
2+
3+
## Rule category
4+
5+
Correctness.
6+
7+
## What it does
8+
9+
This rule prevents the use of duplicate props in JSX elements.
10+
11+
## Examples
12+
13+
### Failing
14+
15+
```tsx
16+
<Hello name="John" name="Doe" />;
17+
```
18+
19+
### Passing
20+
21+
```tsx
22+
<Hello name="John" />;
23+
```

website/pages/docs/rules/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
| [`avoid-shorthand-boolean`](avoid-shorthand-boolean) | Prevents using shorthand syntax for boolean attributes. | 🎨 | | |
2727
| [`avoid-shorthand-fragment`](avoid-shorthand-fragment) | Prevents using shorthand syntax for fragments. | 🎨 | | |
2828
| [`ensure-forward-ref-using-ref`](ensure-forward-ref-using-ref) | Requires that components wrapped with `forwardRef` must have a `ref` parameter. | ✔️ | | |
29+
| [`jsx-no-duplicate-props`](jsx-no-duplicate-props) | Prevents duplicate props in JSX. | ✔️ | | |
2930
| [`jsx-uses-vars`](jsx-uses-vars) | Prevents variables used in JSX to be marked as unused. | ✔️ | | |
3031
| [`no-access-state-in-setstate`](no-access-state-in-setstate) | Prevents accessing `this.state` inside `setState` calls. | ✔️ | | |
3132
| [`no-array-index-key`](no-array-index-key) | Prevents using array `index` as `key`. | 🧐 | | |

0 commit comments

Comments
 (0)