Add "enabled" and "severity"/"warning" to rule in Configuration object, add corresponding documentation and tests, update demo web app (fixes #254)”.
Some checks failed
Checkers / linkcheck (push) Has been cancelled
Checkers / spellcheck (push) Has been cancelled
CI / build (20, macos-latest) (push) Has been cancelled
CI / build (20, ubuntu-latest) (push) Has been cancelled
CI / build (20, windows-latest) (push) Has been cancelled
CI / build (22, macos-latest) (push) Has been cancelled
CI / build (22, ubuntu-latest) (push) Has been cancelled
CI / build (22, windows-latest) (push) Has been cancelled
CI / build (24, macos-latest) (push) Has been cancelled
CI / build (24, ubuntu-latest) (push) Has been cancelled
CI / build (24, windows-latest) (push) Has been cancelled
CI / pnpm (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
TestRepos / build (latest, ubuntu-latest) (push) Has been cancelled
UpdateTestRepos / update (push) Has been cancelled

This commit is contained in:
David Anson 2025-09-22 21:39:09 -07:00
parent 87ddc2e022
commit 0f5a8c701e
20 changed files with 3792 additions and 867 deletions

View file

@ -86,8 +86,8 @@
return `[Unsupported renderer "${renderer}"]`;
}
// Highlight error ranges
function highlightErrors(results, className) {
// Highlight ranges
function highlightRanges(results, className) {
for (const result of results) {
const { errorRange, lineNumber } = result;
const line = document.getElementById(`l${lineNumber}`);
@ -150,14 +150,18 @@
sanitize(result.errorContext) +
"\"</span>]" :
"") +
" [<span class='detail'>" +
result.severity +
"</span>]" +
(result.fixInfo ?
" [<a href='#fix' target='" +
resultJson +
"' class='detail'>Fix</a>]" :
"");
}).join("<br/>");
// Highlight errors
highlightErrors(allLintErrors, "error");
// Highlight errors and warnings
highlightRanges(allLintErrors.filter((error) => error.severity === "warning"), "warning");
highlightRanges(allLintErrors.filter((error) => error.severity === "error"), "error");
}
// Load from a string or File object
@ -216,7 +220,7 @@
for (const element of [ ...document.getElementsByClassName("highlight") ]) {
element.classList.remove("highlight");
}
highlightErrors([ resultJson ], "highlight");
highlightRanges([ resultJson ], "highlight");
var line = document.getElementById(`l${resultJson.lineNumber}`);
line.scrollIntoView();
e.preventDefault();