refactor: remove a few Lodash usages & ESLint enforcement (#5807)

* refactor: remove some lodash usage

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* Enforce ESLint

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>

* More forbids

* Fixup

* Fix

* Fix website
This commit is contained in:
Joshua Chen 2021-10-28 12:48:58 +08:00 committed by GitHub
parent 4b2152a964
commit 7a6607cfa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 60 additions and 49 deletions

View file

@ -9,7 +9,7 @@ import fs from 'fs-extra';
import chalk from 'chalk';
import path from 'path';
import readingTime from 'reading-time';
import {compact, keyBy, mapValues} from 'lodash';
import {keyBy, mapValues} from 'lodash';
import {
PluginOptions,
BlogPost,
@ -267,7 +267,7 @@ export async function generateBlogPosts(
authorsMapPath: options.authorsMapPath,
});
const blogPosts: BlogPost[] = compact(
const blogPosts = (
await Promise.all(
blogSourceFiles.map(async (blogSourceFile: string) => {
try {
@ -287,8 +287,8 @@ export async function generateBlogPosts(
throw e;
}
}),
),
);
)
).filter(Boolean) as BlogPost[];
blogPosts.sort(
(a, b) => b.metadata.date.getTime() - a.metadata.date.getTime(),