Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public report(resource: string, message: string, options: ReportOptions) {
const { codeSnippet, element, severity = Severity.warning } = options;
let sourceCode: string | null = null;
let position = options.location || null;
if (element) {
// When element is provided, position is an offset in the content.
position = this.findProblemLocation(element, position);
sourceCode = getHTMLCodeSnippet(element);
}
/**
* By default all hints get configured with `default` so they can
* decide the severity of each report unless it's overriden by the
* user.
*/
const finalSeverity = this.severity !== Severity.default ?
this.severity :
severity;
/*
* If location is undefined or equal to null, `position` will be set as `{ column: -1, line: -1 }` later in `hint.report`.
* So pass the `location` on as it is.
*/