diff --git a/src/detectors/transpilers/html/parser.ts b/src/detectors/transpilers/html/parser.ts
index b63211bb2..0646ce6ca 100644
--- a/src/detectors/transpilers/html/parser.ts
+++ b/src/detectors/transpilers/html/parser.ts
@@ -61,6 +61,7 @@ export async function extractJSScriptTags(contentStream: ReadStream) {
return attr.name.value !== "type" ||
(attr.name.value === "type" &&
["",
+ "module",
"text/javascript",
"application/javascript", /* legacy */
].includes(attr.value.value.toLowerCase()));
diff --git a/src/linter/html/linter.ts b/src/linter/html/linter.ts
index 6dd781aea..c402c301c 100644
--- a/src/linter/html/linter.ts
+++ b/src/linter/html/linter.ts
@@ -12,9 +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("").trim();
+ // Tags with src attribute do not parse and run inline code
+ const hasSrc = tag.attributes.some((attr) => {
+ return attr.name.value.toLowerCase() === "src";
+ });
- if (scriptContent) {
+ if (!hasSrc && tag.textNodes?.length > 0) {
report.addMessage({
node: tag,
severity: LintMessageSeverity.Warning,
diff --git a/test/fixtures/linter/rules/CSPCompliance/NoInlineJS.html b/test/fixtures/linter/rules/CSPCompliance/NoInlineJS.html
index 234152a16..5f76f49ff 100644
--- a/test/fixtures/linter/rules/CSPCompliance/NoInlineJS.html
+++ b/test/fixtures/linter/rules/CSPCompliance/NoInlineJS.html
@@ -43,6 +43,18 @@
});
sap.ui.xmlview({ viewContent: jQuery('#myXml').html() }).placeAt("content");
+
+
+
+