From db4a01e1974f4e604fcb21b40c08938b760f983b Mon Sep 17 00:00:00 2001 From: Christian Hubinger Date: Tue, 14 Mar 2017 11:45:15 +0100 Subject: [PATCH] fix: renamed command builder function, remove disable flag moved Win32 check inside command builder --- README.md | 4 ---- plugin/defaults.vim | 13 +++++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index d65ff12..edf7b7e 100644 --- a/README.md +++ b/README.md @@ -162,10 +162,6 @@ Here is a list of formatprograms that are supported by default, and thus will be It can be installed by running `npm install eslint`. The linter is then installed locally at ```node_modules/.bin/eslint``` When running formatter vim will walk up from the current file to search for such local installation and a ESLint configuration file (either .eslintrc or eslintrc.json). When both are found eslint is executed with the --fix argument. - This linter can be disabled using global setting - ```vim - let g:formatters_javascript_eslint_local = 0 - ``` Currently only working on *nix like OS (Linux, MacOS etc.) requires OS to provide sh like shell syntax * `xo` for __Javascript__. diff --git a/plugin/defaults.vim b/plugin/defaults.vim index df07730..0e6f53a 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -163,15 +163,12 @@ endif " Setup ESLint local. Setup is done on formatter execution if ESLint and " corresponding config is found they are used, otherwiese the formatter fails. " No windows support at the moment. -if !exists('g:formatdef_eslint_local') && !has('win32') - " set disable flag when not defined already - let g:formatters_javascript_eslint_local = exists('g:formatters_javascript_eslint_local') ? g:formatters_javascript_eslint_local : 1 - - function! g:SetupESLintLocalCmd() +if !exists('g:formatdef_eslint_local') + function! g:BuildESLintLocalCmd() let l:path = fnamemodify(expand('%'), ':p') let verbose = &verbose || g:autoformat_verbosemode == 1 - if g:formatters_javascript_eslint_local == 0 - return "(>&2 echo 'ESLint local is disbaled')" + if has('win32') + return "(>&2 echo 'ESLint Local not supported on win32')" endif " find formatter & config file let l:prog = findfile('node_modules/.bin/eslint', l:path.";") @@ -193,7 +190,7 @@ if !exists('g:formatdef_eslint_local') && !has('win32') \ .l:prog." -c ".l:cfg." --fix ".l:eslint_js_tmp_file." 1> /dev/null; exit_code=$? \ cat ".l:eslint_js_tmp_file."; rm -f ".l:eslint_js_tmp_file."; exit $exit_code" endfunction - let g:formatdef_eslint_local = "g:SetupESLintLocalCmd()" + let g:formatdef_eslint_local = "g:BuildESLintLocalCmd()" endif if !exists('g:formatters_javascript')