From 3a9e28959b286061edeec812b5f39c6216b08002 Mon Sep 17 00:00:00 2001 From: luis Date: Tue, 5 Dec 2017 18:53:51 -0200 Subject: [PATCH 1/2] Added current file extension to eslint tmp file --- plugin/defaults.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugin/defaults.vim b/plugin/defaults.vim index b13f2af..3f6c2dd 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -179,6 +179,7 @@ endif if !exists('g:formatdef_eslint_local') function! g:BuildESLintLocalCmd() let l:path = fnamemodify(expand('%'), ':p') + let l:ext = ".".expand('%:p:e') let verbose = &verbose || g:autoformat_verbosemode == 1 if has('win32') return "(>&2 echo 'ESLint not supported on win32')" @@ -225,11 +226,11 @@ if !exists('g:formatdef_eslint_local') " This formatter uses a temporary file as ESLint has not option to print " the formatted source to stdout without modifieing the file. - let l:eslint_js_tmp_file = fnameescape(tempname().".js") + let l:eslint_tmp_file = fnameescape(tempname().l:ext) let content = getline('1', '$') - call writefile(content, l:eslint_js_tmp_file) - return 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" + call writefile(content, l:eslint_tmp_file) + return l:prog." -c ".l:cfg." --fix ".l:eslint_tmp_file." 1> /dev/null; exit_code=$? + \ cat ".l:eslint_tmp_file."; rm -f ".l:eslint_tmp_file."; exit $exit_code" endfunction let g:formatdef_eslint_local = "g:BuildESLintLocalCmd()" endif From 36f2a83ec671ecf9372391ff17446a33db29d63b Mon Sep 17 00:00:00 2001 From: luis Date: Tue, 5 Dec 2017 19:02:34 -0200 Subject: [PATCH 2/2] corrected the indent on last change --- plugin/defaults.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/defaults.vim b/plugin/defaults.vim index 3f6c2dd..cbc6af9 100644 --- a/plugin/defaults.vim +++ b/plugin/defaults.vim @@ -179,7 +179,7 @@ endif if !exists('g:formatdef_eslint_local') function! g:BuildESLintLocalCmd() let l:path = fnamemodify(expand('%'), ':p') - let l:ext = ".".expand('%:p:e') + let l:ext = ".".expand('%:p:e') let verbose = &verbose || g:autoformat_verbosemode == 1 if has('win32') return "(>&2 echo 'ESLint not supported on win32')"