mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
workspace: update eslint rule (#1027)
This commit is contained in:
1 parent
05c3b8f2bd
commit
cee3c00ddb
150 files changed
+1069
-1043
No files matched your search
@@ -17,9 +17,9 @@ export interface CheckConfig {
|
||||
}
|
||||
|
||||
type Checker = (config: CheckConfig) => Promise<{
|
||||
status: number,
|
||||
score: number,
|
||||
message: string,
|
||||
status: number;
|
||||
score: number;
|
||||
message: string;
|
||||
}>;
|
||||
|
||||
function parseDiffMsg(msg: string) {
|
||||
@@ -206,7 +206,6 @@ const checkers: Record<string, Checker> = new Proxy({
|
||||
* stderr:输出错误报告
|
||||
*/
|
||||
async syzoj(config) {
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { status, stdout, stderr } = await runQueued(config.execute, {
|
||||
copyIn: {
|
||||
input: config.input,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { STATUS_TEXTS } from '@hydrooj/common';
|
||||
|
||||
interface CompileErrorInfo {
|
||||
stdout?: string,
|
||||
stderr?: string,
|
||||
status?: number
|
||||
stdout?: string;
|
||||
stderr?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
export class CompileError extends Error {
|
||||
|
||||
@@ -10,7 +10,7 @@ interface Task {
|
||||
compile: () => Promise<void>;
|
||||
judgeCase: (c: NormalizedCase) => (
|
||||
(ctx: Context, ctxSubtask: ContextSubTask, runner?: Function) => Promise<JudgeResultBody['case']>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const Score = {
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function judge({
|
||||
if (!Object.keys(config.answers).length) throw new FormatError('Invalid standard answer.');
|
||||
for (const key in config.answers) {
|
||||
const ansInfo = config.answers[key] as [string | string[], number] | Record<string, number>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
||||
// eslint-disable-next-line ts/no-loop-func
|
||||
const report = (status: STATUS, score: number, message: string) => {
|
||||
const [subtaskId, caseId] = key.split('-').map(Number);
|
||||
totalScore += score;
|
||||
|
||||
@@ -27,8 +27,8 @@ export class Stream extends EventEmitter {
|
||||
break;
|
||||
case 2:
|
||||
this.emit('output', {
|
||||
index: (data[1] >> 4) & 0xf,
|
||||
fd: (data[1]) & 0xf,
|
||||
index: (data[1] >> 4) & 0xF,
|
||||
fd: (data[1]) & 0xF,
|
||||
content: data.subarray(2),
|
||||
});
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { DetailType, STATUS } from '@hydrooj/common';
|
||||
|
||||
const operation = /^\s*(status|score)\((\d+)\)\s*(.*)$/m;
|
||||
const operation = /^\s*(status|score)\((\d+)\)\s*((\S|$).*)$/m;
|
||||
|
||||
export function parse(output: string, fullscore: number, detail: DetailType) {
|
||||
let status = STATUS.STATUS_WRONG_ANSWER;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { CompilableSource } from '@hydrooj/common';
|
||||
import { fs } from '@hydrooj/utils';
|
||||
import { FormatError } from './error';
|
||||
|
||||
const EMPTY_STR = /^[ \r\n\t]*$/i;
|
||||
const EMPTY_STR = /^[ \r\n\t]*$/;
|
||||
|
||||
export const cmd = parse;
|
||||
|
||||
@@ -34,7 +34,7 @@ export function compilerText(...messages: string[]) {
|
||||
function restrictFile(p: string) {
|
||||
if (!p) return '/';
|
||||
if (p[0] === '/') p = '';
|
||||
return p.replace(/\.\./gmi, '');
|
||||
return p.replace(/\.\./g, '');
|
||||
}
|
||||
|
||||
export function ensureFile(folder: string) {
|
||||
|
||||
Reference in new issue
Block a user