Add prettier-eslint legacy option

This commit is contained in:
Pavel Pertsev 2017-08-18 13:37:08 +03:00 committed by w0rp
parent 6e423a94cd
commit 05ce86ea33
2 changed files with 20 additions and 1 deletions

View File

@ -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,

View File

@ -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*