Skip to content

Commit 816a0d5

Browse files
committed
chore: add condition for specifying className prop check
1 parent 9ac517f commit 816a0d5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/util/propTypes.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,14 @@ module.exports = function propTypesInstructions(context, components, utils) {
644644
// So we should construct an optional children prop
645645
this.shouldSpecifyOptionalChildrenProps = true;
646646

647-
this.shouldSpecifyClassNameProp = true;
648-
649647
const rightMostName = getRightMostTypeName(node.typeName);
648+
if (
649+
leftMostName === 'React'
650+
&& ['HTMLAttributes', 'HTMLElement', 'HTMLProps'].some((type) => rightMostName.includes(type))
651+
) {
652+
this.shouldSpecifyClassNameProp = true;
653+
}
654+
650655
const importedName = localToImportedMap[rightMostName];
651656
const idx = genericTypeParamIndexWherePropsArePresent[
652657
leftMostName !== rightMostName ? rightMostName : importedName

0 commit comments

Comments
 (0)