From 05ce86ea33d882af998d1da3b2dcafb3d8a16465 Mon Sep 17 00:00:00 2001 From: Pavel Pertsev Date: Fri, 18 Aug 2017 13:37:08 +0300 Subject: [PATCH] Add prettier-eslint legacy option --- autoload/ale/fixers/prettier_eslint.vim | 8 +++++++- doc/ale-javascript.txt | 13 +++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/autoload/ale/fixers/prettier_eslint.vim b/autoload/ale/fixers/prettier_eslint.vim index e0d0cf7..6fe9f0b 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 806c7f8..3dd9d27 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*