Skip to content

Commit

Permalink
feat: Improved xss-scan cli errors
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed May 26, 2024
1 parent b04add4 commit 391f315
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-garlics-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kitajs/ts-html-plugin': patch
---

Improved xss-scan cli errors
8 changes: 4 additions & 4 deletions packages/ts-html-plugin/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ Examples:
Exit codes:
0 - No XSS vulnerabilities were found
1 - XSS vulnerabilities were found
2 - Only XSS warnings were found
2 - Only warnings were found
`.trim();

function readCompilerOptions(tsconfigPath: string) {
const { config, error } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);

if (error) {
throw error;
return { errors: [error] };
}

const { options, errors, fileNames } = ts.parseJsonConfigFileContent(
Expand All @@ -70,7 +70,7 @@ function prettyPrintErrorCount(diagnostics: ts.Diagnostic[], root: string) {
continue;
}

const file = files.get(diagnostic.file.fileName)!;
const file = files.get(diagnostic.file.fileName);

if (file !== undefined) {
files.set(diagnostic.file.fileName, file + 1);
Expand Down Expand Up @@ -208,7 +208,7 @@ async function main() {
}

ts.forEachChild(source, function loopSourceNodes(node) {
recursiveDiagnoseJsxElements(ts as any, node, typeChecker, diagnostics);
recursiveDiagnoseJsxElements(ts, node, typeChecker, diagnostics);
});
}

Expand Down

0 comments on commit 391f315

Please sign in to comment.