mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
refactor: better typing + remove unnecessary eslint-disable (#5335)
* Initial work Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Fix a few errors Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Restore default value Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Update docs Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Use custom route config Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Address a few suggestions Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Revert logo change Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Restore key Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Oops Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove use of any Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove eslint-disable Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Put type reference back Signed-off-by: Josh-Cena <sidachen2003@gmail.com> * Remove Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
parent
0c0c14120e
commit
ee6ebc4877
30 changed files with 127 additions and 122 deletions
|
@ -85,7 +85,6 @@ function createVersionedSidebarFile({
|
|||
}
|
||||
|
||||
// Tests depend on non-default export for mocking.
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function cliDocsVersionCommand(
|
||||
version: string | null | undefined,
|
||||
siteDir: string,
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
import {
|
||||
JoiFrontMatter as Joi, // Custom instance for frontmatter
|
||||
URISchema,
|
||||
|
|
|
@ -130,9 +130,8 @@ function doProcessDocMetadata({
|
|||
custom_edit_url: customEditURL,
|
||||
|
||||
// Strip number prefixes by default (01-MyFolder/01-MyDoc.md => MyFolder/MyDoc) by default,
|
||||
// but allow to disable this behavior with frontmatterr
|
||||
// eslint-disable-next-line camelcase
|
||||
parse_number_prefixes = true,
|
||||
// but allow to disable this behavior with frontmatter
|
||||
parse_number_prefixes: parseNumberPrefixes = true,
|
||||
} = frontMatter;
|
||||
|
||||
// ex: api/plugins/myDoc -> myDoc
|
||||
|
@ -146,8 +145,7 @@ function doProcessDocMetadata({
|
|||
// ex: myDoc -> .
|
||||
const sourceDirName = path.dirname(source);
|
||||
|
||||
// eslint-disable-next-line camelcase
|
||||
const {filename: unprefixedFileName, numberPrefix} = parse_number_prefixes
|
||||
const {filename: unprefixedFileName, numberPrefix} = parseNumberPrefixes
|
||||
? options.numberPrefixParser(sourceFileNameWithoutExtension)
|
||||
: {filename: sourceFileNameWithoutExtension, numberPrefix: undefined};
|
||||
|
||||
|
@ -175,8 +173,7 @@ function doProcessDocMetadata({
|
|||
return undefined;
|
||||
}
|
||||
// Eventually remove the number prefixes from intermediate directories
|
||||
// eslint-disable-next-line camelcase
|
||||
return parse_number_prefixes
|
||||
return parseNumberPrefixes
|
||||
? stripPathNumberPrefixes(sourceDirName, options.numberPrefixParser)
|
||||
: sourceDirName;
|
||||
}
|
||||
|
@ -203,7 +200,7 @@ function doProcessDocMetadata({
|
|||
baseID,
|
||||
dirName: sourceDirName,
|
||||
frontmatterSlug: frontMatter.slug,
|
||||
stripDirNumberPrefixes: parse_number_prefixes,
|
||||
stripDirNumberPrefixes: parseNumberPrefixes,
|
||||
numberPrefixParser: options.numberPrefixParser,
|
||||
});
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
declare module '@docusaurus/plugin-content-docs-types' {
|
||||
type VersionBanner = import('./types').VersionBanner;
|
||||
type GlobalDataVersion = import('./types').GlobalVersion;
|
||||
|
@ -64,8 +62,10 @@ declare module '@theme/DocItem' {
|
|||
readonly title: string;
|
||||
readonly image?: string;
|
||||
readonly keywords?: readonly string[];
|
||||
/* eslint-disable camelcase */
|
||||
readonly hide_title?: boolean;
|
||||
readonly hide_table_of_contents?: boolean;
|
||||
/* eslint-enable camelcase */
|
||||
};
|
||||
|
||||
export type Metadata = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue