mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-23 05:57:05 +02:00
chore(v2): Fix more eslint errors (#2976)
This commit is contained in:
parent
3611c96f90
commit
6e43c9bd34
81 changed files with 375 additions and 237 deletions
|
@ -31,7 +31,7 @@ describe('blogFeed', () => {
|
|||
routeBasePath: 'blog',
|
||||
include: ['*.md', '*.mdx'],
|
||||
feedOptions: {
|
||||
type: feedType as any,
|
||||
type: feedType,
|
||||
copyright: 'Copyright',
|
||||
},
|
||||
} as PluginOptions,
|
||||
|
@ -62,7 +62,7 @@ describe('blogFeed', () => {
|
|||
routeBasePath: 'blog',
|
||||
include: ['*r*.md', '*.mdx'], // skip no-date.md - it won't play nice with snapshots
|
||||
feedOptions: {
|
||||
type: feedType as any,
|
||||
type: feedType,
|
||||
copyright: 'Copyright',
|
||||
},
|
||||
} as PluginOptions,
|
||||
|
|
|
@ -72,10 +72,10 @@ export async function generateBlogFeed(
|
|||
blogPosts.forEach((post) => {
|
||||
const {
|
||||
id,
|
||||
metadata: {title, permalink, date, description},
|
||||
metadata: {title: metadataTitle, permalink, date, description},
|
||||
} = post;
|
||||
feed.addItem({
|
||||
title,
|
||||
title: metadataTitle,
|
||||
id,
|
||||
link: normalizeUrl([siteUrl, permalink]),
|
||||
date,
|
||||
|
|
|
@ -205,9 +205,8 @@ export default function pluginContentBlog(
|
|||
label: tag,
|
||||
permalink,
|
||||
};
|
||||
} else {
|
||||
return tag;
|
||||
}
|
||||
return tag;
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -244,7 +243,7 @@ export default function pluginContentBlog(
|
|||
`~blog/${path.relative(dataDir, source)}`;
|
||||
const {addRoute, createData} = actions;
|
||||
const {
|
||||
blogPosts,
|
||||
blogPosts: loadedBlogPosts,
|
||||
blogListPaginated,
|
||||
blogTags,
|
||||
blogTagsListPath,
|
||||
|
@ -254,7 +253,7 @@ export default function pluginContentBlog(
|
|||
|
||||
// Create routes for blog entries.
|
||||
await Promise.all(
|
||||
blogPosts.map(async (blogPost) => {
|
||||
loadedBlogPosts.map(async (blogPost) => {
|
||||
const {id, metadata} = blogPost;
|
||||
await createData(
|
||||
// Note that this created data path must be in sync with
|
||||
|
@ -292,12 +291,11 @@ export default function pluginContentBlog(
|
|||
exact: true,
|
||||
modules: {
|
||||
items: items.map((postID) => {
|
||||
const metadata = blogItemsToMetadata[postID];
|
||||
// To tell routes.js this is an import and not a nested object to recurse.
|
||||
return {
|
||||
content: {
|
||||
__import: true,
|
||||
path: metadata.source,
|
||||
path: blogItemsToMetadata[postID].source,
|
||||
query: {
|
||||
truncated: true,
|
||||
},
|
||||
|
@ -481,22 +479,26 @@ export default function pluginContentBlog(
|
|||
};
|
||||
const headTags: HtmlTags = [];
|
||||
|
||||
feedTypes.map((feedType) => {
|
||||
feedTypes.forEach((feedType) => {
|
||||
const feedConfig = feedsConfig[feedType] || {};
|
||||
|
||||
if (!feedsConfig) {
|
||||
return;
|
||||
}
|
||||
|
||||
const {type, path, title} = feedConfig;
|
||||
const {type, path: feedConfigPath, title: feedConfigTitle} = feedConfig;
|
||||
|
||||
headTags.push({
|
||||
tagName: 'link',
|
||||
attributes: {
|
||||
rel: 'alternate',
|
||||
type,
|
||||
href: normalizeUrl([baseUrl, options.routeBasePath, path]),
|
||||
title,
|
||||
href: normalizeUrl([
|
||||
baseUrl,
|
||||
options.routeBasePath,
|
||||
feedConfigPath,
|
||||
]),
|
||||
title: feedConfigTitle,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue