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 json correctly):
24 call ale#test#SetFilename('foo.js')
32 \ 'text': '''variable'' is assigned a value but never used.',
33 \ 'code': 'no-unused-vars',
39 \ 'text': 'Missing semicolon.',
48 \ 'text': '''variable'' is already defined.',
49 \ 'code': 'no-redeclare',
53 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
54 \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-unused-vars","severity":1,"message":"''variable'' is assigned a value but never used.","line":1,"column":7,"nodeType":"Identifier","endLine":1,"endColumn":15},{"ruleId":"semi","severity":1,"message":"Missing semicolon.","line":5,"column":15,"nodeType":"ExpressionStatement","fix":{"range":[46,46],"text":";"}},{"ruleId":"no-redeclare","severity":2,"message":"''variable'' is already defined.","line":7,"column":7,"nodeType":"Identifier","endLine":7,"endColumn":15}],"errorCount":1,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":1,"source":"const variable = {\n a: 3\n};\n\nconsole.log(1)\n\nclass variable {\n}\n"}]'
57 Execute(The eslint handler should suppress deprecation warnings):
58 call ale#test#SetFilename('foo.js')
64 \ 'text': 'Parsing error: Unexpected token Controller',
68 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
69 \ '[{"filePath":"foo.js","messages":[{"ruleId":null,"fatal":true,"severity":2 ,"message":"Parsing error: Unexpected token Controller","line":1,"column":9}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount": 0,"source":"i:mport Controller from \"@ember/controller\";\nimport listViewControllerMixin from \"elearning/mixins/list-view-controller\";\nimport { inject as service } from \"@ember/service\";\n\nexport default Controller.extend(listViewControllerMixin(), {\n modelName: \"notification\",\n intl: service(),\n\n flatpickrLocale: computed(\"intl.locale\", function() {\n return this.intl.locale.firstObject.split(\"-\")[0];\n })\n});\n"}]', '(node:616989) [ESLINT_LEGACY_OBJECT_REST_SPREAD] DeprecationWarning: The ''parserOptions.ecmaFeatures.experimentalObjectRestSpread'' option is deprecated. Use ''parser Options.ecmaVersion'' instead. (found in "node_modules/eslint-plugin-ember/lib/config/base.js")]'
72 Execute(The eslint handler should print a message about a missing configuration file):
73 let g:config_error_lines = [
75 \ 'Oops! Something went wrong! :(',
77 \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
80 \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
82 \ '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',
89 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
90 \ 'detail': join(g:config_error_lines, "\n"),
92 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
94 Execute(The eslint handler should allow the missing config error to be suppressed):
95 let b:ale_javascript_eslint_suppress_missing_config = 1
96 let g:config_error_lines = [
98 \ 'Oops! Something went wrong! :(',
100 \ 'ESLint couldn''t find a configuration file. To set up a configuration file for this project, please run:',
103 \ 'ESLint looked for configuration files in /some/path/or/other and its ancestors.',
105 \ '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',
111 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
113 Execute(The eslint handler should print a message for config parsing errors):
114 let g:config_error_lines = [
115 \ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
116 \ 'Error: Unexpected token <<',
117 \ '/some/path/or/other/.eslintrc.js:1',
118 \ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
120 \ 'SyntaxError: Unexpected token <<',
121 \ ' at Object.exports.runInThisContext (vm.js:76:16)',
122 \ ' at Module._compile (module.js:528:28)',
123 \ ' at Object.Module._extensions..js (module.js:565:10)',
124 \ ' at Module.load (module.js:473:32)',
125 \ ' at tryModuleLoad (module.js:432:12)',
126 \ ' at Function.Module._load (module.js:424:3)',
127 \ ' at Module.require (module.js:483:17)',
128 \ ' at require (internal/module.js:20:19)',
129 \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
130 \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
136 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
137 \ 'detail': join(g:config_error_lines, "\n"),
139 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
141 Execute(Suppressing missing configs shouldn't suppress parsing errors):
142 let b:ale_javascript_eslint_suppress_missing_config = 1
143 let g:config_error_lines = [
144 \ 'Cannot read config file: /some/path/or/other/.eslintrc.js',
145 \ 'Error: Unexpected token <<',
146 \ '/some/path/or/other/.eslintrc.js:1',
147 \ '(function (exports, require, module, __filename, __dirname) { <<<>>>',
149 \ 'SyntaxError: Unexpected token <<',
150 \ ' at Object.exports.runInThisContext (vm.js:76:16)',
151 \ ' at Module._compile (module.js:528:28)',
152 \ ' at Object.Module._extensions..js (module.js:565:10)',
153 \ ' at Module.load (module.js:473:32)',
154 \ ' at tryModuleLoad (module.js:432:12)',
155 \ ' at Function.Module._load (module.js:424:3)',
156 \ ' at Module.require (module.js:483:17)',
157 \ ' at require (internal/module.js:20:19)',
158 \ ' at module.exports (/usr/local/lib/node_modules/eslint/node_modules/require-uncached/index.js:14:12)',
159 \ ' at loadJSConfigFile (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:160:16)',
165 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
166 \ 'detail': join(g:config_error_lines, "\n"),
168 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
170 Execute(The eslint handler should print a message for invalid configuration settings):
171 let g:config_error_lines = [
172 \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
173 \ ' Configuration for rule "indent" is invalid:',
174 \ ' Value "off" is the wrong type.',
176 \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
177 \ ' Configuration for rule "indent" is invalid:',
178 \ ' Value "off" is the wrong type.',
180 \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)',
181 \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13',
182 \ ' at Array.forEach (native)',
183 \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)',
184 \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)',
185 \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)',
186 \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)',
187 \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)',
188 \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)',
189 \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)',
195 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
196 \ 'detail': join(g:config_error_lines, "\n"),
198 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
200 Execute(Suppressing missing configs shouldn't suppress invalid config errors):
201 let b:ale_javascript_eslint_suppress_missing_config = 1
202 let g:config_error_lines = [
203 \ '/home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
204 \ ' Configuration for rule "indent" is invalid:',
205 \ ' Value "off" is the wrong type.',
207 \ 'Error: /home/w0rp/git/wazoku/wazoku-spotlight/.eslintrc.js:',
208 \ ' Configuration for rule "indent" is invalid:',
209 \ ' Value "off" is the wrong type.',
211 \ ' at validateRuleOptions (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:115:15)',
212 \ ' at /usr/local/lib/node_modules/eslint/lib/config/config-validator.js:162:13',
213 \ ' at Array.forEach (native)',
214 \ ' at Object.validate (/usr/local/lib/node_modules/eslint/lib/config/config-validator.js:161:35)',
215 \ ' at Object.load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:522:19)',
216 \ ' at loadConfig (/usr/local/lib/node_modules/eslint/lib/config.js:63:33)',
217 \ ' at getLocalConfig (/usr/local/lib/node_modules/eslint/lib/config.js:130:29)',
218 \ ' at Config.getConfig (/usr/local/lib/node_modules/eslint/lib/config.js:256:22)',
219 \ ' at processText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:224:33)',
220 \ ' at CLIEngine.executeOnText (/usr/local/lib/node_modules/eslint/lib/cli-engine.js:756:26)',
226 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
227 \ 'detail': join(g:config_error_lines, "\n"),
229 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
231 Execute(The eslint handler should print a message when import is not used in a module):
232 let g:config_error_lines = [
233 \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.',
234 \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.',
235 \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)',
236 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
237 \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)',
238 \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)',
239 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
240 \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)',
241 \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)',
242 \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)',
243 \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)',
244 \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ',
250 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
251 \ 'detail': join(g:config_error_lines, "\n"),
253 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
255 Execute(Suppressing missing configs shouldn't suppress module import errors):
256 let b:ale_javascript_eslint_suppress_missing_config = 1
257 let g:config_error_lines = [
258 \ 'ImportDeclaration should appear when the mode is ES6 and in the module context.',
259 \ 'AssertionError: ImportDeclaration should appear when the mode is ES6 and in the module context.',
260 \ ' at Referencer.ImportDeclaration (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:597:9)',
261 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
262 \ ' at Referencer.Visitor.visitChildren (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:101:38)',
263 \ ' at Referencer.Program (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/referencer.js:449:14)',
264 \ ' at Referencer.Visitor.visit (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/esrecurse/esrecurse.js:122:34)',
265 \ ' at Object.analyze (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint-scope/lib/index.js:138:16)',
266 \ ' at EventEmitter.module.exports.api.verify (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/eslint.js:887:40)',
267 \ ' at processText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:278:31)',
268 \ ' at CLIEngine.executeOnText (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli-engine.js:734:26)',
269 \ ' at Object.execute (/home/w0rp/git/wazoku/wazoku-spotlight/spotlight/static/node_modules/eslint/lib/cli.js:171:42) ',
275 \ 'text': 'eslint configuration error (type :ALEDetail for more information)',
276 \ 'detail': join(g:config_error_lines, "\n"),
278 \ ale#handlers#eslint#HandleJSON(bufnr(''), g:config_error_lines[:])
280 Execute(The eslint handler should hint about using typescript-eslint-parser):
281 call ale#test#SetFilename('foo.ts')
288 \ 'text': 'Parsing error (You may need configure typescript-eslint-parser): The keyword ''interface'' is reserved',
292 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
293 \ '[{"filePath":"foo.ts","messages":[{"ruleId":null,"fatal":true,"severity":2,"message":"Parsing error: The keyword ''interface'' is reserved","line":2,"column":1}],"errorCount":1,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"source":"\ninterface test {}\n"}]',
296 Execute(eslint should warn about ignored files by default):
301 \ 'text': 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.'
303 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
304 \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]',
311 \ 'text': 'File ignored by default. Use "--ignore-pattern ''!node_modules/*''" to override.',
313 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
314 \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use \"--ignore-pattern ''!node_modules/*''\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]',
317 Execute(eslint should not warn about ignored files when explicitly disabled):
318 let g:ale_javascript_eslint_suppress_eslintignore = 1
322 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
323 \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored because of a matching ignore pattern. Use \"--no-ignore\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]',
328 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
329 \ '[{"filePath":"/path/to/some/ignored/file.js","messages":[{"fatal":false,"severity":1,"message":"File ignored by default. Use \"--ignore-pattern ''!node_modules/*''\" to override."}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":0}]',
332 Execute(Failing to connect to eslint_d should be handled correctly):
337 \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
340 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
341 \ 'Could not connect',
344 Execute(Disabling warnings about trailing spaces should work):
345 call ale#test#SetFilename('foo.js')
352 \ 'code': 'no-trailing-spaces',
354 \ 'text': 'Trailing spaces not allowed.',
357 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
358 \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]'
361 let g:ale_warn_about_trailing_whitespace = 0
365 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
366 \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]'
369 let g:ale_warn_about_trailing_whitespace = 1
370 let b:ale_warn_about_trailing_whitespace = 0
374 \ ale#handlers#eslint#HandleJSON(bufnr(''), [
375 \ '[{"filePath":"foo.js","messages":[{"ruleId":"no-trailing-spaces","severity":1,"message":"Trailing spaces not allowed.","line":2,"column":16,"nodeType":"Program","fix":{"range":[16,17],"text":""}}],"errorCount":0,"warningCount":1,"fixableErrorCount":0,"fixableWarningCount":1,"source":"\nconsole.log(1); \n"}]'