diff --git a/index.js b/index.js index 7e45494..1930c79 100644 --- a/index.js +++ b/index.js @@ -84,8 +84,8 @@ PathFormatter.prototype = Object.create({ var lineAndCharacter = failure.getStartPosition().getLineAndCharacter(); var item = { reason: failure.getFailure(), - line: lineAndCharacter.line() + 1, - character: lineAndCharacter.character() + 1, + line: (typeof lineAndCharacter.line === 'function' ? lineAndCharacter.line() : lineAndCharacter.line) + 1, + character: (typeof lineAndCharacter.character === 'function' ? lineAndCharacter.character() : lineAndCharacter.character) + 1, code: (failure.getRuleName ? failure.getRuleName() : '') }; res.errors.push(item); diff --git a/package.json b/package.json index 00095e3..5fb87a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tslint-path-formatter", - "version": "0.1.1", + "version": "0.1.2", "description": "TSLint formatter that displays absolute path with row/column on one line", "main": "index.js", "scripts": { diff --git a/test/fixtures/files/output.txt b/test/fixtures/files/output.txt index 1f3d1a7..d3ac33f 100644 --- a/test/fixtures/files/output.txt +++ b/test/fixtures/files/output.txt @@ -23,6 +23,7 @@ ERROR at {{full}}failureB.test.ts(3,9): TSLint found 3 errors +>> 8 errors in 2 files Warning: Task "tslint:files" failed. Use --force to continue. Aborted due to warnings.