Skip to content

Parsing json result fails if eslint outputs warnings #214

@vegar

Description

@vegar

I posted first an issue in SublimeLinter, but it looks like an inprovement of SublimeLinter-eslint is whats needed.

Basically, eslint outputs some deprecation messages alongside the lint errors, which again breaks the parsing of the output.

[2018-03-06 16:16:42,979 - INFO     - SublimeLinter.lint.linter] eslint: cwd: C:\Source\flis
SublimeLinter: #15 SublimeLinter.sublime-package:809: eslint output:
    [{"filePath":"C:\\Source\\flis\\WebApiRole\\src\\app\\components\\button\\dropdown-button.component.js","messages":[{"ruleId":"quotes","severity":2,"message":"Strings must use singlequote.","line":16,"column":17,"nodeType":"Literal","source":"      restrict: \"EA\",","endLine":16,"endColumn":21,"fix":{"range":[260,264],"text":"'EA'"}},{"ruleId":"no-multi-spaces","severity":2,"message":"Multiple spaces found before '}'.","line":24,"column":13,"nodeType":"Punctuator","source":"      }     })","fix":{"range":[482,487],"text":" "}},{"ruleId":"object-curly-newline","severity":2,"message":"Expected a line break before this closing brace.","line":24,"column":13,"nodeType":"ObjectExpression","source":"      }     })","fix":{"range":[487,487],"text":"\n"}}],"errorCount":3,"warningCount":0,"fixableErrorCount":3,"fixableWarningCount":0,"source":"(function() {\n  'use strict';\n\n  DropdownButtonComponentCtrl.$inject = [];\n\n  function DropdownButtonComponentCtrl() {\n    var vm = this;\n\n    vm.$onInit = function() {\n\n    };\n  }\n\n  angular.module('finale')\n    .component('dropdownButton', {\n      restrict: \"EA\",\n\n      templateUrl: 'src/app/components/button/dropdown-button.component.html',\n      controller: 'DropdownButtonComponentCtrl',\n      transclude: true,\n      bindings: {\n        icon: '@',\n        items: '<'\n      }     })\n    .controller('DropdownButtonComponentCtrl', DropdownButtonComponentCtrl);\n}());\n"}]
    The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information

Suggested solution is to break output on line feeds, parse first as json and treat the rest as warnings for the console.,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions