lgtm: fix alerts

This commit is contained in:
undefined committed 2021-04-19 23:46:58 +08:00
1 parent f1f956202f
commit ce880b4e05
5 files changed
+7 -6

No files matched your search

+2 -1
View File
@@ -310,10 +310,11 @@ class HomeDomainCreateHandler extends Handler {
@param('name', Types.Title) @param('name', Types.Title)
@param('bulletin', Types.Content) @param('bulletin', Types.Content)
@param('avatar', Types.Content, true, isEmail) @param('avatar', Types.Content, true, isEmail)
// eslint-disable-next-line @typescript-eslint/no-shadow
async post(_: string, id: string, name: string, bulletin: string, avatar: string) { async post(_: string, id: string, name: string, bulletin: string, avatar: string) {
const doc = await domain.get(id); const doc = await domain.get(id);
if (doc) throw new DomainAlreadyExistsError(id); if (doc) throw new DomainAlreadyExistsError(id);
avatar = avatar || this.user.avatar || `gravatar:${this.user.mail}` || 'gravatar:guest@hydro.local'; avatar = avatar || this.user.avatar || `gravatar:${this.user.mail}`;
const domainId = await domain.add(id, this.user._id, name, bulletin); const domainId = await domain.add(id, this.user._id, name, bulletin);
await domain.edit(domainId, { avatar }); await domain.edit(domainId, { avatar });
await domain.setUserRole(domainId, this.user._id, 'root'); await domain.setUserRole(domainId, this.user._id, 'root');
+1 -1
View File
@@ -71,7 +71,7 @@ async function runGulp() {
async function main() { async function main() {
const dir = process.cwd(); const dir = process.cwd();
process.chdir(root()); process.chdir(root());
await runGulp({}); await runGulp();
await runWebpack(argv); await runWebpack(argv);
process.chdir(dir); process.chdir(dir);
} }
@@ -62,7 +62,7 @@ function parseCategorySelection() {
else if (!subcategory) { else if (!subcategory) {
categories[category].select = true; categories[category].select = true;
dirtyCategories.push({ type: 'category', category }); dirtyCategories.push({ type: 'category', category });
} else if (category) { } else {
categories[category].children[subcategory].select = true; categories[category].children[subcategory].select = true;
dirtyCategories.push({ type: 'subcategory', subcategory, category }); dirtyCategories.push({ type: 'subcategory', subcategory, category });
} }
+2 -2
View File
@@ -25,8 +25,8 @@ function _(str, format) {
if (!texts[str]) texts[str] = [currentFile]; if (!texts[str]) texts[str] = [currentFile];
else texts[str].push(currentFile); else texts[str].push(currentFile);
} }
const i18n = _; const i18n = _; // lgtm [js/unused-local-variable]
const Setting = _; const Setting = _; // lgtm [js/unused-local-variable]
function scanTemplate(folder, relative = 'templates') { function scanTemplate(folder, relative = 'templates') {
const files = fs.readdirSync(folder); const files = fs.readdirSync(folder);
+1 -1
View File
@@ -1,4 +1,4 @@
import path, { sep } from 'path'; import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
import os from 'os'; import os from 'os';
import { Duplex } from 'stream'; import { Duplex } from 'stream';