summaryrefslogtreecommitdiff
path: root/ale_linters/javascript/eslint.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-04 13:50:44 +0100
committerw0rp <devw0rp@gmail.com>2016-10-04 13:50:44 +0100
commit705f4232c0920a7d1e3f4b70f06fc982015a43d7 (patch)
tree4582aa4d30ebd6b49b8ce00b304beda0e291c81d /ale_linters/javascript/eslint.vim
parent6269ffa0b28bce00d5e9df63ea5c5829a15dd125 (diff)
downloadale-705f4232c0920a7d1e3f4b70f06fc982015a43d7.zip
Add support for formatting filenames into commands, and use it to fix linting with older eslint versions.
Diffstat (limited to 'ale_linters/javascript/eslint.vim')
-rw-r--r--ale_linters/javascript/eslint.vim10
1 files changed, 5 insertions, 5 deletions
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim
index 8a4e03bf..e31a5b15 100644
--- a/ale_linters/javascript/eslint.vim
+++ b/ale_linters/javascript/eslint.vim
@@ -10,9 +10,9 @@ let g:loaded_ale_linters_javascript_eslint = 1
function! ale_linters#javascript#eslint#Handle(buffer, lines)
" Matches patterns line the following:
"
- " <text>:47:14: Missing trailing comma. [Warning/comma-dangle]
- " <text>:56:41: Missing semicolon. [Error/semi]
- let pattern = '^<text>:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]'
+ " /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
+ " /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]
+ let pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$'
let output = []
for line in a:lines
@@ -48,13 +48,13 @@ endfunction
call ALEAddLinter('javascript', {
\ 'name': 'eslint',
\ 'executable': 'eslint',
-\ 'command': 'eslint -f unix --stdin',
+\ 'command': 'eslint -f unix --stdin --stdin-filename %s',
\ 'callback': 'ale_linters#javascript#eslint#Handle',
\})
call ALEAddLinter('javascript.jsx', {
\ 'name': 'eslint',
\ 'executable': 'eslint',
-\ 'command': 'eslint -f unix --stdin',
+\ 'command': 'eslint -f unix --stdin --stdin-filename %s',
\ 'callback': 'ale_linters#javascript#eslint#Handle',
\})