diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bb6c35cf..06a43334a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ### Fixed * [`jsx-max-depth`]: Prevent getting stuck in circular references ([#2957][] @AriPerkkio) * [`jsx-no-target-blank`]: fix handling of `warnOnSpreadAttributes` being false ([#2953][] @Nokel81) +* [`forbid-dom-props`]: support `JSXNamespacedName` [#2961][] @mrtnzlml) ### Changed * Fix CHANGELOG.md ([#2950][] @JounQin) +[#2961]: https://github.com/yannickcr/eslint-plugin-react/pull/2961 [#2953]: https://github.com/yannickcr/eslint-plugin-react/pull/2953 [#2957]: https://github.com/yannickcr/eslint-plugin-react/pull/2957 [#2950]: https://github.com/yannickcr/eslint-plugin-react/pull/2950 diff --git a/lib/rules/forbid-dom-props.js b/lib/rules/forbid-dom-props.js index af4b0c2516..fd125b1bfa 100644 --- a/lib/rules/forbid-dom-props.js +++ b/lib/rules/forbid-dom-props.js @@ -75,8 +75,8 @@ module.exports = { return { JSXAttribute(node) { const tag = node.parent.name.name; - if (!(tag && tag[0] !== tag[0].toUpperCase())) { - // This is a Component, not a DOM node, so exit. + if (!(tag && typeof tag === 'string' && tag[0] !== tag[0].toUpperCase())) { + // This is a Component, not a DOM node, so exit. return; } diff --git a/tests/lib/rules/forbid-dom-props.js b/tests/lib/rules/forbid-dom-props.js index c76d788471..3144fbd698 100644 --- a/tests/lib/rules/forbid-dom-props.js +++ b/tests/lib/rules/forbid-dom-props.js @@ -71,6 +71,13 @@ ruleTester.run('forbid-element-props', rule, { ');' ].join('\n'), options: [{forbid: ['id']}] + }, { + code: [ + 'const First = (props) => (', + ' {props.name}', + ');' + ].join('\n'), + options: [{forbid: ['id']}] }, { code: [ 'const First = (props) => (',