summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-16 09:34:24 +0000
committerw0rp <devw0rp@gmail.com>2017-11-16 09:34:24 +0000
commit71d34fc0c6eba0935b97a8d9dc5fd29c432be452 (patch)
tree04b6a5f7894b2e40e8717b71aebab319c8accd86
parent1d65e5692f7075bad6806d88eb11961ea32d3e7d (diff)
downloadale-71d34fc0c6eba0935b97a8d9dc5fd29c432be452.zip
Fix #1132 - Parse react error codes again for ESLint
-rw-r--r--autoload/ale/handlers/eslint.vim3
-rw-r--r--test/handler/test_eslint_handler.vader20
2 files changed, 19 insertions, 4 deletions
diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim
index adfb65be..ff590162 100644
--- a/autoload/ale/handlers/eslint.vim
+++ b/autoload/ale/handlers/eslint.vim
@@ -133,8 +133,9 @@ function! ale#handlers#eslint#Handle(buffer, lines) abort
let l:obj.type = 'W'
endif
+ " The code can be something like 'Error/foo/bar', or just 'Error'
if !empty(get(l:split_code, 1))
- let l:obj.code = l:split_code[1]
+ let l:obj.code = join(l:split_code[1:], '/')
endif
for l:col_match in ale#util#GetMatches(l:text, s:col_end_patterns)
diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader
index 47e84d4f..2e8bfd2a 100644
--- a/test/handler/test_eslint_handler.vader
+++ b/test/handler/test_eslint_handler.vader
@@ -3,13 +3,12 @@ Before:
Save g:ale_javascript_eslint_suppress_missing_config
let g:ale_javascript_eslint_suppress_eslintignore = 0
- let b:ale_javascript_eslint_suppress_missing_config = 0
-
- unlet! b:ale_javascript_eslint_suppress_missing_config
+ let g:ale_javascript_eslint_suppress_missing_config = 0
After:
Restore
+ unlet! b:ale_javascript_eslint_suppress_eslintignore
unlet! b:ale_javascript_eslint_suppress_missing_config
unlet! g:config_error_lines
@@ -351,3 +350,18 @@ Execute(eslint should not warn about ignored files when explicitly disabled):
\ ale#handlers#eslint#Handle(bufnr(''), [
\ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
\ ])
+
+Execute(eslint should handle react errors correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 59,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': 'Property should be placed on the same line as the component declaration',
+ \ 'code': 'react/jsx-first-prop-new-line',
+ \ },
+ \ ],
+ \ ale#handlers#eslint#Handle(bufnr(''), [
+ \ '/path/editor-help.jsx:59:9: Property should be placed on the same line as the component declaration [Error/react/jsx-first-prop-new-line]',
+ \ ])