summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-04-20 13:07:32 +0100
committerw0rp <devw0rp@gmail.com>2017-04-20 13:07:32 +0100
commit7fd763015331953913502930ab59331756bc2cd5 (patch)
treefca6edef9f2662602d639bbb94f26ac9df0b8578
parent0384cabd77e38f9a04ff1c8832f6b755855e909e (diff)
downloadale-7fd763015331953913502930ab59331756bc2cd5.zip
Fix #398 - Report problems with the eslint configuration file
-rw-r--r--ale_linters/javascript/eslint.vim1
-rw-r--r--test/handler/test_eslint_handler.vader30
2 files changed, 31 insertions, 0 deletions
diff --git a/ale_linters/javascript/eslint.vim b/ale_linters/javascript/eslint.vim
index 1a59ff12..7d78eed8 100644
--- a/ale_linters/javascript/eslint.vim
+++ b/ale_linters/javascript/eslint.vim
@@ -42,6 +42,7 @@ endfunction
function! ale_linters#javascript#eslint#Handle(buffer, lines) abort
let l:config_error_pattern = '\v^ESLint couldn''t find a configuration file'
\ . '|^Cannot read config file'
+ \ . '|^.*Configuration for rule .* is invalid'
" Look for a message in the first few lines which indicates that
" a configuration file couldn't be found.
diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader
index 234aed6d..6d84ff7e 100644
--- a/test/handler/test_eslint_handler.vader
+++ b/test/handler/test_eslint_handler.vader
@@ -87,3 +87,33 @@ Execute(The eslint handler should print a message for config parsing errors):
After:
unlet! g:config_error_lines
call ale#linter#Reset()
+
+Execute(The eslint handler should print a message for invalid configuration settings):
+ let g:config_error_lines = [
+ \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
+ \ ' Configuration for rule "indent" is invalid:',
+ \ ' Value "off" is the wrong type.',
+ \ '',
+ \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
+ \ ' Configuration for rule "indent" is invalid:',
+ \ ' Value "off" is the wrong type.',
+ \ '',
+ \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)',
+ \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13',
+ \ ' at Array.forEach (native)',
+ \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)',
+ \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)',
+ \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)',
+ \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)',
+ \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)',
+ \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)',
+ \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)',
+ \]
+
+ AssertEqual
+ \ [{
+ \ 'lnum': 1,
+ \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
+ \ 'detail': join(g:config_error_lines, "\n"),
+ \ }],
+ \ ale_linters#javascript#eslint#Handle(347, g:config_error_lines[:])