summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Irwin <conrad.irwin@gmail.com>2019-12-03 16:42:10 -0800
committerConrad Irwin <conrad.irwin@gmail.com>2019-12-04 23:15:41 -0800
commitefe120ce9a9100129f1a811a659b0d7526cbf266 (patch)
tree1cee8930d0cd5ce8276150b2d1337abd697eef07
parentb91d82bfaa395bb86b3ea51f63cc8cef05e90f98 (diff)
downloadale-efe120ce9a9100129f1a811a659b0d7526cbf266.zip
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.
-rw-r--r--autoload/ale/fixers/prettier_standard.vim4
-rw-r--r--test/fixers/test_prettier_standard_callback.vader19
2 files changed, 21 insertions, 2 deletions
diff --git a/autoload/ale/fixers/prettier_standard.vim b/autoload/ale/fixers/prettier_standard.vim
index b6e0a6f9..9d982ff6 100644
--- a/autoload/ale/fixers/prettier_standard.vim
+++ b/autoload/ale/fixers/prettier_standard.vim
@@ -17,8 +17,8 @@ function! ale#fixers#prettier_standard#Fix(buffer) abort
return {
\ 'command': ale#Escape(ale#fixers#prettier_standard#GetExecutable(a:buffer))
- \ . ' %t'
+ \ . ' --stdin'
+ \ . ' --stdin-filepath=%s'
\ . ' ' . l:options,
- \ 'read_temporary_file': 1,
\}
endfunction
diff --git a/test/fixers/test_prettier_standard_callback.vader b/test/fixers/test_prettier_standard_callback.vader
new file mode 100644
index 00000000..ab33fe20
--- /dev/null
+++ b/test/fixers/test_prettier_standard_callback.vader
@@ -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 ',
+ \ }