UNPKG

tslint-formatter-vscode

Version:
28 lines (27 loc) 1.22 kB
var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var Lint = require("tslint/lib/index"); var Formatter = (function (_super) { __extends(Formatter, _super); function Formatter() { return _super.apply(this, arguments) || this; } Formatter.prototype.format = function (failures) { var outputLines = failures.map(this.formatFailure); return outputLines.join("\n") + "\n"; }; Formatter.prototype.formatFailure = function (failure) { var fileName = failure.getFileName(); var message = failure.getFailure(); var ruleName = failure.getRuleName(); var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); var positionTuple = (lineAndCharacter.line + 1) + ',' + (lineAndCharacter.character + 1); return fileName + " (" + positionTuple + "): warning TSLINT: " + message + " (" + ruleName + ")"; }; return Formatter; }(Lint.Formatters.AbstractFormatter)); exports.Formatter = Formatter;