summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Pertsev <morhetz@gmail.com>2017-08-18 13:37:08 +0300
committerw0rp <devw0rp@gmail.com>2017-08-30 22:21:45 +0100
commit05ce86ea33d882af998d1da3b2dcafb3d8a16465 (patch)
tree73f5458a9e6ef16129fc16c22d124dc1d259268b
parent6e423a94cd428917a5efed6611f46bbc9fe33176 (diff)
downloadale-05ce86ea33d882af998d1da3b2dcafb3d8a16465.zip
Add prettier-eslint legacy option
-rw-r--r--autoload/ale/fixers/prettier_eslint.vim8
-rw-r--r--doc/ale-javascript.txt13
2 files changed, 20 insertions, 1 deletions
diff --git a/autoload/ale/fixers/prettier_eslint.vim b/autoload/ale/fixers/prettier_eslint.vim
index e0d0cf7d..6fe9f0bc 100644
--- a/autoload/ale/fixers/prettier_eslint.vim
+++ b/autoload/ale/fixers/prettier_eslint.vim
@@ -24,6 +24,7 @@ endfunction
call ale#Set('javascript_prettier_eslint_executable', 'prettier-eslint')
call ale#Set('javascript_prettier_eslint_use_global', 0)
call ale#Set('javascript_prettier_eslint_options', '')
+call ale#Set('javascript_prettier_eslint_legacy', 0)
function! ale#fixers#prettier_eslint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_prettier_eslint', [
@@ -37,10 +38,15 @@ function! ale#fixers#prettier_eslint#Fix(buffer, lines) abort
let l:executable = ale#fixers#prettier_eslint#GetExecutable(a:buffer)
let l:config = s:FindConfig(a:buffer)
+ let l:eslint_config_option = ' --eslint-config-path ' . ale#Escape(l:config)
+ if ale#Var(a:buffer, 'javascript_prettier_eslint_legacy')
+ let l:eslint_config_option = ''
+ endif
+
return {
\ 'command': ale#Escape(l:executable)
\ . ' %t'
- \ . ' --eslint-config-path ' . ale#Escape(l:config)
+ \ . l:eslint_config_option
\ . ' ' . l:options
\ . ' --write',
\ 'read_temporary_file': 1,
diff --git a/doc/ale-javascript.txt b/doc/ale-javascript.txt
index 806c7f8c..3dd9d271 100644
--- a/doc/ale-javascript.txt
+++ b/doc/ale-javascript.txt
@@ -96,6 +96,11 @@ g:ale_javascript_prettier_use_local_config *g:ale_javascript_prettier_use_lo
===============================================================================
prettier-eslint *ale-javascript-prettier-eslint*
+ALE supports `prettier-eslint` >= 4.2.0. Using lower version is not recommended
+because it cannot be configured to use the ESLint configuration file for input
+given via stdin. However ALE could be set up on your own risk with older
+versions with |g:ale_javascript_prettier_eslint_legacy|
+
g:ale_javascript_prettier_eslint_executable
*g:ale_javascript_prettier_eslint_executable*
*b:ale_javascript_prettier_eslint_executable*
@@ -122,6 +127,14 @@ g:ale_javascript_prettier_eslint_use_global
See |ale-integrations-local-executables|
+g:ale_javascript_prettier_eslint_legacy
+ *g:ale_javascript_prettier_eslint_legacy*
+ *b:ale_javascript_prettier_eslint_legacy*
+ Type: |Number|
+ Default: `0`
+
+ Fallback option for `prettier-eslint` < 4.2.0
+
===============================================================================
prettier-standard *ale-javascript-prettier-standard*