diff --git a/CHANGELOG.md b/CHANGELOG.md index 99148c8af5..1f2a4bec16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel ### Fixed * [`jsx-handler-names`]: properly substitute value into message ([#2975][] @G-Rath) * [`jsx-uses-vars`]: ignore namespaces ([#2985][] @remcohaszing) +* [`jsx-no-undef`]: ignore namespaces ([#2986][] @remcohaszing) ### Changed * [Docs] [`jsx-newline`]: Fix minor spelling error on rule name ([#2974][] @DennisSkoko) @@ -19,6 +20,7 @@ This change log adheres to standards from [Keep a CHANGELOG](http://keepachangel * [readme] fix missing trailing commas ([#2980][] @sugardon) * [readme] fix broken anchor link ([#2982][] @vzvu3k6k) +[#2986]: https://github.com/yannickcr/eslint-plugin-react/pull/2986 [#2985]: https://github.com/yannickcr/eslint-plugin-react/pull/2985 [#2982]: https://github.com/yannickcr/eslint-plugin-react/pull/2982 [#2980]: https://github.com/yannickcr/eslint-plugin-react/pull/2980 diff --git a/lib/rules/jsx-no-undef.js b/lib/rules/jsx-no-undef.js index f4e94c4059..939027ddac 100644 --- a/lib/rules/jsx-no-undef.js +++ b/lib/rules/jsx-no-undef.js @@ -102,8 +102,7 @@ module.exports = { } while (node && node.type !== 'JSXIdentifier'); break; case 'JSXNamespacedName': - node = node.name.namespace; - break; + return; default: break; } diff --git a/tests/lib/rules/jsx-no-undef.js b/tests/lib/rules/jsx-no-undef.js index e2bcb30abb..40f498befd 100644 --- a/tests/lib/rules/jsx-no-undef.js +++ b/tests/lib/rules/jsx-no-undef.js @@ -45,6 +45,8 @@ ruleTester.run('jsx-no-undef', rule, { code: '/*eslint no-undef:1*/ var React, app; React.render();' }, { code: '/*eslint no-undef:1*/ var React, app; React.render();' + }, { + code: '/*eslint no-undef:1*/ var React; React.render();' }, { code: ` /*eslint no-undef:1*/ @@ -87,12 +89,6 @@ ruleTester.run('jsx-no-undef', rule, { messageId: 'undefined', data: {identifier: 'Appp'} }] - }, { - code: '/*eslint no-undef:1*/ var React; React.render();', - errors: [{ - messageId: 'undefined', - data: {identifier: 'Apppp'} - }] }, { code: '/*eslint no-undef:1*/ var React; React.render();', errors: [{