diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-09 23:42:54 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-09 23:42:54 +0000 |
commit | d425b8a18ab3c8155fdc7376192434f8878e954f (patch) | |
tree | 8a702b7b398fe43e9b8b3a05e3011b3ca530fd83 /ale_linters/javascript/flow.vim | |
parent | c1fa88e78ccfeb98a688a209cd9f67da1bf076aa (diff) | |
download | ale-d425b8a18ab3c8155fdc7376192434f8878e954f.zip |
Simplfy semver handling and share the semver version cache across everything
Diffstat (limited to 'ale_linters/javascript/flow.vim')
-rw-r--r-- | ale_linters/javascript/flow.vim | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ale_linters/javascript/flow.vim b/ale_linters/javascript/flow.vim index 0dd64535..6d51628b 100644 --- a/ale_linters/javascript/flow.vim +++ b/ale_linters/javascript/flow.vim @@ -23,18 +23,15 @@ function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort return '' endif - let l:use_respect_pragma = 1 + let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer) + let l:version = ale#semver#GetVersion(l:executable, a:version_lines) " If we can parse the version number, then only use --respect-pragma " if the version is >= 0.36.0, which added the argument. - for l:match in ale#util#GetMatches(a:version_lines, '\v\d+\.\d+\.\d+$') - let l:use_respect_pragma = ale#semver#GreaterOrEqual( - \ ale#semver#Parse(l:match[0]), - \ [0, 36, 0] - \) - endfor + let l:use_respect_pragma = empty(l:version) + \ || ale#semver#GTE(l:version, [0, 36]) - return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer)) + return ale#Escape(l:executable) \ . ' check-contents' \ . (l:use_respect_pragma ? ' --respect-pragma': '') \ . ' --json --from ale %s' |