Bug 1499089 - Handle warnings without a line number correctly r=ahal
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 16 Oct 2018 13:46:32 +0000
changeset 489864 188475039aa5c7c9d3ea09fa3d150f41a246a3e3
parent 489863 3361fcc40ea294df9eed70a218c0eafe11bf60a7
child 489865 355899b1b22fed0f5fcc94d5bd95b7205f94b499
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersahal
bugs1499089
milestone64.0a1
Bug 1499089 - Handle warnings without a line number correctly r=ahal Differential Revision: https://phabricator.services.mozilla.com/D8737
tools/lint/eslint/__init__.py
--- a/tools/lint/eslint/__init__.py
+++ b/tools/lint/eslint/__init__.py
@@ -104,15 +104,15 @@ def lint(paths, config, binary=None, fix
     results = []
     for obj in jsonresult:
         errors = obj['messages']
 
         for err in errors:
             err.update({
                 'hint': err.get('fix'),
                 'level': 'error' if err['severity'] == 2 else 'warning',
-                'lineno': err.get('line'),
+                'lineno': err.get('line') or 0,
                 'path': obj['filePath'],
                 'rule': err.get('ruleId'),
             })
             results.append(result.from_config(config, **err))
 
     return results