mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 14:06:59 +02:00
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:
parent
b8ccb869f1
commit
aa446b7a9c
167 changed files with 1157 additions and 960 deletions
|
@ -83,9 +83,9 @@ function normalizeFrontMatterAuthors(
|
|||
authorInput: string | BlogPostFrontMatterAuthor,
|
||||
): BlogPostFrontMatterAuthor {
|
||||
if (typeof authorInput === 'string') {
|
||||
// Technically, we could allow users to provide an author's name here
|
||||
// IMHO it's better to only support keys here
|
||||
// Reason: a typo in a key would fallback to becoming a name and may end-up un-noticed
|
||||
// Technically, we could allow users to provide an author's name here, but
|
||||
// we only support keys, otherwise, a typo in a key would fallback to
|
||||
// becoming a name and may end up unnoticed
|
||||
return {key: authorInput};
|
||||
}
|
||||
return authorInput;
|
||||
|
@ -137,7 +137,8 @@ export function getBlogPostAuthors(params: AuthorsParam): Author[] {
|
|||
const authors = getFrontMatterAuthors(params);
|
||||
|
||||
if (authorLegacy) {
|
||||
// Technically, we could allow mixing legacy/authors front matter, 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' front matter in priority.
|
||||
|
|
|
@ -82,11 +82,10 @@ export function parseBlogFileName(
|
|||
const slugDate = dateString.replace(/-/g, '/');
|
||||
const slug = `/${slugDate}/${folder}${text}`;
|
||||
return {date, text, slug};
|
||||
} else {
|
||||
const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');
|
||||
const slug = `/${text}`;
|
||||
return {date: undefined, text, slug};
|
||||
}
|
||||
const text = blogSourceRelative.replace(/(\/index)?\.mdx?$/, '');
|
||||
const slug = `/${text}`;
|
||||
return {date: undefined, text, slug};
|
||||
}
|
||||
|
||||
function formatBlogPostDate(locale: string, date: Date): string {
|
||||
|
|
|
@ -322,7 +322,8 @@ export default async function pluginContentBlog(
|
|||
modules: {
|
||||
sidebar: aliasedSource(sidebarProp),
|
||||
items: items.map((postID) =>
|
||||
// To tell routes.js this is an import and not a nested object to recurse.
|
||||
// To tell routes.js this is an import and not a nested object
|
||||
// to recurse.
|
||||
({
|
||||
content: {
|
||||
__import: true,
|
||||
|
@ -485,7 +486,8 @@ export default async function pluginContentBlog(
|
|||
// Blog posts title are rendered separately
|
||||
removeContentTitle: true,
|
||||
|
||||
// Assets allow to convert some relative images paths to require() calls
|
||||
// Assets allow to convert some relative images paths to
|
||||
// require() calls
|
||||
createAssets: ({
|
||||
frontMatter,
|
||||
metadata,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue