Skip to content

Commit

Permalink
test: correct issue with TSError
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Feb 15, 2021
1 parent 1cf7389 commit d4b5844
Show file tree
Hide file tree
Showing 78 changed files with 243 additions and 232 deletions.
17 changes: 12 additions & 5 deletions packages/typescript-estree/src/node-utils.ts
Expand Up @@ -652,10 +652,12 @@ export function convertTokens(ast: ts.SourceFile): TSESTree.Token[] {
export class TSError extends Error {
constructor(
message: string,
public readonly fileName: string,
public readonly index: number,
public readonly lineNumber: number,
public readonly column: number,
public readonly details: {
fileName: string;
index: number;
lineNumber: number;
columnNumber: number;
},
) {
super(message);
Object.defineProperty(this, 'name', {
Expand All @@ -678,7 +680,12 @@ export function createError(
message: string,
): TSError {
const loc = ast.getLineAndCharacterOfPosition(start);
return new TSError(message, ast.fileName, start, loc.line + 1, loc.character);
return new TSError(message, {
fileName: ast.fileName,
index: start,
lineNumber: loc.line + 1,
columnNumber: loc.character,
});
}

/**
Expand Down

0 comments on commit d4b5844

Please sign in to comment.