Created
April 15, 2017 10:51
-
-
Save ravicious/ceaf1fd5c60791f527c8edc4a34e45d8 to your computer and use it in GitHub Desktop.
Flow JSON output example where the first message doesn't point to the current file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import ReactDOM from 'react-dom' | |
var Foo = require('./foo.js') | |
// Foo is missing the `bar` prop here. | |
// | |
// When you open this file in vim-ale v1.2.0, it'll highlight the wrong line, | |
// since it takes the loc information of the first message | |
// under errors[0].message[0], which in this case points to `foo.js`, | |
// which is not the file opened in the current buffer. | |
ReactDOM.render( | |
<Foo foo="bar" />, | |
document.getElementById('foo') | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"flowVersion": "0.44.0", | |
"errors": [{ | |
"operation": { | |
"context": " <Foo foo=\"bar\"/>, document.getElementById('foo')", | |
"descr": "React element `Foo`", | |
"type": "Blame", | |
"loc": { | |
"source": "/Users/rav/Projects/vim-ale-flow/index.js", | |
"type": "SourceFile", | |
"start": { | |
"line": 6, | |
"column": 3, | |
"offset": 92 | |
}, | |
"end": { | |
"line": 6, | |
"column": 18, | |
"offset": 108 | |
} | |
}, | |
"path": "/Users/rav/Projects/vim-ale-flow/index.js", | |
"line": 6, | |
"endline": 6, | |
"start": 3, | |
"end": 18 | |
}, | |
"kind": "infer", | |
"level": "error", | |
"message": [{ | |
"context": "module.exports = function(props: Props) {", | |
"descr": "property `bar`", | |
"type": "Blame", | |
"loc": { | |
"source": "/Users/rav/Projects/vim-ale-flow/foo.js", | |
"type": "SourceFile", | |
"start": { | |
"line": 9, | |
"column": 34, | |
"offset": 121 | |
}, | |
"end": { | |
"line": 9, | |
"column": 38, | |
"offset": 126 | |
} | |
}, | |
"path": "/Users/rav/Projects/vim-ale-flow/foo.js", | |
"line": 9, | |
"endline": 9, | |
"start": 34, | |
"end": 38 | |
}, { | |
"context": null, | |
"descr": "Property not found in", | |
"type": "Comment", | |
"path": "", | |
"line": 0, | |
"endline": 0, | |
"start": 1, | |
"end": 0 | |
}, { | |
"context": " <Foo foo=\"bar\"/>, document.getElementById('foo')", | |
"descr": "props of React element `Foo`", | |
"type": "Blame", | |
"loc": { | |
"source": "/Users/rav/Projects/vim-ale-flow/index.js", | |
"type": "SourceFile", | |
"start": { | |
"line": 6, | |
"column": 3, | |
"offset": 92 | |
}, | |
"end": { | |
"line": 6, | |
"column": 18, | |
"offset": 108 | |
} | |
}, | |
"path": "/Users/rav/Projects/vim-ale-flow/index.js", | |
"line": 6, | |
"endline": 6, | |
"start": 3, | |
"end": 18 | |
}] | |
}], | |
"passed": false | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import React from 'react' | |
type Props = {| | |
foo: string, | |
bar: number, | |
|} | |
module.exports = function(props: Props) { | |
return (<div>{props.foo}</div>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment