Skip to content

Commit

Permalink
fix(linter/html): Fix glob pattern to match HTML files
Browse files Browse the repository at this point in the history
Incorrect use of the group syntax {} without another group lead to the
pattern never matching anything. Same behavior can be reproduced in
local zsh, so likely no UI5 FS bug either.

Enhanced project fixture to actually test this linter end-to-end.
  • Loading branch information
RandomByte committed Sep 12, 2024
1 parent 13a8e2a commit 18d80af
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/linter/html/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function lintHtml({workspace, context}: LinterParameters) {
htmlResources.push(resource);
}));
} else {
htmlResources = await workspace.byGlob("**/{*.html}");
htmlResources = await workspace.byGlob("**/*.html");
}

await Promise.all(htmlResources.map(async (resource: Resource) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
<title>QUnit test suite for the UI5 Application: com.ui5.troublesome.app</title>
<script src="../resources/sap/ui/qunit/qunit-redirect.js"></script>
<script src="testsuite.qunit.js" data-sap-ui-testsuite></script>

<script>
sap.ui.require([], async function () {
console.log("Hello")
});
</script>
</head>
<body></body>
</html>
18 changes: 18 additions & 0 deletions test/lib/linter/snapshots/linter.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,24 @@ Generated by [AVA](https://avajs.dev).
messages: [],
warningCount: 0,
},
{
coverageInfo: [],
errorCount: 0,
fatalErrorCount: 0,
filePath: 'webapp/test/testsuite.qunit.html',
messages: [
{
column: 3,
fatal: undefined,
line: 12,
message: 'Use of unsafe inline script',
messageDetails: 'Content Security Policy (https://ui5.sap.com/#/topic/fe1a6dba940e479fb7c3bc753f92b28c)',
ruleId: 'ui5-linter-csp-unsafe-inline-script',
severity: 1,
},
],
warningCount: 1,
},
{
coverageInfo: [
{
Expand Down
Binary file modified test/lib/linter/snapshots/linter.ts.snap
Binary file not shown.

0 comments on commit 18d80af

Please sign in to comment.