diff options
author | Horacio Sanson <horacio@allm.net> | 2020-03-12 16:00:30 +0900 |
---|---|---|
committer | Horacio Sanson <horacio@allm.net> | 2020-03-12 16:29:46 +0900 |
commit | c207d6a550916f4d34a41711c64024251466fea5 (patch) | |
tree | a5a118647f8a1e073db6d0b85e12659f252926b0 | |
parent | bbe5153fcb36dec9860ced33ae8ff0b5d76ac02a (diff) | |
download | ale-c207d6a550916f4d34a41711c64024251466fea5.zip |
Fix 2816 - Standard fix does not work.
The standard linter --fix fails if the file being input is not relative
to the project root (https://github.com/standard/standard/issues/1384).
This MR attempts to fix this by changing the command so the input file
is relative to the project root and the output is to a temporary file.
Preliminary tests with toy javascript projects seem to indicate this
works fine.
-rw-r--r-- | autoload/ale/fixers/standard.vim | 2 | ||||
-rw-r--r-- | test/fixers/test_standard_fixer_callback.vader | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/autoload/ale/fixers/standard.vim b/autoload/ale/fixers/standard.vim index cffa9f9d..46decebf 100644 --- a/autoload/ale/fixers/standard.vim +++ b/autoload/ale/fixers/standard.vim @@ -27,7 +27,7 @@ function! ale#fixers#standard#Fix(buffer) abort return { \ 'command': ale#node#Executable(a:buffer, l:executable) \ . (!empty(l:options) ? ' ' . l:options : '') - \ . ' --fix %t', + \ . ' --fix --stdin < %s > %t', \ 'read_temporary_file': 1, \} endfunction diff --git a/test/fixers/test_standard_fixer_callback.vader b/test/fixers/test_standard_fixer_callback.vader index db9f20f6..f5e9c487 100644 --- a/test/fixers/test_standard_fixer_callback.vader +++ b/test/fixers/test_standard_fixer_callback.vader @@ -15,7 +15,7 @@ Execute(The executable path should be correct): \ 'read_temporary_file': 1, \ 'command': (has('win32') ? 'node.exe ' : '') \ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/standard/bin/cmd.js')) - \ . ' --fix %t', + \ . ' --fix --stdin < %s > %t', \ }, \ ale#fixers#standard#Fix(bufnr('')) @@ -26,6 +26,6 @@ Execute(Custom options should be supported): AssertEqual \ { \ 'read_temporary_file': 1, - \ 'command': ale#Escape('standard') . ' --foo-bar --fix %t', + \ 'command': ale#Escape('standard') . ' --foo-bar --fix --stdin < %s > %t', \ }, \ ale#fixers#standard#Fix(bufnr('')) |