no-undef mark JSX elements as not defined
See original GitHub issueWith
var React =require('react'),
Router = require('react-router'),
Route = Router.Route,
DefaultRoute = Router.DefaultRoute;
at the top and using eslint@0.17.0 and eslint-plugin-react@1.5.0 with
"react/jsx-uses-react": 1, "react/jsx-uses-vars": 1
This works fine.
var routes = React.createClass({
render: function() {
return (
<Route
name='app'
path='/'
handler={ App }>
<Route
name='bonfires'
path='/bonfires/?:bonfires?'
handler={ Bonfires } />
<DefaultRoute
handler={ Bonfires } />
</Route>
);
}
});
But this barphs all over the place
var routes = (
<Route
name='app'
path='/'
handler={ App }>
<Route
name='bonfires'
path='/bonfires/?:bonfires?'
handler={ Bonfires } />
<DefaultRoute
handler={ Bonfires } />
</Route>
);
Issue Analytics
- State:
- Created 9 years ago
- Comments:18 (8 by maintainers)
Top Results From Across the Web
no-undef mark JSX elements as not defined · Issue #19 - GitHub
With var React =require('react'), Router = require('react-router'), Route = Router.Route, DefaultRoute = Router.DefaultRoute; at the top and ...
Read more >React & Typescript: 'JSX' is not defined no-undef
I am migrating from JS to TS and I get an error when I define the JSX.Element type in my ...
Read more >'X' is not defined react/jsx-no-undef Error in React | bobbyhadz
The React.js error "X is not defined react/jsx-no-undef" occurs when we forget to import a function, class or a variable in our code...
Read more >'React' is not defined no-undef - YouTube
Blog Reference : https://progvocab.blogspot.com/2020/01/ react -is- not - defined - no-undef.html.
Read more >eslint-plugin-react - npm
Start using eslint-plugin-react in your project by running `npm i ... If this isn't set, components wrapped by these functions will be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
adding these rules fixed it for me:
Official answer is here https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/FAQ.md#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors and it says indeed to add them to globals or to disable the no-undef rule because typescript has already its own checks