From 0da59368fc96c0de42e72ba449ccf806cae9d649 Mon Sep 17 00:00:00 2001
From: sebastienlorber <lorber.sebastien@gmail.com>
Date: Fri, 5 Jan 2024 18:16:01 +0100
Subject: [PATCH] remove problematic @ts-expect-error

---
 .../docusaurus/src/server/configValidation.ts | 53 +++++++++----------
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/packages/docusaurus/src/server/configValidation.ts b/packages/docusaurus/src/server/configValidation.ts
index eafabc3cedad..13f554512c0a 100644
--- a/packages/docusaurus/src/server/configValidation.ts
+++ b/packages/docusaurus/src/server/configValidation.ts
@@ -88,24 +88,22 @@ export const DEFAULT_CONFIG: Pick<
 };
 
 function createPluginSchema(theme: boolean) {
-  return (
-    Joi.alternatives()
-      .try(
-        Joi.function(),
-        Joi.array()
-          .ordered(Joi.function().required(), Joi.object().required())
-          .length(2),
-        Joi.string(),
-        Joi.array()
-          .ordered(Joi.string().required(), Joi.object().required())
-          .length(2),
-        Joi.any().valid(false, null),
-      )
-      // @ts-expect-error: bad lib def, doesn't recognize an array of reports
-      .error((errors) => {
-        errors.forEach((error) => {
-          const validConfigExample = theme
-            ? `Example valid theme config:
+  return Joi.alternatives()
+    .try(
+      Joi.function(),
+      Joi.array()
+        .ordered(Joi.function().required(), Joi.object().required())
+        .length(2),
+      Joi.string(),
+      Joi.array()
+        .ordered(Joi.string().required(), Joi.object().required())
+        .length(2),
+      Joi.any().valid(false, null),
+    )
+    .error((errors) => {
+      errors.forEach((error) => {
+        const validConfigExample = theme
+          ? `Example valid theme config:
 {
   themes: [
     ["@docusaurus/theme-classic",options],
@@ -115,7 +113,7 @@ function createPluginSchema(theme: boolean) {
     [function myTheme() { },options]
   ],
 };`
-            : `Example valid plugin config:
+          : `Example valid plugin config:
 {
   plugins: [
     ["@docusaurus/plugin-content-docs",options],
@@ -126,17 +124,16 @@ function createPluginSchema(theme: boolean) {
   ],
 };`;
 
-          error.message = ` => Bad Docusaurus ${
-            theme ? 'theme' : 'plugin'
-          } value ${error.path.reduce((acc, cur) =>
-            typeof cur === 'string' ? `${acc}.${cur}` : `${acc}[${cur}]`,
-          )}.
+        error.message = ` => Bad Docusaurus ${
+          theme ? 'theme' : 'plugin'
+        } value ${error.path.reduce((acc, cur) =>
+          typeof cur === 'string' ? `${acc}.${cur}` : `${acc}[${cur}]`,
+        )}.
 ${validConfigExample}
 `;
-        });
-        return errors;
-      })
-  );
+      });
+      return errors;
+    });
 }
 
 const PluginSchema = createPluginSchema(false);