ALE's eslint fixer now uses correct configuration file

This commit is contained in:
ManjaroOne666 2017-09-20 00:06:45 +01:00
parent 9fff447de7
commit 246d699b56
1 changed files with 34 additions and 4 deletions

38
vimrc
View File

@ -105,7 +105,7 @@ set foldcolumn=2
" key mappings " key mappings
let mapleader = "\<space>" let g:mapleader = "\<space>"
" jk acts as escape in insert,visual/select modes " jk acts as escape in insert,visual/select modes
inoremap jk <esc> inoremap jk <esc>
@ -132,6 +132,10 @@ nnoremap <Esc>k :resize -1<CR>
nnoremap <Esc>l :vertical resize +1<CR> nnoremap <Esc>l :vertical resize +1<CR>
nnoremap <Esc>h :vertical resize -1<CR> nnoremap <Esc>h :vertical resize -1<CR>
nnoremap <leader>ep :lprev<CR>
nnoremap <leader>en :lnext<CR>
" brace/quotes completion " brace/quotes completion
inoremap {{ {<CR><Tab><CR>}<Up><Right> inoremap {{ {<CR><Tab><CR>}<Up><Right>
inoremap (( ()<Left> inoremap (( ()<Left>
@ -187,8 +191,11 @@ syntax on
" tabs " tabs
"set tabstop=2 " leave at default "set tabstop=2 " leave at default
set expandtab " tab inserts 'softtabstop' number of spaces set expandtab " tab inserts 'softtabstop' number of spaces
set softtabstop=2 " " set following with autocommands to override filetype plugin indent
set shiftwidth=2 " affects what happens with >>,<<,== and automatic indentation au Filetype * let &l:softtabstop=2 "
au Filetype * let &l:shiftwidth=2 " affects what happens with >>,<<,== and automatic indentation
set shiftround " round indent to multiples of shiftwidth
set autoindent " copy indent from current line over to new line
set mouse=a set mouse=a
filetype plugin indent on " file type based indentation filetype plugin indent on " file type based indentation
@ -282,8 +289,31 @@ let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--' let g:ale_sign_warning = '--'
let g:ale_sign_column_always = 1 let g:ale_sign_column_always = 1
let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['jshint'], 'php':['php'], 'html':['htmlhint']} "let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['jshint'], 'php':['php'], 'html':['htmlhint']}
let g:ale_linters = {'scss': ['stylelint'], 'javascript': ['eslint'], 'php':['php'], 'html':['htmlhint']}
let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix'
let g:ale_javascript_eslint_options = '-c ~/.config/eslint/.eslintrc.js'
let g:ale_fixers = {'javascript': ['eslint']}
"let g:ale_javascript_prettier_options = '--single-quote '
" override ALE's eslint fix function tose correct config file
function! ale#fixers#eslint#Fix(buffer) abort
let l:executable = ale#handlers#eslint#GetExecutable(a:buffer)
let l:config = ale#handlers#eslint#FindConfig(a:buffer)
if empty(l:config)
let l:config = ''
endif
return {
\ 'command': ale#node#Executable(a:buffer, l:executable)
\ . ' --config /home/ray/.config/eslint/.eslintrc.js'
\ . ' --fix %t',
\ 'read_temporary_file': 1,
\}
endfunction
function! LinterStatus() abort function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr('')) let l:counts = ale#statusline#Count(bufnr(''))