Skip to content

Commit 35a33f1

Browse files
committed
[New] jsx-sort-props: add className to RESERVED_PROPS_LIST
1 parent 4ef92b4 commit 35a33f1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/rules/jsx-sort-props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,15 @@ When `true`, alphabetical order is **not** enforced:
122122

123123
This can be a boolean or an array option.
124124

125-
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:
125+
When `reservedFirst` is defined, React reserved props (`children`, `dangerouslySetInnerHTML` - **only for DOM components**, `key`, and `ref`) or `className` must be listed before all other props, but still respecting the alphabetical order:
126126

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

133-
If given as an array, the array's values will override the default list of reserved props. **Note**: the values in the array may only be a **subset** of React reserved props.
133+
If given as an array, the array's values will override the default list of reserved props. **Note**: the values in the array may only be a **subset** of React reserved props or `className`.
134134

135135
With `reservedFirst: ["key"]`, the following will **not** warn:
136136

lib/rules/jsx-sort-props.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const RESERVED_PROPS_LIST = [
4343
'dangerouslySetInnerHTML',
4444
'key',
4545
'ref',
46+
'className',
4647
];
4748

4849
function isReservedPropName(name, list) {

0 commit comments

Comments
 (0)