diff --git a/lib/util/propWrapper.js b/lib/util/propWrapper.js index b41dd0933c..24092c43aa 100644 --- a/lib/util/propWrapper.js +++ b/lib/util/propWrapper.js @@ -8,6 +8,9 @@ function getPropWrapperFunctions(context) { } function isPropWrapperFunction(context, name) { + if (typeof name !== 'string') { + return false; + } const propWrapperFunctions = getPropWrapperFunctions(context); const splitName = name.split('.'); return Array.from(propWrapperFunctions).some(func => { diff --git a/tests/lib/rules/no-unused-prop-types.js b/tests/lib/rules/no-unused-prop-types.js index 17f95dc112..2ee18e4ca3 100644 --- a/tests/lib/rules/no-unused-prop-types.js +++ b/tests/lib/rules/no-unused-prop-types.js @@ -2975,6 +2975,17 @@ ruleTester.run('no-unused-prop-types', rule, { } `, parser: 'babel-eslint' + }, + { + code: ` + export default class Foo extends React.Component { + render() { + return null; + } + } + + Foo.defaultProps = Object.assign({}); + ` } ],