Skip to content

Commit

Permalink
chore: add condition for specifying className prop check
Browse files Browse the repository at this point in the history
  • Loading branch information
akulsr0 committed Jun 6, 2024
1 parent 9ac517f commit 816a0d5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/util/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,14 @@ module.exports = function propTypesInstructions(context, components, utils) {
// So we should construct an optional children prop
this.shouldSpecifyOptionalChildrenProps = true;

this.shouldSpecifyClassNameProp = true;

const rightMostName = getRightMostTypeName(node.typeName);
if (
leftMostName === 'React'
&& ['HTMLAttributes', 'HTMLElement', 'HTMLProps'].some((type) => rightMostName.includes(type))
) {
this.shouldSpecifyClassNameProp = true;
}

const importedName = localToImportedMap[rightMostName];
const idx = genericTypeParamIndexWherePropsArePresent[
leftMostName !== rightMostName ? rightMostName : importedName
Expand Down

0 comments on commit 816a0d5

Please sign in to comment.