style/chore(eslint): enforce new rules (#8040)

* style: prefer object shorthand syntax
* refactor: prefer Array#map over Array#forEach
* style: prefer arrow callback
* chore(eslint): update rules
* style: auto fix by eslint
This commit is contained in:
Sukka
2021-08-17 22:23:23 +08:00
committed by GitHub
parent 6e3b58ed1d
commit d82847f541
667 changed files with 1351 additions and 1411 deletions

View File

@@ -13,14 +13,14 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: `${name}`,
link: link,
link,
item: ctx.params.caty
? $('#docContent .content h3')
.map((_, item) => {
item = $(item);
const title = item.text().replace(/[\s|#]/g, '');
return {
title: title,
title,
description: item.next().html(),
pubDate: new Date(new RegExp(/\d{4}.\d{2}.\d{2}/).exec(title) + ' GMT+8').toUTCString(),
link: link + item.find('a.header-anchor').attr('href'),
@@ -35,10 +35,10 @@ module.exports = async (ctx) => {
.text()
.replace(/[\s|#]/g, '');
return {
title: title,
title,
description: $(item).html(),
pubDate: new Date(new RegExp(/\d{4}.\d{2}.\d{2}/).exec(title) + ' GMT+8').toUTCString(),
link: link,
link,
};
})
.get(),