Skip to content

Commit

Permalink
refactor: Remove TextNodes map check
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Apr 12, 2024
1 parent af459f2 commit 4265bfb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/linter/html/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ export async function lintHtml(resourceName: string, contentStream: ReadStream):
const jsScriptTags = await extractJSScriptTags(contentStream);

jsScriptTags.forEach((tag) => {
const scriptContent = tag.textNodes?.map((tNode) => tNode.value).join("");
// Tags with src attribute do not parse and run inline code
const hasSrc = tag.attributes.some((attr) => {
return attr.name.value.toLowerCase() === "src";
});

if (!hasSrc && scriptContent) {
if (!hasSrc && tag.textNodes?.length > 0) {
report.addMessage({
node: tag,
severity: LintMessageSeverity.Warning,
Expand Down

0 comments on commit 4265bfb

Please sign in to comment.