mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
workspace: apply eslint edits
This commit is contained in:
63 files changed
+47
-96
No files matched your search
@@ -1,6 +1,3 @@
|
||||
/* eslint-disable max-len */
|
||||
/* eslint-disable func-names */
|
||||
|
||||
interface IHydroError {
|
||||
new(...args: any[]): HydroError
|
||||
}
|
||||
|
||||
@@ -619,7 +619,6 @@ ${c.response.status} ${endTime - startTime}ms ${c.response.length}`);
|
||||
if (args.shorty) h.resetCompression();
|
||||
if (h._prepare) await h._prepare(args);
|
||||
if (h.prepare) await h.prepare(args);
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
for (const { name, target } of h.__subscribe || []) disposables.push(this.ctx.on(name, target.bind(h)));
|
||||
if (layer) {
|
||||
let lastHeartbeat = Date.now();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import path from 'path';
|
||||
import {
|
||||
convertIniConfig, LangConfig, normalizeSubtasks, ProblemConfigFile, readSubtasksFromFiles,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-template-curly-in-string */
|
||||
import { STATUS } from '@hydrooj/common';
|
||||
import { FormatError, SystemError } from './error';
|
||||
import { CopyInFile, runQueued } from './sandbox';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-duplicates */
|
||||
/* eslint-disable no-constant-condition */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* ..
|
||||
.' @`._
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import path from 'path';
|
||||
import PQueue from 'p-queue';
|
||||
import superagent from 'superagent';
|
||||
|
||||
@@ -249,7 +249,7 @@ export default class VJ4 implements Session {
|
||||
}
|
||||
}
|
||||
|
||||
async processData(folder: string) { // eslint-disable-line class-methods-use-this
|
||||
async processData(folder: string) {
|
||||
let files = await fs.readdir(folder);
|
||||
if (files.length <= 2) {
|
||||
if (files.length === 2) files.splice(files.indexOf('version'), 1);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-sequences */
|
||||
import { STATUS } from '@hydrooj/common';
|
||||
import { fs, parseMemoryMB, parseTimeMS } from '@hydrooj/utils';
|
||||
import checkers from '../checkers';
|
||||
|
||||
@@ -13,7 +13,6 @@ import { hydroPath } from '../options';
|
||||
const logger = new Logger('install');
|
||||
let yarnVersion = 0;
|
||||
try {
|
||||
// eslint-disable-next-line no-unsafe-optional-chaining
|
||||
yarnVersion = +child.execSync('yarn --version', { cwd: os.tmpdir() }).toString().split('v').pop()!.split('.')[0];
|
||||
} catch (e) {
|
||||
// yarn 2 does not support global dir
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import cac from 'cac';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-eval */
|
||||
import '../lib/index';
|
||||
|
||||
import os from 'os';
|
||||
|
||||
@@ -13,7 +13,6 @@ export async function load() {
|
||||
console.error('{"url":"mongodb://localhost:27017/hydro"}');
|
||||
process.exit(1);
|
||||
}
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
console.error('Please type your MongoDB connection string below:');
|
||||
console.error('Example: mongodb://localhost:27017/hydro');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
@@ -92,7 +91,6 @@ export async function apply(ctx: Context) {
|
||||
}
|
||||
for (const f of Object.values(global.addons)) {
|
||||
const dir = path.join(f, 'public');
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
if (await fs.pathExists(dir)) await fs.copy(dir, path.join(os.homedir(), '.hydro/static'));
|
||||
}
|
||||
ctx.inject(['server'], async ({ server }) => {
|
||||
|
||||
@@ -324,7 +324,6 @@ export class ContestEditHandler extends Handler {
|
||||
await ScheduleModel.deleteMany(task);
|
||||
const operation = [];
|
||||
if (Date.now() <= endAt.getTime() && autoHide) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await Promise.all(pids.map((pid) => problem.edit(domainId, pid, { hidden: true })));
|
||||
operation.push('unhide');
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { pick } from 'lodash';
|
||||
import { lookup } from 'mime-types';
|
||||
import { Context } from '../context';
|
||||
|
||||
@@ -142,7 +142,6 @@ export class ProblemMainHandler extends Handler {
|
||||
}
|
||||
const sort = this.queryContext.sort;
|
||||
await this.ctx.parallel('problem/list', query, this, sort);
|
||||
// eslint-disable-next-line prefer-const
|
||||
let [pdocs, ppcount, pcount] = this.queryContext.fail
|
||||
? [[], 0, 0]
|
||||
: await this.paginate(
|
||||
|
||||
@@ -172,7 +172,6 @@ export interface Document {
|
||||
}
|
||||
|
||||
declare module './model/problem' {
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
interface ProblemDoc {
|
||||
docType: document['TYPE_PROBLEM'];
|
||||
docId: number;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable consistent-return */
|
||||
/* eslint-disable simple-import-sort/imports */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable no-eval */
|
||||
import './init';
|
||||
import './interface';
|
||||
import path from 'path';
|
||||
@@ -156,7 +154,6 @@ async function preload() {
|
||||
try {
|
||||
// Is a npm package
|
||||
const packagejson = require.resolve(`${a}/package.json`);
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
const payload = require(packagejson);
|
||||
const name = payload.name.startsWith('@hydrooj/') ? payload.name.split('@hydrooj/')[1] : payload.name;
|
||||
global.Hydro.version[name] = payload.version;
|
||||
|
||||
@@ -91,7 +91,6 @@ const acm = buildContestRule({
|
||||
submitAfterAccept: false,
|
||||
showScoreboard: (tdoc, now) => now > tdoc.beginAt,
|
||||
showSelfRecord: () => true,
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt && !isLocked(tdoc),
|
||||
stat(tdoc, journal: AcmJournal[]) {
|
||||
const naccept = Counter<number>();
|
||||
@@ -100,7 +99,6 @@ const acm = buildContestRule({
|
||||
const detail: Record<number, AcmDetail> = {};
|
||||
let accept = 0;
|
||||
let time = 0;
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
const lockAt = isLocked(tdoc) ? tdoc.lockAt : null;
|
||||
for (const j of journal) {
|
||||
if (!tdoc.pids.includes(j.pid)) continue;
|
||||
@@ -281,7 +279,7 @@ const oi = buildContestRule({
|
||||
const detail = {};
|
||||
const display = {};
|
||||
let score = 0;
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
|
||||
const lockAt = isLocked(tdoc) ? tdoc.lockAt : null;
|
||||
for (const j of journal.filter((i) => tdoc.pids.includes(i.pid))) {
|
||||
if (lockAt && j.rid.getTimestamp() > lockAt) {
|
||||
@@ -362,7 +360,7 @@ const oi = buildContestRule({
|
||||
const tsddict = ((config.lockAt && isLocked(tdoc, new Date())) ? tsdoc.display : tsdoc.detail) || {};
|
||||
for (const pid of tdoc.pids) {
|
||||
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
|
||||
const node: ScoreboardNode = (!config.isExport && !config.lockAt && isDone(tdoc)
|
||||
&& meta?.psdict?.[index]?.rid
|
||||
&& tsddict[pid]?.rid?.toHexString() !== meta?.psdict?.[index]?.rid?.toHexString()
|
||||
@@ -408,7 +406,7 @@ const oi = buildContestRule({
|
||||
if (!first[pid] || first[pid] > time) first[pid] = time;
|
||||
}
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
|
||||
if (isDone(tdoc)) {
|
||||
const psdocs = await Promise.all(
|
||||
tdoc.pids.map((pid) => problem.getMultiStatus(tdoc.domainId, { docId: pid, uid: { $in: uids } }).toArray()),
|
||||
@@ -450,7 +448,7 @@ const oi = buildContestRule({
|
||||
const ioi = buildContestRule({
|
||||
TEXT: 'IOI',
|
||||
submitAfterAccept: false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
||||
|
||||
showRecord: (tdoc, now) => now > tdoc.endAt && !isLocked(tdoc),
|
||||
showSelfRecord: () => true,
|
||||
showScoreboard: (tdoc, now) => now > tdoc.beginAt,
|
||||
|
||||
@@ -382,14 +382,12 @@ export async function revPushStatus<T extends keyof DocStatusType>(
|
||||
{ $set: { [`${key}.$`]: value }, $inc: { rev: 1 } },
|
||||
{ returnDocument: 'after' },
|
||||
);
|
||||
if (!res) {
|
||||
res = await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
// @ts-ignore
|
||||
{ $push: { [key]: value }, $inc: { rev: 1 } },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
}
|
||||
res ||= await collStatus.findOneAndUpdate(
|
||||
{ domainId, docType, docId, uid },
|
||||
// @ts-ignore
|
||||
{ $push: { [key]: value }, $inc: { rev: 1 } },
|
||||
{ upsert: true, returnDocument: 'after' },
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,11 @@ class DomainModel {
|
||||
static async setUserRole(domainId: string, uid: MaybeArray<number>, role: string, autojoin = false) {
|
||||
const update = { $set: { role, ...(autojoin ? { join: true } : {}) } };
|
||||
if (!(uid instanceof Array)) {
|
||||
const res = await collUser.findOneAndUpdate({ domainId, uid }, update, { upsert: true, returnDocument: 'after', includeResultMetadata: true });
|
||||
const res = await collUser.findOneAndUpdate(
|
||||
{ domainId, uid },
|
||||
update,
|
||||
{ upsert: true, returnDocument: 'after', includeResultMetadata: true },
|
||||
);
|
||||
const udoc = await UserModel.getById(domainId, uid);
|
||||
deleteUserCache(udoc);
|
||||
return res;
|
||||
|
||||
@@ -385,7 +385,6 @@ export class ProblemModel {
|
||||
}
|
||||
for (const pdoc of pdocs) {
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
pdoc.config = await parseConfig(pdoc.config as string);
|
||||
} catch (e) {
|
||||
pdoc.config = `Cannot parse: ${e.message}`;
|
||||
|
||||
@@ -45,7 +45,6 @@ export const DOMAIN_USER_SETTINGS_BY_KEY: SettingDict = {};
|
||||
export const DOMAIN_SETTINGS_BY_KEY: SettingDict = {};
|
||||
export const SYSTEM_SETTINGS_BY_KEY: SettingDict = {};
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
export type SettingType = 'text' | 'yaml' | 'number' | 'float' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record<string, string> | 'json';
|
||||
|
||||
export const Setting = (
|
||||
@@ -355,7 +354,6 @@ SystemSetting(
|
||||
Setting('setting_storage', 'installid', String.random(64), 'text', 'installid', 'Installation ID', FLAG_HIDDEN | FLAG_DISABLED),
|
||||
);
|
||||
|
||||
// eslint-disable-next-line import/no-mutable-exports
|
||||
export const langs: Record<string, LangConfig> = {};
|
||||
|
||||
declare module '@cordisjs/core' {
|
||||
|
||||
@@ -169,7 +169,6 @@ export async function apply(ctx: Context) {
|
||||
stream.on('error', async () => {
|
||||
// The $changeStream stage is only supported on replica sets
|
||||
logger.info('No replica set found.');
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
let res;
|
||||
try {
|
||||
|
||||
@@ -316,7 +316,7 @@ class UserModel {
|
||||
autoAlloc = true;
|
||||
}
|
||||
const salt = String.random();
|
||||
while (true) { // eslint-disable-line no-constant-condition
|
||||
while (true) {
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await coll.insertOne({
|
||||
|
||||
@@ -58,4 +58,4 @@ export { EventMap } from './service/bus';
|
||||
export { db, pwsh };
|
||||
|
||||
// to load ctx.scoreboard
|
||||
export { } from './handler/contest'; // eslint-disable-line @typescript-eslint/no-useless-empty-export
|
||||
export { } from './handler/contest';
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import Schema from 'schemastery';
|
||||
import { STATUS } from '../model/builtin';
|
||||
import * as document from '../model/document';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import Schema from 'schemastery';
|
||||
import { STATUS } from '../model/builtin';
|
||||
import storage from '../model/storage';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import {
|
||||
BSON, Db, Filter, ObjectId, OnlyFieldsOfType,
|
||||
} from 'mongodb';
|
||||
|
||||
@@ -59,7 +59,7 @@ export class MongoService extends Service {
|
||||
const mongourl = await MongoService.getUrl();
|
||||
const url = mongoUri.parse(mongourl);
|
||||
this.client = await MongoClient.connect(mongourl);
|
||||
yield () => { this.client.close(); }
|
||||
yield () => { this.client.close(); };
|
||||
this.db = this.client.db(url.database || 'hydro');
|
||||
await bus.parallel('database/connect', this.db);
|
||||
this.ctx.setInterval(() => this.fixExpireAfter(), Time.hour);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-shadow */
|
||||
import { Logger } from './logger';
|
||||
import bus from './service/bus';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable github/array-foreach */
|
||||
import {
|
||||
$, addPage, AutoloadPage, i18n, Notification, request,
|
||||
} from '@hydrooj/ui-default';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { animated, easings, useSprings } from '@react-spring/web';
|
||||
import useKey from 'react-use/lib/useKey';
|
||||
import {
|
||||
addPage, NamedPage, React, ReactDOM,
|
||||
} from '@hydrooj/ui-default';
|
||||
import { animated, easings, useSprings } from '@react-spring/web';
|
||||
import useKey from 'react-use/lib/useKey';
|
||||
import { ResolverInput } from '../interface';
|
||||
|
||||
async function scrollTo(offset) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/order */
|
||||
/* eslint-disable import/first */
|
||||
export * from './utils';
|
||||
export { default as Notification } from './components/notification';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import esbuild from 'esbuild';
|
||||
import {
|
||||
Context, fs, Handler, Logger, NotFoundError, param, SettingModel, sha1,
|
||||
size, SystemModel, Types, UiContextBase,
|
||||
} from 'hydrooj';
|
||||
import { tmpdir } from 'os';
|
||||
import {
|
||||
basename, join, relative, resolve,
|
||||
} from 'path';
|
||||
import {
|
||||
Context, fs, Handler, Logger, NotFoundError, param, SettingModel, sha1,
|
||||
size, SystemModel, Types, UiContextBase,
|
||||
} from 'hydrooj';
|
||||
import esbuild from 'esbuild';
|
||||
|
||||
declare module 'hydrooj' {
|
||||
interface UI {
|
||||
|
||||
@@ -232,4 +232,4 @@ export default function plugin(md) {
|
||||
state.posMax = max;
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable max-len */
|
||||
/* eslint-disable prefer-destructuring */
|
||||
|
||||
import type MarkdownIt from 'markdown-it';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AnsiUp } from 'ansi_up';
|
||||
import { moment, ObjectId } from 'hydrooj';
|
||||
import { AnsiUp } from 'ansi_up';
|
||||
|
||||
export { size, formatSeconds } from 'hydrooj';
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import path from 'path';
|
||||
import * as status from '@hydrooj/common/status';
|
||||
import { findFileSync } from '@hydrooj/utils/lib/utils';
|
||||
import { convert } from 'html-to-text';
|
||||
import {
|
||||
avatar, Context, difficultyAlgorithm, fs, PERM, PRIV, Service, STATUS, yaml,
|
||||
} from 'hydrooj';
|
||||
import { convert } from 'html-to-text';
|
||||
import jsesc from 'jsesc';
|
||||
import nunjucks from 'nunjucks';
|
||||
import path from 'path';
|
||||
import markdown from './markdown';
|
||||
import { ensureTag, xss } from './markdown-it-xss';
|
||||
import * as misc from './misc';
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/* eslint-disable global-require */
|
||||
import fs from 'fs';
|
||||
import { dirname } from 'path';
|
||||
import { sentryWebpackPlugin } from '@sentry/webpack-plugin';
|
||||
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
|
||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||
import { version as coreJsVersion } from 'core-js/package.json';
|
||||
import compat from 'core-js-compat';
|
||||
import { EsbuildPlugin } from 'esbuild-loader';
|
||||
import fs from 'fs';
|
||||
import { DuplicatesPlugin } from 'inspectpack/plugin';
|
||||
import ExtractCssPlugin from 'mini-css-extract-plugin';
|
||||
import MonacoWebpackPlugin from 'monaco-editor-webpack-plugin';
|
||||
import packageJson from 'package-json';
|
||||
import { dirname } from 'path';
|
||||
import { gt } from 'semver';
|
||||
import webpack from 'webpack';
|
||||
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable import/no-import-module-exports */
|
||||
import path from 'path';
|
||||
import { size } from '@hydrooj/utils/lib/utils';
|
||||
import cac from 'cac';
|
||||
import chalk from 'chalk';
|
||||
import fs from 'fs-extra';
|
||||
import { globbySync } from 'globby';
|
||||
import path from 'path';
|
||||
import webpack, { Stats } from 'webpack';
|
||||
import WebpackDevServer from 'webpack-dev-server';
|
||||
import pkg from '../package.json';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
||||
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
||||
import { debounce, uniqueId } from 'lodash';
|
||||
import React, {
|
||||
forwardRef, useEffect,
|
||||
@@ -83,7 +81,7 @@ function DraggableSelection({
|
||||
const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, ref: React.Ref<AutoCompleteHandle<T>>) {
|
||||
const {
|
||||
multi = false, width = '100%', height = 'auto',
|
||||
freeSolo = false, allowEmptyQuery = false, listStyle = {},
|
||||
freeSolo = false, allowEmptyQuery = false, listStyle = {}, // eslint-disable-line @eslint-react/no-unstable-default-props
|
||||
disabled = false, disabledHint = '', draggable = multi,
|
||||
} = props;
|
||||
const queryItems = props.queryItems ?? (() => []);
|
||||
@@ -333,7 +331,7 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
|
||||
key={itemKey(item)}
|
||||
onClick={() => toggleItem(item)}
|
||||
onMouseMove={() => setCurrentItem(idx)}
|
||||
aria-selected={selectedKeys.includes(itemKey(item))}
|
||||
data-selected={selectedKeys.includes(itemKey(item))}
|
||||
data-focus={idx === currentItem}
|
||||
>
|
||||
<div>{renderItem(item)}</div>
|
||||
|
||||
@@ -4,7 +4,6 @@ import React, { forwardRef } from 'react';
|
||||
import { api, gql } from 'vj/utils';
|
||||
import AutoComplete, { AutoCompleteHandle, AutoCompleteProps } from './AutoComplete';
|
||||
|
||||
// eslint-disable-next-line prefer-arrow-callback
|
||||
const UserSelectAutoComplete = forwardRef<AutoCompleteHandle<Udoc>, AutoCompleteProps<Udoc>>((props, ref) => (
|
||||
<AutoComplete<Udoc>
|
||||
ref={ref as any}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-lone-blocks */
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
@@ -208,7 +209,7 @@ export default class Calendar {
|
||||
|
||||
const now = moment();
|
||||
days.forEach((day) => {
|
||||
day.current = day.date.isSame(now, 'day'); // eslint-disable-line no-param-reassign
|
||||
day.current = day.date.isSame(now, 'day');
|
||||
});
|
||||
|
||||
const daysByWeek = _.chunk(days, 7);
|
||||
|
||||
@@ -80,7 +80,7 @@ function initConn(path: string, port: MessagePort, cookie: any) {
|
||||
};
|
||||
}
|
||||
|
||||
self.onconnect = function (e) { // eslint-disable-line no-undef
|
||||
self.onconnect = function (e) {
|
||||
const port = e.ports[0];
|
||||
|
||||
port.addEventListener('message', (msg: { data: RequestPayload }) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable react-refresh/only-export-components */
|
||||
import { diffLines } from 'diff';
|
||||
import type { ProblemConfigFile, TestCaseConfig } from 'hydrooj/src/interface';
|
||||
import { diffLines } from 'diff';
|
||||
import $ from 'jquery';
|
||||
import yaml from 'js-yaml';
|
||||
import { isEqual } from 'lodash';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/common';
|
||||
import { TestCaseConfig } from 'hydrooj';
|
||||
import {
|
||||
Button, Classes, Icon, Popover, TreeNode,
|
||||
} from '@blueprintjs/core';
|
||||
import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/common';
|
||||
import { TestCaseConfig } from 'hydrooj';
|
||||
import { isEqual } from 'lodash';
|
||||
import React from 'react';
|
||||
import { DndProvider, useDrop } from 'react-dnd';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { parseMemoryMB, parseTimeMS, sortFiles } from '@hydrooj/utils/lib/common';
|
||||
import Ajv from 'ajv';
|
||||
import type { ProblemConfigFile, TestCaseConfig } from 'hydrooj/src/interface';
|
||||
import Ajv from 'ajv';
|
||||
import yaml from 'js-yaml';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import schema from '../../monaco/schema/problemconfig';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readSubtasksFromFiles } from '@hydrooj/common';
|
||||
import {
|
||||
Button, Classes, Dialog, DialogBody, DialogFooter, Icon,
|
||||
} from '@blueprintjs/core';
|
||||
import { readSubtasksFromFiles } from '@hydrooj/common';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useSelector, useStore } from 'react-redux';
|
||||
import { i18n } from 'vj/utils';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
||||
import {
|
||||
Button, ControlGroup,
|
||||
Dialog, DialogBody, DialogFooter,
|
||||
Icon, InputGroup, Tag,
|
||||
} from '@blueprintjs/core';
|
||||
import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common';
|
||||
import { isEqual } from 'lodash';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TestCaseConfig } from 'hydrooj';
|
||||
import {
|
||||
ContextMenu, Menu, MenuItem, TreeNode,
|
||||
} from '@blueprintjs/core';
|
||||
import { TestCaseConfig } from 'hydrooj';
|
||||
import { omit } from 'lodash';
|
||||
import React from 'react';
|
||||
import { useDrag } from 'react-dnd';
|
||||
|
||||
@@ -18,7 +18,6 @@ export default function DataInputComponent(props) {
|
||||
wrap="off"
|
||||
spellCheck="false"
|
||||
>
|
||||
{/* eslint-disable-next-line react/no-danger */}
|
||||
<pre dangerouslySetInnerHTML={{ __html: value }} contentEditable />
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/static-property-placement */
|
||||
import _ from 'lodash';
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable global-require */
|
||||
import {
|
||||
ContestModel, Context, Handler, ObjectId, param, PERM, PRIV, ProblemModel, Schema,
|
||||
SettingModel, SystemModel, Types, UserModel,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function App() {
|
||||
return <div></div>;
|
||||
return <div></div>;
|
||||
}
|
||||
|
||||
export default App;
|
||||
@@ -12,7 +12,7 @@ const pm2: typeof import('pm2') | null = (() => {
|
||||
const p = path.resolve(dir, info);
|
||||
if (p.startsWith('/nix')) return require(`${p.split('/bin')[0]}/lib/node_modules/pm2`);
|
||||
// installed by yarn
|
||||
return require(`${p.split('.bin')[0]}pm2`); // eslint-disable-line import/no-dynamic-require
|
||||
return require(`${p.split('.bin')[0]}pm2`);
|
||||
} catch (e) { }
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -39,7 +39,6 @@ export const sha1 = (content: string) => encrypt('sha1', content);
|
||||
export const md5 = (content: string) => encrypt('md5', content);
|
||||
|
||||
export function folderSize(folderPath: string) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-shadow
|
||||
let size = 0;
|
||||
const _next = function a(p: string) {
|
||||
if (p) {
|
||||
|
||||
@@ -318,7 +318,6 @@ export default class CodeforcesProvider extends BasicFetcher implements IBasicPr
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
let i = 1;
|
||||
const start = Date.now();
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
await sleep(3000);
|
||||
const contestId = id.includes('#') ? id.split('#')[0] : null;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-constant-condition */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { PassThrough } from 'stream';
|
||||
import { JSDOM } from 'jsdom';
|
||||
|
||||
@@ -190,7 +190,6 @@ export default class POJProvider extends BasicFetcher implements IBasicProvider
|
||||
// eslint-disable-next-line consistent-return
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
let count = 0;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (count < 60) {
|
||||
count++;
|
||||
await sleep(3000);
|
||||
|
||||
@@ -108,7 +108,6 @@ langs: ${JSON.stringify(langs)}`),
|
||||
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
logger.debug('Waiting for %s', id);
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
await sleep(3000);
|
||||
const { text } = await this.get(`/status/ns=${id}`);
|
||||
|
||||
@@ -161,7 +161,6 @@ export default class UOJProvider extends BasicFetcher implements IBasicProvider
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
let i = 1;
|
||||
let count = 0;
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (count < 120) {
|
||||
count++;
|
||||
await sleep(3000);
|
||||
|
||||
@@ -109,7 +109,6 @@ export default class YACSProvider extends BasicFetcher implements IBasicProvider
|
||||
|
||||
async waitForSubmission(id: string, next, end) {
|
||||
const done = {};
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
while (true) {
|
||||
await sleep(3000);
|
||||
const { submission } = await this.getData(`/submission/${id}`);
|
||||
|
||||
Reference in new issue
Block a user