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:
Nick Schonning 2022-01-24 20:40:02 -05:00 committed by GitHub
parent a41a5c328c
commit 521eb119a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 852 additions and 142 deletions

View file

@ -31,7 +31,7 @@ describe('getBlogPostAuthors', () => {
).toEqual([]);
});
test('can read author from legacy frontmatter', () => {
test('can read author from legacy front matter', () => {
expect(
getBlogPostAuthors({
frontMatter: {
@ -251,7 +251,7 @@ describe('getBlogPostAuthors', () => {
`);
});
test('throw when mixing legacy/new authors frontmatter', () => {
test('throw when mixing legacy/new authors front matter', () => {
expect(() =>
getBlogPostAuthors({
frontMatter: {
@ -261,8 +261,8 @@ describe('getBlogPostAuthors', () => {
authorsMap: undefined,
}),
).toThrowErrorMatchingInlineSnapshot(`
"To declare blog post authors, use the 'authors' FrontMatter in priority.
Don't mix 'authors' with other existing 'author_*' FrontMatter. Choose one or the other, not both at the same time."
"To declare blog post authors, use the 'authors' front matter in priority.
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time."
`);
expect(() =>
@ -274,8 +274,8 @@ describe('getBlogPostAuthors', () => {
authorsMap: {slorber: {name: 'Sébastien Lorber'}},
}),
).toThrowErrorMatchingInlineSnapshot(`
"To declare blog post authors, use the 'authors' FrontMatter in priority.
Don't mix 'authors' with other existing 'author_*' FrontMatter. Choose one or the other, not both at the same time."
"To declare blog post authors, use the 'authors' front matter in priority.
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time."
`);
});
});

View file

@ -47,7 +47,7 @@ function testField(params: {
// eslint-disable-next-line jest/no-jasmine-globals
fail(
new Error(
`Blog frontmatter is expected to be rejected, but was accepted successfully:\n ${JSON.stringify(
`Blog front matter is expected to be rejected, but was accepted successfully:\n ${JSON.stringify(
frontMatter,
null,
2,
@ -105,8 +105,8 @@ describe('validateBlogPostFrontMatter id', () => {
});
});
describe('validateBlogPostFrontMatter handles legacy/new author frontmatter', () => {
test('allow legacy author frontmatter', () => {
describe('validateBlogPostFrontMatter handles legacy/new author front matter', () => {
test('allow legacy author front matter', () => {
const frontMatter: BlogPostFrontMatter = {
author: 'Sebastien',
author_url: 'https://sebastienlorber.com',
@ -116,7 +116,7 @@ describe('validateBlogPostFrontMatter handles legacy/new author frontmatter', ()
expect(validateBlogPostFrontMatter(frontMatter)).toEqual(frontMatter);
});
test('allow new authors frontmatter', () => {
test('allow new authors front matter', () => {
const frontMatter: BlogPostFrontMatter = {
authors: [
'slorber',

View file

@ -54,7 +54,7 @@ type AuthorsParam = {
authorsMap: AuthorsMap | undefined;
};
// Legacy v1/early-v2 frontmatter fields
// Legacy v1/early-v2 front matter fields
// We may want to deprecate those in favor of using only frontMatter.authors
function getFrontMatterAuthorLegacy(
frontMatter: BlogPostFrontMatter,
@ -123,7 +123,7 @@ ${Object.keys(authorsMap)
function toAuthor(frontMatterAuthor: BlogPostFrontMatterAuthor): Author {
return {
// Author def from authorsMap can be locally overridden by frontmatter
// Author def from authorsMap can be locally overridden by front matter
...getAuthorsMapAuthor(frontMatterAuthor.key),
...frontMatterAuthor,
};
@ -137,11 +137,11 @@ export function getBlogPostAuthors(params: AuthorsParam): Author[] {
const authors = getFrontMatterAuthors(params);
if (authorLegacy) {
// Technically, we could allow mixing legacy/authors frontmatter, but do we really want to?
// Technically, we could allow mixing legacy/authors front matter, but do we really want to?
if (authors.length > 0) {
throw new Error(
`To declare blog post authors, use the 'authors' FrontMatter in priority.
Don't mix 'authors' with other existing 'author_*' FrontMatter. Choose one or the other, not both at the same time.`,
`To declare blog post authors, use the 'authors' front matter in priority.
Don't mix 'authors' with other existing 'author_*' front matter. Choose one or the other, not both at the same time.`,
);
}
return [authorLegacy];

View file

@ -6,7 +6,7 @@
*/
import {
JoiFrontMatter as Joi, // Custom instance for frontmatter
JoiFrontMatter as Joi, // Custom instance for front matter
URISchema,
validateFrontMatter,
FrontMatterTagsSchema,
@ -35,7 +35,7 @@ const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
draft: Joi.boolean(),
date: Joi.date().raw(),
// New multi-authors frontmatter:
// New multi-authors front matter:
authors: Joi.alternatives()
.try(
Joi.string(),
@ -50,7 +50,7 @@ const BlogFrontMatterSchema = Joi.object<BlogPostFrontMatter>({
.messages({
'alternatives.match': FrontMatterAuthorErrorMessage,
}),
// Legacy author frontmatter
// Legacy author front matter
author: Joi.string(),
author_title: Joi.string(),
author_url: URISchema,

View file

@ -30,11 +30,11 @@ declare module '@docusaurus/plugin-content-blog' {
tags?: FrontMatterTag[];
slug?: string;
draft?: boolean;
date?: Date | string; // Yaml automagically convert some string patterns as Date, but not all
date?: Date | string; // Yaml automatically convert some string patterns as Date, but not all
authors?: BlogPostFrontMatterAuthors;
// We may want to deprecate those older author frontmatter fields later:
// We may want to deprecate those older author front matter fields later:
author?: string;
author_title?: string;
author_url?: string;