All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
2 Save g:ale_javascript_eslint_suppress_eslintignore
3 Save g:ale_javascript_eslint_suppress_missing_config
4 Save g:ale_warn_about_trailing_whitespace
5 Save g:ale_warn_about_trailing_blank_lines
7 let g:ale_javascript_eslint_suppress_eslintignore = 0
8 let g:ale_javascript_eslint_suppress_missing_config = 0
9 let g:ale_warn_about_trailing_whitespace = 1
10 let g:ale_warn_about_trailing_blank_lines = 1
11 unlet! b:ale_warn_about_trailing_whitespace
12 unlet! b:ale_warn_about_trailing_blank_lines
17 unlet! b:ale_javascript_eslint_suppress_eslintignore
18 unlet! b:ale_javascript_eslint_suppress_missing_config
19 unlet! b:ale_warn_about_trailing_whitespace
20 unlet! b:ale_warn_about_trailing_blank_lines
21 unlet! g:config_error_lines
23 Execute(The eslint handler should parse lines correctly):
29 \ 'text': 'Missing trailing comma.',
30 \ 'code': 'comma-dangle',
36 \ 'text': 'Missing semicolon.',
43 \ 'text': 'Parsing error: Unexpected token',
47 \ ale#handlers#eslint#Handle(bufnr(''), [
48 \ 'This line should be ignored completely',
49 \ '/path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]',
50 \ '/path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]',
51 \ 'This line should be ignored completely',
52 \ '/path/to/some-filename.js:13:3: Parsing error: Unexpected token',
55 Execute(The eslint handler should print a message about a missing configuration file):
56 let g:config_error_lines = [
58 \ 'Oops! Something went wrong! :(',
60 \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
63 \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
65 \ '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',
72 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
73 \ 'detail': join(g:config_error_lines, "\n"),
75 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
77 Execute(The eslint handler should allow the missing config error to be suppressed):
78 let b:ale_javascript_eslint_suppress_missing_config = 1
79 let g:config_error_lines = [
81 \ 'Oops! Something went wrong! :(',
83 \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
86 \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
88 \ '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',
94 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
96 Execute(The eslint handler should print a message for config parsing errors):
97 let g:config_error_lines = [
98 \ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
99 \ 'Error: Unexpected token <<',
100 \ '/some/path/or/other/.eslintrc.js:1',
101 \ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
103 \ 'SyntaxError: Unexpected token <<',
104 \ ' at Object.exports.runInThisContext (vm.js:76:16)',
105 \ ' at Module._compile (module.js:528:28)',
106 \ ' at Object.Module._extensions..js (module.js:565:10)',
107 \ ' at Module.load (module.js:473:32)',
108 \ ' at tryModuleLoad (module.js:432:12)',
109 \ ' at Function.Module._load (module.js:424:3)',
110 \ ' at Module.require (module.js:483:17)',
111 \ ' at require (internal/module.js:20:19)',
112 \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
113 \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
119 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
120 \ 'detail': join(g:config_error_lines, "\n"),
122 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
124 Execute(Suppressing missing configs shouldn't suppress parsing errors):
125 let b:ale_javascript_eslint_suppress_missing_config = 1
126 let g:config_error_lines = [
127 \ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
128 \ 'Error: Unexpected token <<',
129 \ '/some/path/or/other/.eslintrc.js:1',
130 \ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
132 \ 'SyntaxError: Unexpected token <<',
133 \ ' at Object.exports.runInThisContext (vm.js:76:16)',
134 \ ' at Module._compile (module.js:528:28)',
135 \ ' at Object.Module._extensions..js (module.js:565:10)',
136 \ ' at Module.load (module.js:473:32)',
137 \ ' at tryModuleLoad (module.js:432:12)',
138 \ ' at Function.Module._load (module.js:424:3)',
139 \ ' at Module.require (module.js:483:17)',
140 \ ' at require (internal/module.js:20:19)',
141 \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
142 \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
148 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
149 \ 'detail': join(g:config_error_lines, "\n"),
151 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
153 Execute(The eslint handler should print a message for invalid configuration settings):
154 let g:config_error_lines = [
155 \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
156 \ ' Configuration for rule "indent" is invalid:',
157 \ ' Value "off" is the wrong type.',
159 \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
160 \ ' Configuration for rule "indent" is invalid:',
161 \ ' Value "off" is the wrong type.',
163 \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)',
164 \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13',
165 \ ' at Array.forEach (native)',
166 \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)',
167 \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)',
168 \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)',
169 \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)',
170 \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)',
171 \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)',
172 \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)',
178 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
179 \ 'detail': join(g:config_error_lines, "\n"),
181 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
183 Execute(Suppressing missing configs shouldn't suppress invalid config errors):
184 let b:ale_javascript_eslint_suppress_missing_config = 1
185 let g:config_error_lines = [
186 \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
187 \ ' Configuration for rule "indent" is invalid:',
188 \ ' Value "off" is the wrong type.',
190 \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
191 \ ' Configuration for rule "indent" is invalid:',
192 \ ' Value "off" is the wrong type.',
194 \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)',
195 \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13',
196 \ ' at Array.forEach (native)',
197 \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)',
198 \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)',
199 \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)',
200 \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)',
201 \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)',
202 \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)',
203 \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)',
209 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
210 \ 'detail': join(g:config_error_lines, "\n"),
212 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
214 Execute(The eslint handler should print a message when import is not used in a module):
215 let g:config_error_lines = [
216 \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.',
217 \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.',
218 \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)',
219 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
220 \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)',
221 \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)',
222 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
223 \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)',
224 \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)',
225 \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)',
226 \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)',
227 \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ',
233 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
234 \ 'detail': join(g:config_error_lines, "\n"),
236 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
238 Execute(Suppressing missing configs shouldn't suppress module import errors):
239 let b:ale_javascript_eslint_suppress_missing_config = 1
240 let g:config_error_lines = [
241 \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.',
242 \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.',
243 \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)',
244 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
245 \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)',
246 \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)',
247 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
248 \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)',
249 \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)',
250 \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)',
251 \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)',
252 \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ',
258 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
259 \ 'detail': join(g:config_error_lines, "\n"),
261 \ ale#handlers#eslint#Handle(bufnr(''), g:config_error_lines[:])
264 Execute(The eslint handler should output end_col values where appropriate):
271 \ 'text': 'Parsing error: Unexpected token ''some string''',
278 \ 'text': '''foo'' is not defined.',
279 \ 'code': 'no-undef',
286 \ 'text': 'Unexpected `await` inside a loop.',
287 \ 'code': 'no-await-in-loop',
294 \ 'text': 'Redundant use of `await` on a return value.',
295 \ 'code': 'no-return-await',
302 \ 'text': 'Unexpected console statement',
303 \ 'code': 'no-console',
310 \ 'text': 'Unexpected ''debugger'' statement.',
311 \ 'code': 'no-debugger',
315 \ ale#handlers#eslint#Handle(bufnr(''), [
316 \ 'app.js:4:3: Parsing error: Unexpected token ''some string'' [Error]',
317 \ 'app.js:70:3: ''foo'' is not defined. [Error/no-undef]',
318 \ 'app.js:71:2: Unexpected `await` inside a loop. [Error/no-await-in-loop]',
319 \ 'app.js:72:6: Redundant use of `await` on a return value. [Error/no-return-await]',
320 \ 'app.js:73:4: Unexpected console statement [Error/no-console]',
321 \ 'app.js:74:4: Unexpected ''debugger'' statement. [Error/no-debugger]',
324 Execute(The eslint hint about using typescript-eslint-parser):
325 silent! noautocmd file foo.ts
333 \ 'text': 'Parsing error (You may need configure typescript-eslint-parser): Unexpected token )',
337 \ ale#handlers#eslint#Handle(bufnr(''), [
338 \ 'foo.ts:451:2: Parsing error: Unexpected token ) [Error]',
341 Execute(eslint should warn about ignored files by default):
347 \ 'text': 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.'
349 \ ale#handlers#eslint#Handle(bufnr(''), [
350 \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
358 \ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.',
360 \ ale#handlers#eslint#Handle(bufnr(''), [
361 \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
364 Execute(eslint should not warn about ignored files when explicitly disabled):
365 let g:ale_javascript_eslint_suppress_eslintignore = 1
369 \ ale#handlers#eslint#Handle(bufnr(''), [
370 \ '/path/to/some/ignored.js:0:0: File ignored because of a matching ignore pattern. Use "--no-ignore" to override. [Warning]',
375 \ ale#handlers#eslint#Handle(bufnr(''), [
376 \ '/path/to/some/ignored.js:0:0: File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override. [Warning]',
379 Execute(eslint should handle react errors correctly):
386 \ 'text': 'Property should be placed on the same line as the component declaration',
387 \ 'code': 'react/jsx-first-prop-new-line',
390 \ ale#handlers#eslint#Handle(bufnr(''), [
391 \ '/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]',
394 Execute(Failing to connect to eslint_d should be handled correctly):
399 \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
402 \ ale#handlers#eslint#Handle(bufnr(''), [
403 \ 'Could not connect',
406 Execute(Disabling warnings about trailing spaces should work):
407 silent! noautocmd file foo.ts
414 \ 'code': 'no-trailing-spaces',
416 \ 'text': 'Trailing spaces not allowed.',
419 \ ale#handlers#eslint#Handle(bufnr(''), [
420 \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',
423 let g:ale_warn_about_trailing_whitespace = 0
427 \ ale#handlers#eslint#Handle(bufnr(''), [
428 \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',
431 let g:ale_warn_about_trailing_whitespace = 1
432 let b:ale_warn_about_trailing_whitespace = 0
436 \ ale#handlers#eslint#Handle(bufnr(''), [
437 \ 'foo.js:182:22: Trailing spaces not allowed. [Error/no-trailing-spaces]',