mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-26 04:57:50 +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
packages/docusaurus-utils-validation/src
|
@ -8,7 +8,7 @@
|
|||
import Joi from './Joi';
|
||||
|
||||
// Enhance the default Joi.string() type so that it can convert number to strings
|
||||
// If user use frontmatter "tag: 2021", we shouldn't need to ask the user to write "tag: '2021'"
|
||||
// If user use front matter "tag: 2021", we shouldn't need to ask the user to write "tag: '2021'"
|
||||
// Also yaml tries to convert patterns like "2019-01-01" to dates automatically
|
||||
// see https://github.com/facebook/docusaurus/issues/4642
|
||||
// see https://github.com/sideway/joi/issues/1442#issuecomment-823997884
|
||||
|
|
|
@ -32,7 +32,7 @@ describe('validateFrontMatter', () => {
|
|||
validateFrontMatter(frontMatter, schema),
|
||||
).toThrowErrorMatchingInlineSnapshot(`"\\"test\\" must be a string"`);
|
||||
expect(consoleError).toHaveBeenCalledWith(
|
||||
expect.stringContaining('The following frontmatter'),
|
||||
expect.stringContaining('The following front matter'),
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe('validateFrontMatter', () => {
|
|||
});
|
||||
|
||||
// Fix Yaml trying to convert strings to numbers automatically
|
||||
// We only want to deal with a single type in the final frontmatter (not string | number)
|
||||
// We only want to deal with a single type in the final front matter (not string | number)
|
||||
test('should convert number values to string when string schema', () => {
|
||||
const schema = Joi.object<{test: string}>({
|
||||
test: JoiFrontMatter.string(),
|
||||
|
@ -60,7 +60,7 @@ describe('validateFrontMatter', () => {
|
|||
});
|
||||
|
||||
// Helps to fix Yaml trying to convert strings to dates automatically
|
||||
// We only want to deal with a single type in the final frontmatter (not string | Date)
|
||||
// We only want to deal with a single type in the final front matter (not string | Date)
|
||||
test('should convert date values when string schema', () => {
|
||||
const schema = Joi.object<{test: string}>({
|
||||
test: JoiFrontMatter.string(),
|
||||
|
|
|
@ -112,7 +112,7 @@ export function validateFrontMatter<T>(
|
|||
|
||||
logValidationBugReportHint();
|
||||
|
||||
logger.error`The following frontmatter:
|
||||
logger.error`The following front matter:
|
||||
${logger.yellow(frontMatterString)}
|
||||
contains invalid values for field(s): ${logger.yellow(invalidFields)}.
|
||||
${errorDetails.map(({message}) => message)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue