From 741a9ac5119eee85830e0d6c0e4eb655fd639db0 Mon Sep 17 00:00:00 2001 From: masnn Date: Wed, 10 Jun 2020 13:26:00 +0800 Subject: [PATCH] eslint --- hydro/loader.js | 1 + hydro/model/message.js | 1 - hydro/model/record.js | 2 +- hydro/script/install.js | 12 ------------ module/module-pastebin/handler.js | 4 ++-- module/wiki/handler.js | 2 +- package.json | 6 +++--- 7 files changed, 8 insertions(+), 20 deletions(-) diff --git a/hydro/loader.js b/hydro/loader.js index f7f67ed5..abb4e8bb 100644 --- a/hydro/loader.js +++ b/hydro/loader.js @@ -312,6 +312,7 @@ async function load() { ui: {}, }; global.onDestory = []; + Error.stackTraceLimit = 50; if (cluster.isMaster) { console.log(`Master ${process.pid} Starting`); process.stdin.setEncoding('utf8'); diff --git a/hydro/model/message.js b/hydro/model/message.js index ce490ba8..5d4a1ef4 100644 --- a/hydro/model/message.js +++ b/hydro/model/message.js @@ -1,4 +1,3 @@ -const { ObjectID } = require('bson'); const { MessageNotFoundError } = require('../error'); const db = require('../service/db.js'); diff --git a/hydro/model/record.js b/hydro/model/record.js index 09c50590..190c08be 100644 --- a/hydro/model/record.js +++ b/hydro/model/record.js @@ -3,7 +3,7 @@ const { ObjectID } = require('bson'); const { STATUS_WAITING } = require('./builtin').STATUS; const task = require('./task'); const problem = require('./problem'); -const { RecordNotFoundError, PermissionError } = require('../error'); +const { RecordNotFoundError } = require('../error'); const db = require('../service/db'); const coll = db.collection('record'); diff --git a/hydro/script/install.js b/hydro/script/install.js index 8df5fee8..b03b66e9 100644 --- a/hydro/script/install.js +++ b/hydro/script/install.js @@ -1,7 +1,5 @@ const { defaults } = require('lodash'); const db = require('../service/db'); -const builtin = require('../model/builtin'); -const discussion = require('../model/discussion'); const system = require('../model/system'); const domain = require('../model/domain'); const pwhash = require('../lib/hash.hydro'); @@ -9,16 +7,6 @@ const { udoc } = require('../interface'); const collUser = db.collection('user'); -const allowFail = async (func, ...args) => { - let res; - try { - res = await func(...args); - } catch (e) { - return null; - } - return res; -}; - async function run({ username, password } = {}) { const def = { PROBLEM_PER_PAGE: 100, diff --git a/module/module-pastebin/handler.js b/module/module-pastebin/handler.js index 244a41ef..394551b5 100644 --- a/module/module-pastebin/handler.js +++ b/module/module-pastebin/handler.js @@ -42,8 +42,8 @@ class PasteCreateHandler extends Handler { } async function apply() { - Route('/paste/create', module.exports.PasteCreateHandler); - Route('/paste/:docId', module.exports.PasteShowHandler); + Route('/paste/create', PasteCreateHandler); + Route('/paste/:docId', PasteShowHandler); nav('/paste/create', 'pastebin', 'pastebin', PERM_LOGGEDIN); } diff --git a/module/wiki/handler.js b/module/wiki/handler.js index bfaeff48..4648c59d 100644 --- a/module/wiki/handler.js +++ b/module/wiki/handler.js @@ -20,7 +20,7 @@ class WikiHandler extends Handler { } async function apply() { - Route('/wiki/:name', module.exports.WikiHandler); + Route('/wiki/:name', WikiHandler); } global.Hydro.handler.wiki = module.exports = apply; diff --git a/package.json b/package.json index a68df439..1b856af3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hydro", - "version": "2.0.1", + "version": "2.1.0", "main": "hydro/development.js", "repository": "https://github.com/hydro-dev/Hydro.git", "author": "masnn", @@ -42,10 +42,10 @@ }, "pkg": { "scripts": [ - ".build/development.js" + ".build/app.js" ], "assets": [ - ".build/*" + ".build/module/**" ] } } \ No newline at end of file