All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 runtime ale_linters/javascript/flow.vim
8 call ale#linter#Reset()
10 Execute(The flow handler should throw away non-JSON lines):
13 \ ale_linters#javascript#flow#Handle(bufnr(''), [
14 \ 'Already up-to-date.',
15 \ '{"flowVersion":"0.50.0","errors":[],"passed":true}',
19 \ ale_linters#javascript#flow#Handle(bufnr(''), [
23 \ '{"flowVersion":"0.50.0","errors":[],"passed":true}',
26 Execute(The flow handler should process errors correctly.):
27 silent! noautocmd file /home/w0rp/Downloads/graphql-js/src/language/parser.js
30 \ "flowVersion": "0.39.0",
37 \ "context": " return 1",
41 \ "source": expand('%:p'),
42 \ "type": "SourceFile",
54 \ "path": expand('%:p'),
62 \ "descr": "This type is incompatible with the expected return type of",
71 \ "context": "function parseArguments(lexer: Lexer<*>): Array<ArgumentNode> {",
72 \ "descr": "array type",
75 \ "source": expand('%:p'),
76 \ "type": "SourceFile",
88 \ "path": expand('%:p'),
101 \ "context": " return peek(lexer, TokenKind.PAREN_L) ?",
102 \ "descr": "unreachable code",
105 \ "source": expand('%:p'),
106 \ "type": "SourceFile",
118 \ "path": expand('%:p'),
130 let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)])
136 \ 'text': 'number: This type is incompatible with the expected return type of array type',
142 \ 'text': 'unreachable code:',
146 AssertEqual g:expected, g:actual
148 Execute(The flow handler should fetch the correct location for the currently opened file, even when it's not in the first message.):
149 silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js
151 let g:flow_output = {
152 \ "flowVersion": "0.44.0",
155 \ "context": " <Foo foo=\"bar\"/>, document.getElementById('foo')",
156 \ "descr": "React element `Foo`",
159 \ "source": expand('%:p'),
160 \ "type": "SourceFile",
172 \ "path": expand('%:p'),
181 \ "context": "module.exports = function(props: Props) {",
182 \ "descr": "property `bar`",
185 \ "source": "/Users/rav/Projects/vim-ale-flow/foo.js",
186 \ "type": "SourceFile",
198 \ "path": "/Users/rav/Projects/vim-ale-flow/foo.js",
205 \ "descr": "Property not found in",
213 \ "context": " <Foo foo=\"bar\"/>, document.getElementById('foo')",
214 \ "descr": "props of React element `Foo`",
217 \ "source": expand('%:p'),
218 \ "type": "SourceFile",
230 \ "path": expand('%:p'),
240 let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)])
246 \ 'text': 'property `bar`: Property not found in props of React element `Foo` See also: React element `Foo`',
250 AssertEqual g:expected, g:actual
252 Execute(The flow handler should handle relative paths):
253 silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js
255 let g:flow_output = {
256 \ "flowVersion": "0.44.0",
259 \ "context": " <Foo foo=\"bar\"/>, document.getElementById('foo')",
260 \ "descr": "React element `Foo`",
263 \ "source": expand('%:p'),
264 \ "type": "SourceFile",
276 \ "path": expand('%:p'),
285 \ "context": "module.exports = function(props: Props) {",
286 \ "descr": "property `bar`",
289 \ "source": "vim-ale-flow/foo.js",
290 \ "type": "SourceFile",
302 \ "path": "vim-ale-flow/foo.js",
309 \ "descr": "Property not found in",
317 \ "context": " <Foo foo=\"bar\"/>, document.getElementById('foo')",
318 \ "descr": "props of React element `Foo`",
321 \ "source": expand('%:p'),
322 \ "type": "SourceFile",
334 \ "path": expand('%:p'),
344 let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)])
350 \ 'text': 'property `bar`: Property not found in props of React element `Foo` See also: React element `Foo`',
354 AssertEqual g:expected, g:actual
356 Execute(The flow handler should handle extra errors):
357 silent! noautocmd file /Users/rav/Projects/vim-ale-flow/index.js
359 let g:flow_output = {
360 \ "flowVersion": "0.54.0",
365 \ "descr": "Property \`setVector\` is incompatible:",
375 \ "context": "setVector = \{2\}",
376 \ "descr": "number ",
379 \ "source": expand('%:p'),
380 \ "type": "SourceFile ",
392 \ "path": expand('%:p'),
399 \ "descr": "This type is incompatible with ",
400 \ "type": "Comment ",
407 \ "context": "setVector: VectorType => void,",
408 \ "descr": "function type ",
411 \ "source": expand('%:p'),
412 \ "type": "SourceFile",
424 \ "path": expand('%:p'),
434 \ "suppressions": [],
436 \ "context": " < New ",
437 \ "descr": "props of React element `New`",
440 \ "source": "vim-ale-flow/foo.js",
441 \ "type": "SourceFile",
460 \ "descr": "This type is incompatible with",
468 \ "context": "class New extends React.Component < NewProps,NewState > {",
469 \ "descr": "object type",
472 \ "source": expand('%:p'),
473 \ "type": "SourceFile",
485 \ "path": expand('%:p'),
495 let g:actual = ale_linters#javascript#flow#Handle(bufnr(''), [json_encode(g:flow_output)])
501 \ 'text': 'props of React element `New`: This type is incompatible with object type',
502 \ 'detail': 'props of React element `New`: This type is incompatible with object type'
503 \ . "\nProperty `setVector` is incompatible: number This type is incompatible with function type ",
507 AssertEqual g:expected, g:actual