Initial work

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Josh-Cena 2021-06-17 17:06:39 +08:00
parent 1b0acc5547
commit 6d3d416f58
No known key found for this signature in database
GPG key ID: C37145B818BDB68F
5 changed files with 15 additions and 9 deletions

View file

@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
/* eslint-disable camelcase */
// eslint-disable-next-line spaced-comment
/// <reference types="@docusaurus/module-type-aliases" />

View file

@ -107,7 +107,9 @@ function selectPluralMessage(
}
}
export function usePluralForm() {
export function usePluralForm(): {
selectMessage: (count: number, pluralMessages: string) => string;
} {
const localePluralForm = useLocalePluralForms();
return {
selectMessage: (count: number, pluralMessages: string): string => {

View file

@ -35,7 +35,7 @@ export const logValidationBugReportHint = (): void => {
);
};
export function printWarning(warning?: Joi.ValidationError) {
export function printWarning(warning?: Joi.ValidationError): void {
if (warning) {
const warningMessages = warning.details
.map(({message}) => message)

View file

@ -36,17 +36,17 @@ export function createExcerpt(fileString: string): string | undefined {
// Remove HTML tags.
.replace(/<[^>]*>/g, '')
// Remove Title headers
.replace(/^\#\s*([^#]*)\s*\#?/gm, '')
.replace(/^#\s*([^#]*)\s*#?/gm, '')
// Remove Markdown + ATX-style headers
.replace(/^\#{1,6}\s*([^#]*)\s*(\#{1,6})?/gm, '$1')
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
// Remove emphasis and strikethroughs.
.replace(/([\*_~]{1,3})(\S.*?\S{0,1})\1/g, '$2')
.replace(/([*_~]{1,3})(\S.*?\S{0,1})\1/g, '$2')
// Remove images.
.replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
.replace(/!\[(.*?)\][[(].*?[\])]/g, '$1')
// Remove footnotes.
.replace(/\[\^.+?\](\: .*?$)?/g, '')
.replace(/\[\^.+?\](: .*?$)?/g, '')
// Remove inline links.
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
.replace(/\[(.*?)\][[(].*?[\])]/g, '$1')
// Remove inline code.
.replace(/`(.+?)`/g, '$1')
// Remove blockquotes.

View file

@ -29,7 +29,10 @@ export function getDefaultLocaleConfig(locale: string): I18nLocaleConfig {
};
}
export function shouldWarnAboutNodeVersion(version: number, locales: string[]) {
export function shouldWarnAboutNodeVersion(
version: number,
locales: string[],
): boolean {
const isOnlyEnglish = locales.length === 1 && locales.includes('en');
const isOlderNodeVersion = version < 14;
return isOlderNodeVersion && !isOnlyEnglish;