Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] jsx-no-undef: ignore namespaces #2986

Merged
merged 1 commit into from May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -12,13 +12,15 @@ 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)
* [Refactor] [`void-dom-elements-no-children`]: improve performance
* [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
Expand Down
3 changes: 1 addition & 2 deletions lib/rules/jsx-no-undef.js
Expand Up @@ -102,8 +102,7 @@ module.exports = {
} while (node && node.type !== 'JSXIdentifier');
break;
case 'JSXNamespacedName':
node = node.name.namespace;
break;
return;
default:
break;
}
Expand Down
8 changes: 2 additions & 6 deletions tests/lib/rules/jsx-no-undef.js
Expand Up @@ -45,6 +45,8 @@ ruleTester.run('jsx-no-undef', rule, {
code: '/*eslint no-undef:1*/ var React, app; React.render(<app.Foo />);'
}, {
code: '/*eslint no-undef:1*/ var React, app; React.render(<app.foo.Bar />);'
}, {
code: '/*eslint no-undef:1*/ var React; React.render(<Apppp:Foo />);'
}, {
code: `
/*eslint no-undef:1*/
Expand Down Expand Up @@ -87,12 +89,6 @@ ruleTester.run('jsx-no-undef', rule, {
messageId: 'undefined',
data: {identifier: 'Appp'}
}]
}, {
code: '/*eslint no-undef:1*/ var React; React.render(<Apppp:Foo />);',
errors: [{
messageId: 'undefined',
data: {identifier: 'Apppp'}
}]
}, {
code: '/*eslint no-undef:1*/ var React; React.render(<appp.Foo />);',
errors: [{
Expand Down