mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 16:17:25 +02:00
chore(v2): Fix linter warnings (#4442)
* chore(v2): Fix linter warnings 223 warnings to 145 warnings * Remove explicit type annotations * Do not prefetch when targetLink == null
This commit is contained in:
parent
f041a37622
commit
5e73c72f26
39 changed files with 146 additions and 71 deletions
|
@ -26,7 +26,7 @@ const fileHash = new Map();
|
|||
export async function generate(
|
||||
generatedFilesDir: string,
|
||||
file: string,
|
||||
content: any,
|
||||
content: string,
|
||||
skipCache: boolean = process.env.NODE_ENV === 'production',
|
||||
): Promise<void> {
|
||||
const filepath = path.join(generatedFilesDir, file);
|
||||
|
@ -57,11 +57,13 @@ export async function generate(
|
|||
}
|
||||
}
|
||||
|
||||
export function objectWithKeySorted(obj: {[index: string]: any}) {
|
||||
export function objectWithKeySorted<T>(
|
||||
obj: Record<string, T>,
|
||||
): Record<string, T> {
|
||||
// https://github.com/lodash/lodash/issues/1459#issuecomment-460941233
|
||||
return Object.keys(obj)
|
||||
.sort()
|
||||
.reduce((acc: any, key: string) => {
|
||||
.reduce((acc: Record<string, T>, key: string) => {
|
||||
acc[key] = obj[key];
|
||||
return acc;
|
||||
}, {});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue