chore: tighten ESLint config (#6931)

* chore: tighten ESLint config

* more refactor

* refactor push

* fix
This commit is contained in:
Joshua Chen 2022-03-17 17:59:41 +08:00 committed by GitHub
parent f70ddf7e69
commit cc0bceab9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 177 additions and 193 deletions

View file

@ -745,9 +745,7 @@ describe('site with custom sidebar items generator', () => {
}
it('sidebarItemsGenerator is called with appropriate data', async () => {
const customSidebarItemsGeneratorMock = jest.fn(
async (_arg: SidebarItemsGeneratorOptionArgs) => [],
);
const customSidebarItemsGeneratorMock = jest.fn(async () => []);
const {siteDir} = await loadSite(customSidebarItemsGeneratorMock);
const generatorArg: SidebarItemsGeneratorOptionArgs =

View file

@ -16,7 +16,5 @@ export default function markdownLoader(
const fileString = source;
const callback = this.async();
const options = this.getOptions();
return (
callback && callback(null, linkify(fileString, this.resourcePath, options))
);
return callback?.(null, linkify(fileString, this.resourcePath, options));
}

View file

@ -118,26 +118,24 @@ function getSidebarTranslationFileContent(
},
]);
if (category.link) {
if (category.link.type === 'generated-index') {
if (category.link.title) {
entries.push([
`sidebar.${sidebarName}.category.${category.label}.link.generated-index.title`,
{
message: category.link.title,
description: `The generated-index page title for category ${category.label} in sidebar ${sidebarName}`,
},
]);
}
if (category.link.description) {
entries.push([
`sidebar.${sidebarName}.category.${category.label}.link.generated-index.description`,
{
message: category.link.description,
description: `The generated-index page description for category ${category.label} in sidebar ${sidebarName}`,
},
]);
}
if (category.link?.type === 'generated-index') {
if (category.link.title) {
entries.push([
`sidebar.${sidebarName}.category.${category.label}.link.generated-index.title`,
{
message: category.link.title,
description: `The generated-index page title for category ${category.label} in sidebar ${sidebarName}`,
},
]);
}
if (category.link.description) {
entries.push([
`sidebar.${sidebarName}.category.${category.label}.link.generated-index.description`,
{
message: category.link.description,
description: `The generated-index page description for category ${category.label} in sidebar ${sidebarName}`,
},
]);
}
}