2017-08-22 20:40:00 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_javascript_eslint_suppress_eslintignore
|
2017-10-28 11:11:33 +00:00
|
|
|
Save g:ale_javascript_eslint_suppress_missing_config
|
2019-05-12 14:49:16 +00:00
|
|
|
Save g:ale_warn_about_trailing_whitespace
|
|
|
|
Save g:ale_warn_about_trailing_blank_lines
|
2017-08-22 20:40:00 +00:00
|
|
|
|
|
|
|
let g:ale_javascript_eslint_suppress_eslintignore = 0
|
2017-11-16 09:34:24 +00:00
|
|
|
let g:ale_javascript_eslint_suppress_missing_config = 0
|
2019-05-12 14:49:16 +00:00
|
|
|
let g:ale_warn_about_trailing_whitespace = 1
|
|
|
|
let g:ale_warn_about_trailing_blank_lines = 1
|
|
|
|
unlet! b:ale_warn_about_trailing_whitespace
|
|
|
|
unlet! b:ale_warn_about_trailing_blank_lines
|
2017-08-22 20:40:00 +00:00
|
|
|
|
2017-06-20 09:50:38 +00:00
|
|
|
After:
|
2017-08-22 20:40:00 +00:00
|
|
|
Restore
|
|
|
|
|
2017-11-16 09:34:24 +00:00
|
|
|
unlet! b:ale_javascript_eslint_suppress_eslintignore
|
2017-10-28 11:11:33 +00:00
|
|
|
unlet! b:ale_javascript_eslint_suppress_missing_config
|
2019-05-12 14:49:16 +00:00
|
|
|
unlet! b:ale_warn_about_trailing_whitespace
|
|
|
|
unlet! b:ale_warn_about_trailing_blank_lines
|
2017-06-20 09:50:38 +00:00
|
|
|
unlet! g:config_error_lines
|
2016-12-22 11:16:22 +00:00
|
|
|
|
2017-03-09 21:05:00 +00:00
|
|
|
Execute(The eslint handler should parse lines correctly):
|
2016-12-22 11:16:22 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 47,
|
|
|
|
\ 'col': 14,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Missing trailing comma.',
|
|
|
|
\ 'code': 'comma-dangle',
|
2016-12-22 11:16:22 +00:00
|
|
|
\ 'type': 'W',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 56,
|
|
|
|
\ 'col': 41,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Missing semicolon.',
|
|
|
|
\ 'code': 'semi',
|
2016-12-22 11:16:22 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 13,
|
|
|
|
\ 'col': 3,
|
|
|
|
\ 'text': 'Parsing error: Unexpected token',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
2016-12-22 11:16:22 +00:00
|
|
|
\ 'This line should be ignored completely',
|
|
|
|
\ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]',
|
|
|
|
\ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]',
|
|
|
|
\ 'This line should be ignored completely',
|
|
|
|
\ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token',
|
|
|
|
\ ])
|
|
|
|
|
2017-03-09 21:05:00 +00:00
|
|
|
Execute(The eslint handler should print a message about a missing configuration file):
|
|
|
|
let g:config_error_lines = [
|
|
|
|
\ '',
|
|
|
|
\ 'Oops! Something went wrong! :(',
|
|
|
|
\ '',
|
|
|
|
\ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
|
|
|
|
\ ' eslint --init',
|
|
|
|
\ '',
|
|
|
|
\ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
|
|
|
|
\ '',
|
|
|
|
\ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint',
|
|
|
|
\ '',
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [{
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'text': 'eslint configuration error (type :ALEDetail for more information)',
|
|
|
|
\ 'detail': join(g:config_error_lines, "\n"),
|
|
|
|
\ }],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
|
|
|
|
|
|
|
Execute(The eslint handler should allow the missing config error to be suppressed):
|
|
|
|
let b:ale_javascript_eslint_suppress_missing_config = 1
|
|
|
|
let g:config_error_lines = [
|
|
|
|
\ '',
|
|
|
|
\ 'Oops! Something went wrong! :(',
|
|
|
|
\ '',
|
|
|
|
\ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
|
|
|
|
\ ' eslint --init',
|
|
|
|
\ '',
|
|
|
|
\ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
|
|
|
|
\ '',
|
|
|
|
\ 'If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://gitter.im/eslint/eslint',
|
|
|
|
\ '',
|
|
|
|
\ ]
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
2017-03-09 21:05:00 +00:00
|
|
|
|
|
|
|
Execute(The eslint handler should print a message for config parsing errors):
|
|
|
|
let g:config_error_lines = [
|
|
|
|
\ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
|
|
|
|
\ 'Error: Unexpected token <<',
|
|
|
|
\ '/some/path/or/other/.eslintrc.js:1',
|
|
|
|
\ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
|
|
|
|
\ ' ^^',
|
|
|
|
\ 'SyntaxError: Unexpected token <<',
|
|
|
|
\ ' at Object.exports.runInThisContext (vm.js:76:16)',
|
|
|
|
\ ' at Module._compile (module.js:528:28)',
|
|
|
|
\ ' at Object.Module._extensions..js (module.js:565:10)',
|
|
|
|
\ ' at Module.load (module.js:473:32)',
|
|
|
|
\ ' at tryModuleLoad (module.js:432:12)',
|
|
|
|
\ ' at Function.Module._load (module.js:424:3)',
|
|
|
|
\ ' at Module.require (module.js:483:17)',
|
|
|
|
\ ' at require (internal/module.js:20:19)',
|
|
|
|
\ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
|
|
|
|
\ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
|
|
|
|
\]
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [{
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'text': 'eslint configuration error (type :ALEDetail for more information)',
|
|
|
|
\ 'detail': join(g:config_error_lines, "\n"),
|
|
|
|
\ }],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
|
|
|
|
|
|
|
Execute(Suppressing missing configs shouldn't suppress parsing errors):
|
|
|
|
let b:ale_javascript_eslint_suppress_missing_config = 1
|
|
|
|
let g:config_error_lines = [
|
|
|
|
\ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
|
|
|
|
\ 'Error: Unexpected token <<',
|
|
|
|
\ '/some/path/or/other/.eslintrc.js:1',
|
|
|
|
\ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
|
|
|
|
\ ' ^^',
|
|
|
|
\ 'SyntaxError: Unexpected token <<',
|
|
|
|
\ ' at Object.exports.runInThisContext (vm.js:76:16)',
|
|
|
|
\ ' at Module._compile (module.js:528:28)',
|
|
|
|
\ ' at Object.Module._extensions..js (module.js:565:10)',
|
|
|
|
\ ' at Module.load (module.js:473:32)',
|
|
|
|
\ ' at tryModuleLoad (module.js:432:12)',
|
|
|
|
\ ' at Function.Module._load (module.js:424:3)',
|
|
|
|
\ ' at Module.require (module.js:483:17)',
|
|
|
|
\ ' at require (internal/module.js:20:19)',
|
|
|
|
\ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
|
|
|
|
\ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
|
|
|
|
\]
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [{
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'text': 'eslint configuration error (type :ALEDetail for more information)',
|
|
|
|
\ 'detail': join(g:config_error_lines, "\n"),
|
|
|
|
\ }],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
2017-04-20 12:07:32 +00:00
|
|
|
|
|
|
|
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"),
|
|
|
|
\ }],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
|
|
|
|
|
|
|
Execute(Suppressing missing configs shouldn't suppress invalid config errors):
|
|
|
|
let b:ale_javascript_eslint_suppress_missing_config = 1
|
|
|
|
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#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
2017-05-16 21:57:15 +00:00
|
|
|
|
2017-06-20 16:38:21 +00:00
|
|
|
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"),
|
|
|
|
\ }],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
|
|
|
|
|
|
|
|
Execute(Suppressing missing configs shouldn't suppress module import errors):
|
|
|
|
let b:ale_javascript_eslint_suppress_missing_config = 1
|
|
|
|
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(bufnr(''), g:config_error_lines[:])
|
|
|
|
|
2017-06-20 16:38:21 +00:00
|
|
|
|
2017-05-16 21:57:15 +00:00
|
|
|
Execute(The eslint handler should output end_col values where appropriate):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 4,
|
|
|
|
\ 'col': 3,
|
|
|
|
\ 'end_col': 15,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Parsing error: Unexpected token ''some string''',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 70,
|
|
|
|
\ 'col': 3,
|
|
|
|
\ 'end_col': 5,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': '''foo'' is not defined.',
|
|
|
|
\ 'code': 'no-undef',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 71,
|
|
|
|
\ 'col': 2,
|
|
|
|
\ 'end_col': 6,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Unexpected `await` inside a loop.',
|
|
|
|
\ 'code': 'no-await-in-loop',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 72,
|
|
|
|
\ 'col': 6,
|
|
|
|
\ 'end_col': 10,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Redundant use of `await` on a return value.',
|
|
|
|
\ 'code': 'no-return-await',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 73,
|
|
|
|
\ 'col': 4,
|
|
|
|
\ 'end_col': 10,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Unexpected console statement',
|
|
|
|
\ 'code': 'no-console',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 74,
|
|
|
|
\ 'col': 4,
|
|
|
|
\ 'end_col': 11,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Unexpected ''debugger'' statement.',
|
|
|
|
\ 'code': 'no-debugger',
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
2017-05-16 21:57:15 +00:00
|
|
|
\ 'app.js:4:3: Parsing error: Unexpected token ''some string'' [Error]',
|
|
|
|
\ 'app.js:70:3: ''foo'' is not defined. [Error/no-undef]',
|
|
|
|
\ 'app.js:71:2: Unexpected `await` inside a loop. [Error/no-await-in-loop]',
|
|
|
|
\ 'app.js:72:6: Redundant use of `await` on a return value. [Error/no-return-await]',
|
|
|
|
\ 'app.js:73:4: Unexpected console statement [Error/no-console]',
|
|
|
|
\ 'app.js:74:4: Unexpected ''debugger'' statement. [Error/no-debugger]',
|
|
|
|
\ ])
|
2017-06-20 09:50:38 +00:00
|
|
|
|
|
|
|
Execute(The eslint hint about using typescript-eslint-parser):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 451,
|
|
|
|
\ 'col': 2,
|
|
|
|
\ 'end_col': 2,
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'Parsing error (You may need configure typescript-eslint-parser): Unexpected token )',
|
2017-06-20 09:50:38 +00:00
|
|
|
\ 'type': 'E',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ 'foo.ts:451:2: Parsing error: Unexpected token ) [Error]',
|
|
|
|
\ ])
|
2017-08-22 20:40:00 +00:00
|
|
|
|
|
|
|
Execute(eslint should warn about ignored files by default):
|
|
|
|
AssertEqual
|
|
|
|
\ [{
|
|
|
|
\ 'lnum': 0,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'W',
|
2017-11-13 23:21:45 +00:00
|
|
|
\ 'text': 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.'
|
2017-08-22 20:40:00 +00:00
|
|
|
\ }],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
2017-08-22 20:40:00 +00:00
|
|
|
\ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
|
|
|
|
\ ])
|
|
|
|
|
2019-01-27 12:08:31 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [{
|
|
|
|
\ 'lnum': 0,
|
|
|
|
\ 'col': 0,
|
|
|
|
\ 'type': 'W',
|
|
|
|
\ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.',
|
|
|
|
\ }],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
|
|
|
|
\ ])
|
|
|
|
|
2017-08-22 20:40:00 +00:00
|
|
|
Execute(eslint should not warn about ignored files when explicitly disabled):
|
|
|
|
let g:ale_javascript_eslint_suppress_eslintignore = 1
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
2017-10-28 11:11:33 +00:00
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
2017-08-22 20:40:00 +00:00
|
|
|
\ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
|
|
|
|
\ ])
|
2017-11-16 09:34:24 +00:00
|
|
|
|
2019-01-27 12:08:31 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
|
|
|
|
\ ])
|
|
|
|
|
2017-11-16 09:34:24 +00:00
|
|
|
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]',
|
|
|
|
\ ])
|
2018-09-17 16:32:57 +00:00
|
|
|
|
|
|
|
Execute(Failing to connect to eslint_d should be handled correctly):
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ 'Could not connect',
|
|
|
|
\ ])
|
2019-05-12 14:49:16 +00:00
|
|
|
|
|
|
|
Execute(Disabling warnings about trailing spaces should work):
|
|
|
|
silent! noautocmd file foo.ts
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 182,
|
|
|
|
\ 'col': 22,
|
|
|
|
\ 'code': 'no-trailing-spaces',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'Trailing spaces not allowed.',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
let g:ale_warn_about_trailing_whitespace = 0
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',
|
|
|
|
\ ])
|
|
|
|
|
|
|
|
let g:ale_warn_about_trailing_whitespace = 1
|
|
|
|
let b:ale_warn_about_trailing_whitespace = 0
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale#handlers#eslint#Handle(bufnr(''), [
|
|
|
|
\ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',
|
|
|
|
\ ])
|