Fix prettier_standard to respect the configuration file
Before this change, prettier_standard would run and ignore any .prettierrc, now it will respect the configuration of the file being linted. This change relies on prettier-standard 16.1.0 for the --stdin-filepath flag, but is backward compatible: older versions of prettier-standard will ignore the unknown flag and continue to run with no configuration file.
This commit is contained in:
parent
b91d82bfaa
commit
efe120ce9a
2 changed files with 21 additions and 2 deletions
|
@ -17,8 +17,8 @@ function! ale#fixers#prettier_standard#Fix(buffer) abort
|
||||||
|
|
||||||
return {
|
return {
|
||||||
\ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer))
|
\ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer))
|
||||||
\ . ' %t'
|
\ . ' --stdin'
|
||||||
|
\ . ' --stdin-filepath=%s'
|
||||||
\ . ' ' . l:options,
|
\ . ' ' . l:options,
|
||||||
\ 'read_temporary_file': 1,
|
|
||||||
\}
|
\}
|
||||||
endfunction
|
endfunction
|
||||||
|
|
19
test/fixers/test_prettier_standard_callback.vader
Normal file
19
test/fixers/test_prettier_standard_callback.vader
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpFixerTest('javascript', 'prettier_standard')
|
||||||
|
|
||||||
|
silent cd ..
|
||||||
|
silent cd command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
|
Execute(The prettier callback should return the correct default values):
|
||||||
|
call ale#test#SetFilename('../prettier-test-files/testfile.js')
|
||||||
|
|
||||||
|
AssertFixer
|
||||||
|
\ {
|
||||||
|
\ 'command': ale#Escape(g:ale_javascript_prettier_standard_executable)
|
||||||
|
\ . ' --stdin'
|
||||||
|
\ . ' --stdin-filepath=%s ',
|
||||||
|
\ }
|
Reference in a new issue