mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Removed syntastic and replaced it with ale
Read more here: https://github.com/w0rp/ale
This commit is contained in:
23
sources_non_forked/ale/ale_linters/coffee/coffee.vim
Normal file
23
sources_non_forked/ale/ale_linters/coffee/coffee.vim
Normal file
@ -0,0 +1,23 @@
|
||||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
" Description: Coffee for checking coffee files
|
||||
|
||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffee',
|
||||
\ 'coffee'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffee#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffee#GetExecutable(a:buffer)
|
||||
\ . ' -cp -s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffee',
|
||||
\ 'executable_callback': 'ale_linters#coffee#coffee#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
43
sources_non_forked/ale/ale_linters/coffee/coffeelint.vim
Normal file
43
sources_non_forked/ale/ale_linters/coffee/coffeelint.vim
Normal file
@ -0,0 +1,43 @@
|
||||
" Author: Prashanth Chandra https://github.com/prashcr
|
||||
" Description: coffeelint linter for coffeescript files
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffeelint',
|
||||
\ 'coffeelint'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin --reporter csv'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" path,lineNumber,lineNumberEnd,level,message
|
||||
" stdin,14,,error,Throwing strings is forbidden
|
||||
"
|
||||
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffeelint',
|
||||
\ 'executable_callback': 'ale_linters#coffee#coffeelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#coffee#coffeelint#GetCommand',
|
||||
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
|
||||
\})
|
Reference in New Issue
Block a user