diff --git a/lib/rules/prop-types.js b/lib/rules/prop-types.js index 6eec874a89..2cc1416115 100644 --- a/lib/rules/prop-types.js +++ b/lib/rules/prop-types.js @@ -150,7 +150,7 @@ module.exports = { return; } param.properties.forEach((property) => { - if (property.type === 'RestElement') { + if (property.type === 'RestElement' || property.type === 'ExperimentalRestProperty') { return; } const type = property.value.type; diff --git a/tests/lib/rules/prop-types.js b/tests/lib/rules/prop-types.js index 0ef8a072f0..ea5c6cbd3a 100644 --- a/tests/lib/rules/prop-types.js +++ b/tests/lib/rules/prop-types.js @@ -3096,7 +3096,7 @@ ruleTester.run('prop-types', rule, { ) } - const mapDispatchToProps = (dispatch: ThunkDispatch) => + const mapDispatchToProps = (dispatch: ThunkDispatch) => bindActionCreators<{prop1: ()=>void,prop2: ()=>string}>( { prop1: importedAction, prop2: anotherImportedAction }, dispatch, @@ -6163,6 +6163,28 @@ ruleTester.run('prop-types', rule, { errors: [{ message: "'bar' is missing in props validation" }] + }, + // fix #2804 + { + code: ` + import React from 'react' + + const InputField = ({ type, ...restProps }) => { + + return( + + ) + } + + export default InputField; + `, + parser: parsers.BABEL_ESLINT, + errors: [{ + message: "'type' is missing in props validation" + }] } ]) )