mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-13 23:07:58 +02:00
chore: add cSpell for spell checking (#6456)
* chore: Add cSpell for spell checking * chore: exclude map files and remove dups * chore: exclude more binary files * chore: remove MD headings * Update .cspell.json * fix a few spellings * fix more * fix Signed-off-by: Joshua Chen <sidachen2003@gmail.com> * fix a few * oops Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
This commit is contained in:
parent
a41a5c328c
commit
521eb119a7
64 changed files with 852 additions and 142 deletions
|
@ -38,9 +38,9 @@ export default function extractMetadata(content: string): Data {
|
|||
// New line characters => to handle all operating systems.
|
||||
const lines = (both.header ?? '').split(/\r?\n/);
|
||||
for (let i = 0; i < lines.length - 1; i += 1) {
|
||||
const keyvalue = lines[i].split(':');
|
||||
const key = keyvalue[0].trim();
|
||||
let value = keyvalue.slice(1).join(':').trim();
|
||||
const keyValue = lines[i].split(':');
|
||||
const key = keyValue[0].trim();
|
||||
let value = keyValue.slice(1).join(':').trim();
|
||||
try {
|
||||
value = JSON.parse(value);
|
||||
} catch (err) {
|
||||
|
@ -51,7 +51,7 @@ export default function extractMetadata(content: string): Data {
|
|||
return {metadata, rawContent: both.content};
|
||||
}
|
||||
|
||||
// The new frontmatter parser need some special chars to
|
||||
// The new front matter parser need some special chars to
|
||||
export function shouldQuotifyFrontMatter([key, value]: [
|
||||
string,
|
||||
string,
|
||||
|
@ -67,7 +67,7 @@ export function shouldQuotifyFrontMatter([key, value]: [
|
|||
return true;
|
||||
}
|
||||
// TODO this is not ideal to have to maintain such a list of allowed chars
|
||||
// maybe we should quotify if graymatter throws instead?
|
||||
// maybe we should quotify if gray-matter throws instead?
|
||||
return !String(value).match(
|
||||
/^([\w .\-sàáâãäåçèéêëìíîïðòóôõöùúûüýÿ!;,=+_?'`&#()[\]§%€$])+$/,
|
||||
);
|
||||
|
|
|
@ -165,7 +165,7 @@ export default function transformer(file: string): string {
|
|||
return root.toSource();
|
||||
}
|
||||
|
||||
function getDefaultImportDeclarators(rootAst: Collection) {
|
||||
function getDefaultImportDeclarations(rootAst: Collection) {
|
||||
// var ... = require('y')
|
||||
return rootAst
|
||||
.find(VariableDeclarator, {
|
||||
|
@ -178,7 +178,7 @@ function getDefaultImportDeclarators(rootAst: Collection) {
|
|||
.filter((variableDeclarator) => !!variableDeclarator.value);
|
||||
}
|
||||
|
||||
function getNamedImportDeclarators(rootAst: Collection) {
|
||||
function getNamedImportDeclarations(rootAst: Collection) {
|
||||
// var ... = require('y').x
|
||||
return rootAst.find(VariableDeclarator, {
|
||||
init: {
|
||||
|
@ -192,9 +192,9 @@ function getNamedImportDeclarators(rootAst: Collection) {
|
|||
}
|
||||
|
||||
function getImportDeclaratorPaths(variableDeclaration: Collection) {
|
||||
const defaultImports = getDefaultImportDeclarators(variableDeclaration);
|
||||
const defaultImports = getDefaultImportDeclarations(variableDeclaration);
|
||||
|
||||
const namedImports = getNamedImportDeclarators(variableDeclaration);
|
||||
const namedImports = getNamedImportDeclarations(variableDeclaration);
|
||||
|
||||
return [...defaultImports.paths(), ...namedImports.paths()];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue