summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorDaniel Lupu <lupu.daniel.f@gmail.com>2017-02-09 20:54:49 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-02-09 18:54:49 +0000
commitd8efd4fa73277908467ba59926428ca22703df27 (patch)
treedb9bcead176e16b82c4ce35c322a3092290e769b /ale_linters
parent6dfed8576e881c71f242c6d8d9a2502f0bb50f99 (diff)
downloadale-d8efd4fa73277908467ba59926428ca22703df27.zip
add xo support (#304)
* add xo support * add documentation * Fix a screw up when fixing conflicts * Fix it harder
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/javascript/xo.vim41
1 files changed, 41 insertions, 0 deletions
diff --git a/ale_linters/javascript/xo.vim b/ale_linters/javascript/xo.vim
new file mode 100644
index 00000000..e27f6f33
--- /dev/null
+++ b/ale_linters/javascript/xo.vim
@@ -0,0 +1,41 @@
+" Author: Daniel Lupu <lupu.daniel.f@gmail.com>
+" Description: xo for JavaScript files
+
+let g:ale_javascript_xo_executable =
+\ get(g:, 'ale_javascript_xo_executable', 'xo')
+
+let g:ale_javascript_xo_options =
+\ get(g:, 'ale_javascript_xo_options', '')
+
+let g:ale_javascript_xo_use_global =
+\ get(g:, 'ale_javascript_xo_use_global', 0)
+
+function! ale_linters#javascript#xo#GetExecutable(buffer) abort
+ if g:ale_javascript_xo_use_global
+ return g:ale_javascript_xo_executable
+ endif
+
+ return ale#util#ResolveLocalPath(
+ \ a:buffer,
+ \ 'node_modules/.bin/xo',
+ \ g:ale_javascript_xo_executable
+ \)
+endfunction
+
+function! ale_linters#javascript#xo#GetCommand(buffer) abort
+ return ale_linters#javascript#xo#GetExecutable(a:buffer)
+ \ . ' ' . g:ale_javascript_xo_options
+ \ . ' --reporter unix --stdin --stdin-filename %s'
+endfunction
+
+function! ale_linters#javascript#xo#Handle(buffer, lines) abort
+ " xo uses eslint and the output format is the same
+ return ale_linters#javascript#eslint#Handle(a:buffer, a:lines)
+endfunction
+
+call ale#linter#Define('javascript', {
+\ 'name': 'xo',
+\ 'executable_callback': 'ale_linters#javascript#xo#GetExecutable',
+\ 'command_callback': 'ale_linters#javascript#xo#GetCommand',
+\ 'callback': 'ale_linters#javascript#xo#Handle',
+\})