-
-
Notifications
You must be signed in to change notification settings - Fork 208
Linter reporting flow types as undefined #130
Comments
It's correctly linting flow types now, why are you expecting them to be ignored? |
Sorry, here's a contrived example: export function example(course: Course): boolean {
return !isFantastic(course)
} eslint throws the error: Does that make more sense? |
Very cool, doing some more testing and I see now that babel-eslint will actually inform us when a flow type is undefined, which is what you said above, but I didn't understand, @sebmck. How do I inform babel-eslint of my types that are defined in external files? Also, I get the 'no-undef' error on functions that return ReactElement, does that have to do with eslint-plugin-react? Note, I just upgraded eslint-plugin-react to version 2.5.0, and "ReactElement" is still being called out as not defined. |
@murphyrandle yeah we added support for flow types. I think there's two ways to solve the external files (since ESLint doesn't have a list of flow types). Yeah if you are using react/jsx and are getting errors, our current recommendation is to use the plugin you mentioned. Oh I think you meant the flow type is |
okay, I'll take a look at importing types, thanks @hzoo. Yes, here's an example of the react error: var React = require('react')
module.exports = React.createClass({
displayName: 'Test',
render(): ReactElement {
return (
<div></div>
)
}
})
|
Yeah for that you can just add it to your globals. |
Okay, for now I'm defining them as globals. Thanks, @hzoo. |
Summary: As @zpao suggested (reference #58) here is the new PR with the rules from [facebook/fbjs#49](facebook/fbjs#49). I'll still need some guidance on what should be Relay specific. At the moment with the current fbjs rules there is a lot of errors on [no-undef](http://eslint.org/docs/rules/no-undef.html) (example: $FlowIssue, $FixMe, $Enum and also when defining Flow types, this is related to [babel-eslint/known-issues](https://github.com/babel/babel-eslint#known-issues) - [babel-eslint#130](babel/babel-eslint#130) and [babel-eslint#132](babel/babel-eslint#132)) @josephsavona @zpao what are your thoughts? Closes #202 Reviewed By: @josephsavona Differential Revision: D2417828
Summary: As @zpao suggested (reference #58) here is the new PR with the rules from [facebook/fbjs#49](facebook/fbjs#49). I'll still need some guidance on what should be Relay specific. At the moment with the current fbjs rules there is a lot of errors on [no-undef](http://eslint.org/docs/rules/no-undef.html) (example: $FlowIssue, $FixMe, $Enum and also when defining Flow types, this is related to [babel-eslint/known-issues](https://github.com/babel/babel-eslint#known-issues) - [babel-eslint#130](babel/babel-eslint#130) and [babel-eslint#132](babel/babel-eslint#132)) @josephsavona @zpao what are your thoughts? Closes #202 Reviewed By: @josephsavona Differential Revision: D2417828
since flow 0.22 you need to import ReactElement with
because they change some internals and ReactElement is not a global anymore. |
I just upgraded babel-eslint to 3.1.15 and babel to 5.5.6.
It appears that babel-eslint no longer ignores flow types. I'm getting 'no-undef' and 'camelcase' errors for all of the types throughout my codebase.
I'd post console output, but I can't imagine how it would be helpful to you.
Any ideas on how to move forward? Are any of you seeing this behavior? My co-workers are reporting the same thing on their machines.
The text was updated successfully, but these errors were encountered: