chore: clean up ESLint config, enable a few rules (#6514)

* chore: clean up ESLint config, enable a few rules

* enable max-len for comments

* fix build
This commit is contained in:
Joshua Chen 2022-01-31 10:31:24 +08:00 committed by GitHub
parent b8ccb869f1
commit aa446b7a9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
167 changed files with 1157 additions and 960 deletions

View file

@ -51,7 +51,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
if (!fencedBlock) {
fencedBlock = true;
[lastCodeFence] = line.trim().match(/^`+/)!;
// If we are in a ````-fenced block, all ``` would be plain text instead of fences
// If we are in a ````-fenced block, all ``` would be plain text instead
// of fences
} else if (line.trim().match(/^`+/)![0].length >= lastCodeFence.length) {
fencedBlock = false;
}
@ -62,7 +63,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
let modifiedLine = line;
// Replace inline-style links or reference-style links e.g:
// This is [Document 1](doc1.md) -> we replace this doc1.md with correct link
// This is [Document 1](doc1.md) -> we replace this doc1.md with correct
// ink
// [doc1]: doc1.md -> we replace this doc1.md with correct link
const mdRegex =
/(?:(?:\]\()|(?:\]:\s?))(?!https?:\/\/|@site\/)([^'")\]\s>]+\.mdx?)/g;
@ -86,7 +88,8 @@ export function replaceMarkdownLinks<T extends ContentPaths>({
: undefined;
if (permalink) {
// MDX won't be happy if the permalink contains a space, we need to convert it to %20
// MDX won't be happy if the permalink contains a space, we need to
// convert it to %20
const encodedPermalink = permalink
.split('/')
.map((part) => part.replace(/\s/g, '%20'))