Print messages about imports used when modules are turned off

This commit is contained in:
w0rp 2017-06-20 17:38:21 +01:00
parent a105aa90a5
commit 50d952b07d
2 changed files with 25 additions and 0 deletions

View file

@ -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.

View file

@ -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
\ [