mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-27 11:32:48 +00:00
remove problematic @ts-expect-error
This commit is contained in:
parent
9088efb306
commit
0da59368fc
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue