upgrade parser, reduce redundant ESLint rules

This attempts to reduce the amount of redundant ESLint rules we
currently have. It also upgrades the ESLint TypeScript parser to a newer
version (3.7.0).
This commit is contained in:
Resi Respati
2020-07-24 15:37:18 +07:00
parent 1e42b8697c
commit 935509b9ea
3 changed files with 10 additions and 53 deletions

View File

@@ -1,4 +1,3 @@
// tslint:disable:no-conditional-assignment
import { SourceMapConsumer } from "source-map";
export class ErrorMapper {
@@ -27,10 +26,11 @@ export class ErrorMapper {
*/
public static sourceMappedStackTrace(error: Error | string): string {
const stack: string = error instanceof Error ? (error.stack as string) : error;
if (this.cache.hasOwnProperty(stack)) {
if (Object.prototype.hasOwnProperty.call(this.cache, stack)) {
return this.cache[stack];
}
// eslint-disable-next-line no-useless-escape
const re = /^\s+at\s+(.+?\s+)?\(?([0-z._\-\\\/]+):(\d+):(\d+)\)?$/gm;
let match: RegExpExecArray | null;
let outStack = error.toString();