diff --git a/lib/rules/no-unused-prop-types.js b/lib/rules/no-unused-prop-types.js index fe3f113d98..0feafdd82d 100644 --- a/lib/rules/no-unused-prop-types.js +++ b/lib/rules/no-unused-prop-types.js @@ -70,6 +70,7 @@ module.exports = { const usedProp = usedPropTypes[i]; if ( prop.type === 'shape' + || prop.type === 'exact' || prop.name === '__ANY_KEY__' || usedProp.name === prop.name ) { @@ -98,7 +99,7 @@ module.exports = { return; } - if (prop.type === 'shape' && configuration.skipShapeProps) { + if ((prop.type === 'shape' || prop.type === 'exact') && configuration.skipShapeProps) { return; } diff --git a/tests/lib/rules/no-unused-prop-types.js b/tests/lib/rules/no-unused-prop-types.js index 998d026f06..d128165d43 100644 --- a/tests/lib/rules/no-unused-prop-types.js +++ b/tests/lib/rules/no-unused-prop-types.js @@ -3213,6 +3213,25 @@ ruleTester.run('no-unused-prop-types', rule, { Foo.defaultProps = Object.assign({}); ` }, + { + code: ` + const Hello = ({a}) => ( +
+ {a.map(({b}) => ( +
{b}
+ ))} +
+ ); + Hello.propTypes = { + a: PropTypes.arrayOf( + PropTypes.exact({ + b: PropTypes.string, + }) + ), + }; + `, + parser: parsers.BABEL_ESLINT + }, parsers.TS([ { code: `