[New] jsx-sort-props
: add className
to RESERVED_PROPS_LIST
#3851
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings a new
className
prop toRESERVED_PROPS_LIST
atjsx-sort-props
rule. Related to this issue: #3175Context
In many organizations, including ours, there is a coding standard that requires the
className
prop to be listed before all other props. This practice enhances code readability and consistency, making it easier for developers to quickly identify the styling-related aspects of a component.Justification
While the current
RESERVED_PROPS_LIST
is designed to include only React's reserved props (children, dangerouslySetInnerHTML, key, ref), the addition ofclassName
aligns with a common industry practice that prioritizes styling props for better visibility. This change would provide flexibility for teams that adhere to this convention without impacting those who do not.@ljharb, I completely understand the importance of maintaining the integrity of the reserved props list. However, given the widespread adoption of this convention, I believe that including
className
could benefit many teams. I hope you will consider this addition to support a broader range of coding standards.Thank you for considering this request. 🙏