Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected onLintFailure(failure: tslint.RuleFailure): void {
let tag: Tag;
if (failure.getEndPosition().getPosition() - failure.getStartPosition().getPosition() > 1) {
const start = Target.tslinkMark(failure.getStartPosition());
const end = Target.tslinkMark(failure.getEndPosition(), -1, failure.getFailure());
tag = Span.from(start, end);
} else {
tag = Target.tslinkMark(failure.getStartPosition(), 0, failure.getFailure());
}
const severity = Target.tslintSeverity(failure.getRuleSeverity());
if (severity.level() >= Severity.ERROR_LEVEL) {
this.failed = true;
}
const sourceFile = (failure as any).sourceFile;
const input = Unicode.stringInput(sourceFile.text).id(sourceFile.fileName);
const diagnostic = new Diagnostic(input, tag, severity, failure.getRuleName(), null, null);
console.log(diagnostic.toString(OutputSettings.styled()));
}
}
const severity = Target.tsSeverity(error.category);
if (severity.level() >= Severity.ERROR_LEVEL) {
this.failed = true;
}
if (error.file) {
let tag: Tag;
if (error.length! > 1) {
const start = Target.tsMark(error.start!, error.file);
const end = Target.tsMark(error.start! + error.length! - 1, error.file, message);
tag = Span.from(start, end);
} else {
tag = Target.tsMark(error.start!, error.file, message);
}
const input = Unicode.stringInput(error.file.text).id(error.file.fileName);
const diagnostic = new Diagnostic(input, tag, severity, "" + error.code, null, null);
console.log(diagnostic.toString(OutputSettings.styled()));
} else {
const output = Unicode.stringOutput(OutputSettings.styled());
Diagnostic.displayMessage(severity, message, output);
console.log(output.bind());
}
}
protected onLintFailure(failure: tslint.RuleFailure): void {
let tag: Tag;
if (failure.getEndPosition().getPosition() - failure.getStartPosition().getPosition() > 1) {
const start = Target.tslinkMark(failure.getStartPosition());
const end = Target.tslinkMark(failure.getEndPosition(), -1, failure.getFailure());
tag = Span.from(start, end);
} else {
tag = Target.tslinkMark(failure.getStartPosition(), 0, failure.getFailure());
}
const severity = Target.tslintSeverity(failure.getRuleSeverity());
if (severity.level() >= Severity.ERROR_LEVEL) {
this.failed = true;
}
const sourceFile = (failure as any).sourceFile;
const input = Unicode.stringInput(sourceFile.text).id(sourceFile.fileName);
const diagnostic = new Diagnostic(input, tag, severity, failure.getRuleName(), null, null);
console.log(diagnostic.toString(OutputSettings.styled()));
}
}
const severity = Target.tsSeverity(error.category);
if (severity.level() >= Severity.ERROR_LEVEL) {
this.failed = true;
}
if (error.file) {
let tag: Tag;
if (error.length! > 1) {
const start = Target.tsMark(error.start!, error.file);
const end = Target.tsMark(error.start! + error.length! - 1, error.file, message);
tag = Span.from(start, end);
} else {
tag = Target.tsMark(error.start!, error.file, message);
}
const input = Unicode.stringInput(error.file.text).id(error.file.fileName);
const diagnostic = new Diagnostic(input, tag, severity, "" + error.code, null, null);
console.log(diagnostic.toString(OutputSettings.styled()));
} else {
const output = Unicode.stringOutput(OutputSettings.styled());
Diagnostic.displayMessage(severity, message, output);
console.log(output.bind());
}
}