From e47a6850717209aad299d1ff5557e4bf7429a8de Mon Sep 17 00:00:00 2001
From: Michael Kriese <michael.kriese@visualon.de>
Date: Tue, 17 May 2022 11:40:07 +0200
Subject: [PATCH] fix(dashboard): use blockquote instead of invalid ul (#15612)

---
 .../master-issue_with_2_PR_closed_ignored.txt |   1 -
 .../master-issue_with_2_PR_edited.txt         |   1 -
 .../master-issue_with_3_PR_in_approval.txt    |   1 -
 .../master-issue_with_3_PR_in_progress.txt    |   1 -
 .../__fixtures__/master-issue_with_8_PR.txt   |   1 -
 .../dependency-dashboard.spec.ts.snap         | 217 +++++++++++-------
 .../repository/dependency-dashboard.ts        |  17 +-
 lib/workers/repository/package-files.ts       |  21 +-
 tsconfig.strict.json                          |   1 -
 9 files changed, 156 insertions(+), 105 deletions(-)

diff --git a/lib/workers/repository/__fixtures__/master-issue_with_2_PR_closed_ignored.txt b/lib/workers/repository/__fixtures__/master-issue_with_2_PR_closed_ignored.txt
index fcf12bce59..fffe0e2d90 100644
--- a/lib/workers/repository/__fixtures__/master-issue_with_2_PR_closed_ignored.txt
+++ b/lib/workers/repository/__fixtures__/master-issue_with_2_PR_closed_ignored.txt
@@ -11,4 +11,3 @@ These are blocked by an existing closed PR and will not be recreated unless you
 
 None detected
 
-
diff --git a/lib/workers/repository/__fixtures__/master-issue_with_2_PR_edited.txt b/lib/workers/repository/__fixtures__/master-issue_with_2_PR_edited.txt
index c1dd60e3ff..cd67feae86 100644
--- a/lib/workers/repository/__fixtures__/master-issue_with_2_PR_edited.txt
+++ b/lib/workers/repository/__fixtures__/master-issue_with_2_PR_edited.txt
@@ -11,4 +11,3 @@ These updates have been manually edited so Renovate will no longer make changes.
 
 None detected
 
-
diff --git a/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_approval.txt b/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_approval.txt
index 3c6275a9c6..a5cf0fb1f3 100644
--- a/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_approval.txt
+++ b/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_approval.txt
@@ -18,4 +18,3 @@ These updates await pending status checks. To force their creation now, click th
 
 None detected
 
-
diff --git a/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_progress.txt b/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_progress.txt
index e403823a1e..54d0c07cfd 100644
--- a/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_progress.txt
+++ b/lib/workers/repository/__fixtures__/master-issue_with_3_PR_in_progress.txt
@@ -13,4 +13,3 @@ These updates have all been created already. Click a checkbox below to force a r
 
 None detected
 
-
diff --git a/lib/workers/repository/__fixtures__/master-issue_with_8_PR.txt b/lib/workers/repository/__fixtures__/master-issue_with_8_PR.txt
index c34516c0d3..297cb29a67 100644
--- a/lib/workers/repository/__fixtures__/master-issue_with_8_PR.txt
+++ b/lib/workers/repository/__fixtures__/master-issue_with_8_PR.txt
@@ -38,4 +38,3 @@ These updates await pending status checks before automerging. Click on a checkbo
 
 None detected
 
-
diff --git a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap
index cfd52ab4d7..0b9db9fe45 100644
--- a/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap
+++ b/lib/workers/repository/__snapshots__/dependency-dashboard.spec.ts.snap
@@ -7,21 +7,25 @@ This repository currently has no open or pending branches.
 
 ## Detected dependencies
 
-<details><summary>Branch main
-</summary>
+<details><summary>Branch main</summary>
+<blockquote>
 
+<details><summary>dockerfile</summary>
+<blockquote>
 
-<ul><details><summary>dockerfile</summary>
-
-<ul><details><summary>Dockerfile</summary>
+<details><summary>Dockerfile</summary>
 
  - \`ubuntu 20.04\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>npm</summary>
+</details>
+
+</blockquote>
+</details>
+
+<details><summary>npm</summary>
+<blockquote>
 
-<ul><details><summary>package.json</summary>
+<details><summary>package.json</summary>
 
  - \`cookie-parser ^1.4.5\`
  - \`express ~4.17.1\`
@@ -32,33 +36,45 @@ This repository currently has no open or pending branches.
  - \`dotenv 10.0.0\`
  - \`nodemon 2.0.14\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>poetry</summary>
+</details>
+
+</blockquote>
+</details>
+
+<details><summary>poetry</summary>
+<blockquote>
 
-<ul><details><summary>pyproject.toml</summary>
+<details><summary>pyproject.toml</summary>
 
  - \`six <=1.3.0\`
 
-</details></ul>
-</details></ul>
 </details>
 
-<details><summary>Branch dev
-</summary>
+</blockquote>
+</details>
 
+</blockquote>
+</details>
 
-<ul><details><summary>dockerfile</summary>
+<details><summary>Branch dev</summary>
+<blockquote>
 
-<ul><details><summary>Dockerfile</summary>
+<details><summary>dockerfile</summary>
+<blockquote>
+
+<details><summary>Dockerfile</summary>
 
  - \`ubuntu 20.04\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>npm</summary>
+</details>
 
-<ul><details><summary>package.json</summary>
+</blockquote>
+</details>
+
+<details><summary>npm</summary>
+<blockquote>
+
+<details><summary>package.json</summary>
 
  - \`cookie-parser ^1.4.5\`
  - \`express ~4.17.1\`
@@ -69,16 +85,24 @@ This repository currently has no open or pending branches.
  - \`dotenv 10.0.0\`
  - \`nodemon 2.0.14\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>poetry</summary>
+</details>
+
+</blockquote>
+</details>
+
+<details><summary>poetry</summary>
+<blockquote>
 
-<ul><details><summary>pyproject.toml</summary>
+<details><summary>pyproject.toml</summary>
 
  - \`six <=1.3.0\`
 
-</details></ul>
-</details></ul>
+</details>
+
+</blockquote>
+</details>
+
+</blockquote>
 </details>
 
 "
@@ -91,29 +115,33 @@ This repository currently has no open or pending branches.
 
 ## Detected dependencies
 
-<details><summary>Branch main
-</summary>
+<details><summary>Branch main</summary>
+<blockquote>
 
 None detected
 
-
+</blockquote>
 </details>
 
-<details><summary>Branch dev
-</summary>
+<details><summary>Branch dev</summary>
+<blockquote>
 
+<details><summary>dockerfile</summary>
+<blockquote>
 
-<ul><details><summary>dockerfile</summary>
-
-<ul><details><summary>Dockerfile</summary>
+<details><summary>Dockerfile</summary>
 
  - \`ubuntu 20.04\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>npm</summary>
+</details>
+
+</blockquote>
+</details>
 
-<ul><details><summary>package.json</summary>
+<details><summary>npm</summary>
+<blockquote>
+
+<details><summary>package.json</summary>
 
  - \`cookie-parser ^1.4.5\`
  - \`express ~4.17.1\`
@@ -124,16 +152,24 @@ None detected
  - \`dotenv 10.0.0\`
  - \`nodemon 2.0.14\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>poetry</summary>
+</details>
 
-<ul><details><summary>pyproject.toml</summary>
+</blockquote>
+</details>
+
+<details><summary>poetry</summary>
+<blockquote>
+
+<details><summary>pyproject.toml</summary>
 
  - \`six <=1.3.0\`
 
-</details></ul>
-</details></ul>
+</details>
+
+</blockquote>
+</details>
+
+</blockquote>
 </details>
 
 "
@@ -146,29 +182,33 @@ This repository currently has no open or pending branches.
 
 ## Detected dependencies
 
-<details><summary>Branch main
-</summary>
+<details><summary>Branch main</summary>
+<blockquote>
 
 None detected
 
-
+</blockquote>
 </details>
 
-<details><summary>Branch dev
-</summary>
-
+<details><summary>Branch dev</summary>
+<blockquote>
 
-<ul><details><summary>dockerfile</summary>
+<details><summary>dockerfile</summary>
+<blockquote>
 
-<ul><details><summary>Dockerfile</summary>
+<details><summary>Dockerfile</summary>
 
  - \`ubuntu 20.04\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>npm</summary>
+</details>
+
+</blockquote>
+</details>
+
+<details><summary>npm</summary>
+<blockquote>
 
-<ul><details><summary>package.json</summary>
+<details><summary>package.json</summary>
 
  - \`cookie-parser ^1.4.5\`
  - \`express ~4.17.1\`
@@ -179,16 +219,24 @@ None detected
  - \`dotenv 10.0.0\`
  - \`nodemon 2.0.14\`
 
-</details></ul>
-</details></ul>
-<ul><details><summary>poetry</summary>
+</details>
+
+</blockquote>
+</details>
 
-<ul><details><summary>pyproject.toml</summary>
+<details><summary>poetry</summary>
+<blockquote>
+
+<details><summary>pyproject.toml</summary>
 
  - \`six <=1.3.0\`
 
-</details></ul>
-</details></ul>
+</details>
+
+</blockquote>
+</details>
+
+</blockquote>
 </details>
 
 "
@@ -202,15 +250,21 @@ This repository currently has no open or pending branches.
 ## Detected dependencies
 
 <details><summary>dockerfile</summary>
+<blockquote>
 
-<ul><details><summary>Dockerfile</summary>
+<details><summary>Dockerfile</summary>
 
  - \`ubuntu 20.04\`
 
-</details></ul>
-</details><details><summary>npm</summary>
+</details>
 
-<ul><details><summary>package.json</summary>
+</blockquote>
+</details>
+
+<details><summary>npm</summary>
+<blockquote>
+
+<details><summary>package.json</summary>
 
  - \`cookie-parser ^1.4.5\`
  - \`express ~4.17.1\`
@@ -221,15 +275,24 @@ This repository currently has no open or pending branches.
  - \`dotenv 10.0.0\`
  - \`nodemon 2.0.14\`
 
-</details></ul>
-</details><details><summary>poetry</summary>
+</details>
 
-<ul><details><summary>pyproject.toml</summary>
+</blockquote>
+</details>
+
+<details><summary>poetry</summary>
+<blockquote>
+
+<details><summary>pyproject.toml</summary>
 
  - \`six <=1.3.0\`
 
-</details></ul>
-</details>"
+</details>
+
+</blockquote>
+</details>
+
+"
 `;
 
 exports[`workers/repository/dependency-dashboard ensureDependencyDashboard() checks detected dependencies section single base branch repo show default message in issues body when packageFiles is empty 1`] = `
@@ -241,7 +304,6 @@ This repository currently has no open or pending branches.
 
 None detected
 
-
 "
 `;
 
@@ -254,7 +316,6 @@ This repository currently has no open or pending branches.
 
 None detected
 
-
 "
 `;
 
@@ -281,7 +342,6 @@ These updates await pending status checks. To force their creation now, click th
 
 None detected
 
-
 "
 `;
 
@@ -294,7 +354,6 @@ This repository currently has no open or pending branches.
 
 None detected
 
-
 ---
 And this is a footer
 "
@@ -309,7 +368,6 @@ This repository currently has no open or pending branches.
 
 None detected
 
-
 ---
 And this is a footer for repository:test
 "
@@ -335,6 +393,5 @@ These updates are awaiting their schedule. Click on a checkbox to get an update
 
 None detected
 
-
 "
 `;
diff --git a/lib/workers/repository/dependency-dashboard.ts b/lib/workers/repository/dependency-dashboard.ts
index 634b91eb98..3c2fbcef16 100644
--- a/lib/workers/repository/dependency-dashboard.ts
+++ b/lib/workers/repository/dependency-dashboard.ts
@@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
 import is from '@sindresorhus/is';
 import { nameFromLevel } from 'bunyan';
 import { GlobalConfig } from '../../config/global';
@@ -21,7 +22,7 @@ function parseDashboardIssue(issueBody: string): DependencyDashboard {
   if (checked?.length) {
     const re = regEx(checkMatch);
     checked.forEach((check) => {
-      const [, type, branchName] = re.exec(check);
+      const [, type, branchName] = re.exec(check)!;
       dependencyDashboardChecks[branchName] = type;
     });
   }
@@ -48,7 +49,7 @@ export async function readDashboardBody(config: RenovateConfig): Promise<void> {
     const issue = await platform.findIssue(config.dependencyDashboardTitle);
     if (issue) {
       config.dependencyDashboardIssue = issue.number;
-      Object.assign(config, parseDashboardIssue(issue.body));
+      Object.assign(config, parseDashboardIssue(issue.body!));
     }
   }
 }
@@ -125,7 +126,7 @@ export async function ensureDependencyDashboard(
       );
     } else {
       logger.debug('Closing Dependency Dashboard');
-      await platform.ensureIssueClosing(config.dependencyDashboardTitle);
+      await platform.ensureIssueClosing(config.dependencyDashboardTitle!);
     }
     return;
   }
@@ -144,7 +145,7 @@ export async function ensureDependencyDashboard(
       );
     } else {
       logger.debug('Closing Dependency Dashboard');
-      await platform.ensureIssueClosing(config.dependencyDashboardTitle);
+      await platform.ensureIssueClosing(config.dependencyDashboardTitle!);
     }
     return;
   }
@@ -266,7 +267,7 @@ export async function ensureDependencyDashboard(
   ];
   let inProgress = branches.filter(
     (branch) =>
-      !otherRes.includes(branch.result) &&
+      !otherRes.includes(branch.result!) &&
       branch.prBlockedBy !== 'BranchAutomerge'
   );
   const otherBranches = inProgress.filter(
@@ -333,9 +334,9 @@ export async function ensureDependencyDashboard(
     );
     if (updatedIssue) {
       const { dependencyDashboardChecks } = parseDashboardIssue(
-        updatedIssue.body
+        updatedIssue.body!
       );
-      for (const branchName of Object.keys(config.dependencyDashboardChecks)) {
+      for (const branchName of Object.keys(config.dependencyDashboardChecks!)) {
         delete dependencyDashboardChecks[branchName];
       }
       for (const branchName of Object.keys(dependencyDashboardChecks)) {
@@ -355,7 +356,7 @@ export async function ensureDependencyDashboard(
     );
   } else {
     await platform.ensureIssue({
-      title: config.dependencyDashboardTitle,
+      title: config.dependencyDashboardTitle!,
       reuseTitle,
       body: issueBody,
       labels: config.dependencyDashboardLabels,
diff --git a/lib/workers/repository/package-files.ts b/lib/workers/repository/package-files.ts
index e16abdbcc4..c86553a830 100644
--- a/lib/workers/repository/package-files.ts
+++ b/lib/workers/repository/package-files.ts
@@ -31,34 +31,33 @@ export class PackageFiles {
     let deps = '';
 
     for (const [branch, packageFiles] of this.data) {
-      deps += pad ? `<details><summary>Branch ${branch}\n</summary>\n\n` : '';
+      deps += pad
+        ? `<details><summary>Branch ${branch}</summary>\n<blockquote>\n\n`
+        : '';
       if (packageFiles === null) {
         deps += none;
-        deps += pad ? '\n</details>\n\n' : '\n';
+        deps += pad ? '</blockquote>\n</details>\n\n' : '';
         continue;
       }
 
       const managers = Object.keys(packageFiles);
       if (managers.length === 0) {
         deps += none;
-        deps += pad ? '\n</details>\n\n' : '\n';
+        deps += pad ? '</blockquote>\n</details>\n\n' : '';
         continue;
       }
-
       for (const manager of managers) {
-        deps += `${
-          pad ? '\n<ul>' : ''
-        }<details><summary>${manager}</summary>\n\n`;
+        deps += `<details><summary>${manager}</summary>\n<blockquote>\n\n`;
         for (const packageFile of packageFiles[manager]) {
-          deps += `<ul><details><summary>${packageFile.packageFile}</summary>\n\n`;
+          deps += `<details><summary>${packageFile.packageFile}</summary>\n\n`;
           for (const dep of packageFile.deps) {
             deps += ` - \`${dep.depName} ${dep.currentValue}\`\n`;
           }
-          deps += '\n</details></ul>';
+          deps += '\n</details>\n\n';
         }
-        deps += `\n</details>${pad ? '</ul>' : ''}`;
+        deps += `</blockquote>\n</details>\n\n`;
       }
-      deps += pad ? '\n</details>\n\n' : '';
+      deps += pad ? '</blockquote>\n</details>\n\n' : '';
     }
 
     return title + deps;
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 22c7ecca3a..3e42df22a6 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -32,7 +32,6 @@
     "lib/workers/global/initialize.ts",
     "lib/workers/repository/cache.ts",
     "lib/workers/repository/changelog/index.ts",
-    "lib/workers/repository/dependency-dashboard.ts",
     "lib/workers/repository/error-config.ts",
     "lib/workers/repository/error.ts",
     "lib/workers/repository/extract/file-match.ts",
-- 
GitLab