Skip to content

Commit 3d58253

Browse files
Luccasoliljharb
authored andcommitted
[Docs] jsx-sort-propts: replace ref string with ref variable
1 parent 9055439 commit 3d58253

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
66
## Unreleased
77

88
### Fixed
9-
* [`jsx-key`]: avoid a crash with optional chaining ([#3371][], @ljharb)
9+
* [`jsx-key`]: avoid a crash with optional chaining ([#3371][] @ljharb)
10+
11+
12+
### Changed
13+
* [Docs] [`jsx-sort-propts`]: replace ref string with ref variable ([#3375][] @Luccasoli)
14+
15+
[#3375]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3375
16+
[#3371]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3371
1017

1118
## [7.31.1] - 2022.08.26
1219

1320
### Fixed
1421
* [`jsx-key`]: fix detecting missing key in `Array.from`'s mapping function ([#3369][] @sjarva)
15-
* [`jsx-no-leaked-render`]: coerce strategy now allows a ternary ([#3370][], @sjarva)
22+
* [`jsx-no-leaked-render`]: coerce strategy now allows a ternary ([#3370][] @sjarva)
1623

1724
[7.31.1]: https://github.com/jsx-eslint/eslint-plugin-react/compare/v7.31.0...v7.31.1
18-
[#3371]: https://github.com/jsx-eslint/eslint-plugin-react/issues/3371
1925
[#3370]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3370
2026
[#3369]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3369
2127

docs/rules/jsx-sort-props.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ This can be a boolean or an array option.
125125
When `reservedFirst` is defined, React reserved props (`children`, `dangerouslySetInnerHTML` - **only for DOM components**, `key`, and `ref`) must be listed before all other props, but still respecting the alphabetical order:
126126

127127
```jsx
128-
<Hello key={0} ref="John" name="John">
129-
<div dangerouslySetInnerHTML={{__html: 'ESLint Plugin React!'}} ref="dangerDiv" />
128+
<Hello key={0} ref={johnRef} name="John">
129+
<div dangerouslySetInnerHTML={{__html: 'ESLint Plugin React!'}} ref={dangerDivRef} />
130130
</Hello>
131131
```
132132

@@ -135,7 +135,7 @@ If given as an array, the array's values will override the default list of reser
135135
With `reservedFirst: ["key"]`, the following will **not** warn:
136136

137137
```jsx
138-
<Hello key={'uuid'} name="John" ref="ref" />
138+
<Hello key={'uuid'} name="John" ref={johnRef} />
139139
```
140140

141141
### `locale`

0 commit comments

Comments
 (0)