Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Nov 16, 2023
1 parent 4b6f49f commit 434eec2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 34 deletions.
9 changes: 3 additions & 6 deletions src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ class controllers {

register(controller) {
try {
return require(path.join(
__dirname,
'../',
'./src/controllers',
controller,
))
return require(
path.join(__dirname, '../', './src/controllers', controller),
)
} catch (e) {
logger.error(chalk.red(e))
// mail.error(e)
Expand Down
16 changes: 6 additions & 10 deletions src/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ class Cron {
const dir = fs.readdirSync(path.join(__dirname, '../', './src/crons'))
if (isArray) {
await dir.forEach((item, index, input) => {
crons[index] = require(path.join(
__dirname,
'../',
'./src/crons/' + item,
))
crons[index] = require(
path.join(__dirname, '../', './src/crons/' + item),
)
})
} else {
await dir.forEach((item, index, input) => {
crons[item.substring(0, item.length - 3)] = require(path.join(
__dirname,
'../',
'./src/crons/' + item,
))
crons[item.substring(0, item.length - 3)] = require(
path.join(__dirname, '../', './src/crons/' + item),
)
})
}
return crons
Expand Down
9 changes: 3 additions & 6 deletions src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,9 @@ class db {
return this[model]
} else {
// Register Model
const modelArray = require(path.join(
__dirname,
'../',
'./src/models/databases',
model,
))
const modelArray = require(
path.join(__dirname, '../', './src/models/databases', model),
)
this[model] = this.sequelize.define(model, modelArray[0], modelArray[1])
return this[model]
}
Expand Down
7 changes: 3 additions & 4 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ module.exports = {
let middlewares = require(path.join(__dirname, '../adapter/plugins'))
checkMiddlewaresFileValid(middlewares)
if (isDev) {
const devMiddlewares = require(path.join(
__dirname,
'../adapter/plugins.dev',
))
const devMiddlewares = require(
path.join(__dirname, '../adapter/plugins.dev'),
)
checkMiddlewaresFileValid(devMiddlewares)
middlewares = middlewares.concat(devMiddlewares)
}
Expand Down
4 changes: 2 additions & 2 deletions src/middlewares/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ function log(ctx, start, len, err, event) {
const upstream = err
? chalk.red('xxx')
: event === 'close'
? chalk.yellow('-x-')
: chalk.gray('-->')
? chalk.yellow('-x-')
: chalk.gray('-->')
logger.verbose(
'[web] ' +
upstream +
Expand Down
10 changes: 4 additions & 6 deletions src/task/update_sentences_utils/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ function notifyMasterSwitchDB(targetDatabase) {
}

async function fullSentencesUpgrade(remoteVersionData, SideAB) {
const remoteCategoriesData = await fetchRemoteCategoriesData(
remoteVersionData,
)
const remoteCategoriesData =
await fetchRemoteCategoriesData(remoteVersionData)
await SideAB.set('hitokoto:bundle:categories', remoteCategoriesData)
let sentencesTotal = 0
for (const category of remoteCategoriesData) {
Expand All @@ -143,9 +142,8 @@ async function UpgradeSentencesThatShouldBeUpdated(
remoteVersionData.categories.timestamp !==
local.bundleVersionData.categories.timestamp // 检测分类列表是否更新
) {
const remoteCategoriesData = await fetchRemoteCategoriesData(
remoteVersionData,
)
const remoteCategoriesData =
await fetchRemoteCategoriesData(remoteVersionData)
const categoriesNeededToAppend = getCategoriesThatShouldBeAppended(
localCategoriesData,
remoteCategoriesData,
Expand Down

0 comments on commit 434eec2

Please sign in to comment.