mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 19:46:57 +02:00
chore(v2): Fix a lot of eslint warnings (#2972)
This commit is contained in:
parent
4aa77651d3
commit
3611c96f90
46 changed files with 145 additions and 130 deletions
|
@ -19,7 +19,7 @@ import {
|
|||
} from '@docusaurus/utils';
|
||||
import {LoadContext} from '@docusaurus/types';
|
||||
|
||||
export function truncate(fileString: string, truncateMarker: RegExp) {
|
||||
export function truncate(fileString: string, truncateMarker: RegExp): string {
|
||||
return fileString.split(truncateMarker, 1).shift()!;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ function toUrl({date, link}: DateLink) {
|
|||
export async function generateBlogFeed(
|
||||
context: LoadContext,
|
||||
options: PluginOptions,
|
||||
) {
|
||||
): Promise<Feed | null> {
|
||||
if (!options.feedOptions) {
|
||||
throw new Error(
|
||||
'Invalid options - `feedOptions` is not expected to be null.',
|
||||
|
@ -76,7 +76,7 @@ export async function generateBlogFeed(
|
|||
} = post;
|
||||
feed.addItem({
|
||||
title,
|
||||
id: id,
|
||||
id,
|
||||
link: normalizeUrl([siteUrl, permalink]),
|
||||
date,
|
||||
description,
|
||||
|
@ -90,7 +90,7 @@ export async function generateBlogPosts(
|
|||
blogDir: string,
|
||||
{siteConfig, siteDir}: LoadContext,
|
||||
options: PluginOptions,
|
||||
) {
|
||||
): Promise<BlogPost[]> {
|
||||
const {
|
||||
include,
|
||||
routeBasePath,
|
||||
|
@ -181,14 +181,16 @@ export function linkify(
|
|||
siteDir: string,
|
||||
blogPath: string,
|
||||
blogPosts: BlogPost[],
|
||||
) {
|
||||
): string {
|
||||
let fencedBlock = false;
|
||||
const lines = fileContent.split('\n').map((line) => {
|
||||
if (line.trim().startsWith('```')) {
|
||||
fencedBlock = !fencedBlock;
|
||||
}
|
||||
|
||||
if (fencedBlock) return line;
|
||||
if (fencedBlock) {
|
||||
return line;
|
||||
}
|
||||
|
||||
let modifiedLine = line;
|
||||
const mdRegex = /(?:(?:\]\()|(?:\]:\s?))(?!https)([^'")\]\s>]+\.mdx?)/g;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue