e149692cc9
subrepo: subdir: "dotfiles/.vim/plugged/ale" merged: "e4b205440" upstream: origin: "https://github.com/dense-analysis/ale.git" branch: "master" commit: "e4b205440" git-subrepo: version: "0.4.3" origin: "???" commit: "???"
32 lines
1.3 KiB
VimL
32 lines
1.3 KiB
VimL
" Author: Ahmed El Gabri <@ahmedelgabri>
|
|
" Description: standardjs for JavaScript files
|
|
|
|
call ale#Set('javascript_standard_executable', 'standard')
|
|
call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
call ale#Set('javascript_standard_options', '')
|
|
|
|
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
|
return ale#path#FindExecutable(a:buffer, 'javascript_standard', [
|
|
\ 'node_modules/standardx/bin/cmd.js',
|
|
\ 'node_modules/standard/bin/cmd.js',
|
|
\ 'node_modules/semistandard/bin/cmd.js',
|
|
\ 'node_modules/.bin/standard',
|
|
\])
|
|
endfunction
|
|
|
|
function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
|
let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer)
|
|
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
|
|
|
return ale#node#Executable(a:buffer, l:executable)
|
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
\ . ' --stdin %s'
|
|
endfunction
|
|
|
|
" standard uses eslint and the output format is the same
|
|
call ale#linter#Define('javascript', {
|
|
\ 'name': 'standard',
|
|
\ 'executable': function('ale_linters#javascript#standard#GetExecutable'),
|
|
\ 'command': function('ale_linters#javascript#standard#GetCommand'),
|
|
\ 'callback': 'ale#handlers#eslint#Handle',
|
|
\})
|