summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-29 10:08:54 +0000
committerw0rp <devw0rp@gmail.com>2017-11-29 10:08:54 +0000
commit6503b85d3d0f01d8fa74f8024fda8d6fe0d62274 (patch)
tree0b628b95b6ae626cec6d9380a77e89135dad6b35 /autoload
parenta43ada93e40b8286dde3cd62f10369876787ddc1 (diff)
downloadale-6503b85d3d0f01d8fa74f8024fda8d6fe0d62274.zip
Fix #1178 - Don't use the output from eslint_d for fixing files when the output is an error message
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fixers/eslint.vim12
1 files changed, 12 insertions, 0 deletions
diff --git a/autoload/ale/fixers/eslint.vim b/autoload/ale/fixers/eslint.vim
index 76615fb5..36f47510 100644
--- a/autoload/ale/fixers/eslint.vim
+++ b/autoload/ale/fixers/eslint.vim
@@ -22,6 +22,17 @@ function! ale#fixers#eslint#ProcessFixDryRunOutput(buffer, output) abort
return []
endfunction
+function! ale#fixers#eslint#ProcessEslintDOutput(buffer, output) abort
+ " If the output is an error message, don't use it.
+ for l:line in a:output[:10]
+ if l:line =~# '^Error:'
+ return []
+ endif
+ endfor
+
+ return a:output
+endfunction
+
function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort
let l:executable = ale#handlers#eslint#GetExecutable(a:buffer)
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
@@ -37,6 +48,7 @@ function! ale#fixers#eslint#ApplyFixForVersion(buffer, version_output) abort
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . ' --stdin-filename %s --stdin --fix-to-stdout',
+ \ 'process_with': 'ale#fixers#eslint#ProcessEslintDOutput',
\}
endif