-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
no-undef mark JSX elements as not defined #19
Comments
Are you using the I described the issue here eslint/eslint#2040 |
Here is the eslintrc file we are using. We are not using either of those, although we will need modules soon. |
Using the You can force "ecmaFeatures": {
"globalReturn": false
} But this is just a workaround for now. Hope this issue will be resolved soon. |
Yup that workaround works. I'll keep an eye on the issue in eslint use this workaround for now. Should this issue be closed since this an eslint bug? |
I tried the workaround and it didn't work for me. var routes = (function(){
return <Route
name='app'
path='/'
handler={ App }>
<Route
name='bonfires'
path='/bonfires/?:bonfires?'
handler={ Bonfires } />
<DefaultRoute
handler={ Bonfires } />
</Route>
})(); is correctly recognised by the linter. |
@Cellule's fix worked for me as well. Thanks! |
I think the problem occur only on variables used in global scope. |
I'm not sure what's considered "global scope", but the OP's example (where you use |
I also saw the problem elsewhere (not really a normal use case) and it might pinpoint the issue. var Panel = require("react-bootstrap/Panel");
var Application = React.createClass({
statics: {
componentX: (
<Panel> <p> test </p> </Panel>
)
}, I get the errors
However var Panel = require("react-bootstrap/Panel");
var Application = React.createClass({
statics: {
getComponentX: function() {
return (
<Panel> <p> test </p> </Panel>
);
}
},
}); is fine |
Fix submited to ESLint eslint/eslint/pull/2090 |
I just came across this in the current published version (1.5.0 with eslint 0.17.1) - haven't had a chance to test against the PR submitted to ESLint yet but thought I'd leave this here for reference. I get an odd result listing react-tappable With the following config:
I get the following results:
It's kind of ironic that it throws both the |
Will be fixed when eslint/eslint#2121 (for |
👍 great, thanks! |
👍 Woot! |
Looks like both of these have been merge. Will wait to test next release of eslint to close this. |
Fixed in ESLint 0.18.0 |
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 overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'no-undef': 0,
},
},
] |
With
at the top and using [email protected] and [email protected] with
"react/jsx-uses-react": 1, "react/jsx-uses-vars": 1
This works fine.
But this barphs all over the place
The text was updated successfully, but these errors were encountered: