summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-20 17:38:21 +0100
committerw0rp <devw0rp@gmail.com>2017-06-20 17:38:21 +0100
commit50d952b07d30f6f47398861dbbdcab5ced54dd7f (patch)
treeca069117c773dfa43dc5cc98de1555ee2d26f785
parenta105aa90a595ac5b8e2fe3f581a05bb705f5de21 (diff)
downloadale-50d952b07d30f6f47398861dbbdcab5ced54dd7f.zip
Print messages about imports used when modules are turned off
-rw-r--r--autoload/ale/handlers/eslint.vim1
-rw-r--r--test/handler/test_eslint_handler.vader24
2 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/handlers/eslint.vim b/autoload/ale/handlers/eslint.vim
index 1c6233d1..a7ff0ae2 100644
--- a/autoload/ale/handlers/eslint.vim
+++ b/autoload/ale/handlers/eslint.vim
@@ -53,6 +53,7 @@ function! ale#handlers#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'
+ \ . '|^ImportDeclaration should appear'
" 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 0a230c70..7ac26c72 100644
--- a/test/handler/test_eslint_handler.vader
+++ b/test/handler/test_eslint_handler.vader
@@ -111,6 +111,30 @@ Execute(The eslint handler should print a message for invalid configuration sett
\ }],
\ ale#handlers#eslint#Handle(347, g:config_error_lines[:])
+Execute(The eslint handler should print a message when import is not used in a module):
+ let g:config_error_lines = [
+ \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.',
+ \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.',
+ \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)',
+ \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
+ \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)',
+ \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)',
+ \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
+ \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)',
+ \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)',
+ \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)',
+ \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)',
+ \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ',
+ \]
+
+ AssertEqual
+ \ [{
+ \ 'lnum': 1,
+ \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
+ \ 'detail': join(g:config_error_lines, "\n"),
+ \ }],
+ \ ale#handlers#eslint#Handle(347, g:config_error_lines[:])
+
Execute(The eslint handler should output end_col values where appropriate):
AssertEqual
\ [