mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
refactor: reduce number of leaked anys (#7465)
This commit is contained in:
parent
6e62bba30f
commit
89b0fff128
39 changed files with 121 additions and 89 deletions
|
@ -53,7 +53,7 @@ async function createVersionedSidebarFile({
|
|||
|
||||
// Tests depend on non-default export for mocking.
|
||||
export async function cliDocsVersionCommand(
|
||||
version: string,
|
||||
version: unknown,
|
||||
{id: pluginId, path: docsPath, sidebarPath}: PluginOptions,
|
||||
{siteDir, i18n}: LoadContext,
|
||||
): Promise<void> {
|
||||
|
@ -70,7 +70,7 @@ export async function cliDocsVersionCommand(
|
|||
}
|
||||
|
||||
// Load existing versions.
|
||||
let versions = [];
|
||||
let versions: string[] = [];
|
||||
const versionsJSONFile = getVersionsFilePath(siteDir, pluginId);
|
||||
if (await fs.pathExists(versionsJSONFile)) {
|
||||
versions = await fs.readJSON(versionsJSONFile);
|
||||
|
|
|
@ -100,7 +100,7 @@ export default async function pluginContentDocs(
|
|||
.command(command)
|
||||
.arguments('<version>')
|
||||
.description(commandDescription)
|
||||
.action((version) => {
|
||||
.action((version: unknown) => {
|
||||
cliDocsVersionCommand(version, options, context);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -98,7 +98,7 @@ const OptionsSchema = Joi.object<PluginOptions>({
|
|||
Joi.function(),
|
||||
// Convert boolean values to functions
|
||||
Joi.alternatives().conditional(Joi.boolean(), {
|
||||
then: Joi.custom((val) =>
|
||||
then: Joi.custom((val: boolean) =>
|
||||
val ? DefaultNumberPrefixParser : DisabledNumberPrefixParser,
|
||||
),
|
||||
}),
|
||||
|
|
|
@ -95,7 +95,7 @@ async function readVersionsFile(
|
|||
): Promise<string[] | null> {
|
||||
const versionsFilePath = getVersionsFilePath(siteDir, pluginId);
|
||||
if (await fs.pathExists(versionsFilePath)) {
|
||||
const content = await fs.readJSON(versionsFilePath);
|
||||
const content: unknown = await fs.readJSON(versionsFilePath);
|
||||
validateVersionNames(content);
|
||||
return content;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue