chore(v2): Fix more eslint errors (#2976)

This commit is contained in:
Sam Zhou 2020-06-21 03:09:00 -04:00 committed by GitHub
parent 3611c96f90
commit 6e43c9bd34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 375 additions and 237 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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,
},
});
});