workspace: update eslint config

This commit is contained in:
undefined committed 2021-02-01 12:33:48 +08:00
1 parent 4e4f6688bc
commit 3a3983d38d
29 files changed
+169 -166

No files matched your search

+3 -3
View File
@@ -1,12 +1,12 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.3.2",
"version": "2.3.3",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
"dependencies": {
"adm-zip": "^0.5.1",
"adm-zip": "^0.5.2",
"axios": "^0.21.1",
"bson": "^4.2.2",
"fs-extra": "^9.1.0",
@@ -14,7 +14,7 @@
"lodash": "^4.17.20",
"p-queue": "^6.6.1",
"shell-quote": "^1.7.2",
"systeminformation": "^4.34.9",
"systeminformation": "^5.0.8",
"yargs": "^16.2.0"
},
"peerDependencies": {
+1 -1
View File
@@ -36,4 +36,4 @@ export = async function compile(
};
}
throw new SystemError('Unknown language type.');
}
};
+1 -1
View File
@@ -6,4 +6,4 @@ import * as hack from './hack';
export = {
default: def, interactive, run, submit_answer, hack,
}
};
+18 -18
View File
@@ -31,39 +31,39 @@ const colors = [
];
const instances: Record<string, Logger> = {};
type LogFunction = (format: any, ...param: any[]) => void
type LogType = 'success' | 'error' | 'info' | 'warn' | 'debug'
type LogFunction = (format: any, ...param: any[]) => void;
type LogType = 'success' | 'error' | 'info' | 'warn' | 'debug';
export interface Logger extends Record<LogType, LogFunction> { }
export class Logger {
static readonly SUCCESS = 1
static readonly ERROR = 1
static readonly INFO = 2
static readonly WARN = 2
static readonly DEBUG = 3
static baseLevel = argv.debug ? 3 : 2
static showDiff = false
static levels: Record<string, number> = {}
static lastTime = 0
static readonly SUCCESS = 1;
static readonly ERROR = 1;
static readonly INFO = 2;
static readonly WARN = 2;
static readonly DEBUG = 3;
static baseLevel = argv.debug ? 3 : 2;
static showDiff = false;
static levels: Record<string, number> = {};
static lastTime = 0;
static options: InspectOptions = {
colors: process.stderr.isTTY,
}
};
static formatters: Record<string, (this: Logger, value: any) => string> = {
c: Logger.prototype.color,
C: (value) => Logger.color(15, value, ';1'),
o: (value) => inspect(value, Logger.options).replace(/\s*\n\s*/g, ' '),
}
};
static color(code: number, value: any, decoration = '') {
if (!Logger.options.colors) return `${value}`;
return `\u001B[3${code < 8 ? code : `8;5;${code}`}${decoration}m${value}\u001B[0m`;
}
private code: number
private displayName: string
public stream: NodeJS.WritableStream = process.stderr
private code: number;
private displayName: string;
public stream: NodeJS.WritableStream = process.stderr;
constructor(public name: string, private showDiff = false) {
if (name in instances) return instances[name];
@@ -97,7 +97,7 @@ export class Logger {
return Logger.levels[this.name] ?? Logger.baseLevel;
}
extend = (namespace: string, showDiff = this.showDiff) => new Logger(`${this.name}:${namespace}`, showDiff)
extend = (namespace: string, showDiff = this.showDiff) => new Logger(`${this.name}:${namespace}`, showDiff);
format: (format: any, ...param: any[]) => string = (...args) => {
if (args[0] instanceof Error) args[0] = args[0].stack || args[0].message;
@@ -122,7 +122,7 @@ export class Logger {
Logger.lastTime = now;
}
return format(...args);
}
};
}
export default new Logger('judge');
+6 -6
View File
@@ -78,11 +78,11 @@ export async function get() {
const cpu = `${Cpu.manufacturer} ${Cpu.brand}`;
const memory = `${size(Memory.active)}/${size(Memory.total)}`;
const osinfo = `${OsInfo.distro} ${OsInfo.release} ${OsInfo.codename} ${OsInfo.kernel} ${OsInfo.arch}`;
const load = `${CurrentLoad.avgload}`;
const load = `${CurrentLoad.avgLoad}`;
const flags = CpuFlags;
let battery;
if (!Battery.hasbattery) battery = 'No battery';
else battery = `${Battery.type} ${Battery.model} ${Battery.percent}%${Battery.ischarging ? ' Charging' : ''}`;
if (!Battery.hasBattery) battery = 'No battery';
else battery = `${Battery.type} ${Battery.model} ${Battery.percent}%${Battery.isCharging ? ' Charging' : ''}`;
const mid = OsInfo.serial;
cache.cpu = cpu;
cache.osinfo = osinfo;
@@ -114,10 +114,10 @@ export async function update() {
mid, cpu, osinfo, flags, stack,
} = cache;
const memory = `${size(Memory.active)}/${size(Memory.total)}`;
const load = `${CurrentLoad.avgload}`;
const load = `${CurrentLoad.avgLoad}`;
let battery;
if (!Battery.hasbattery) battery = 'No battery';
else battery = `${Battery.type} ${Battery.model} ${Battery.percent}%${Battery.ischarging ? ' Charging' : ''}`;
if (!Battery.hasBattery) battery = 'No battery';
else battery = `${Battery.type} ${Battery.model} ${Battery.percent}%${Battery.isCharging ? ' Charging' : ''}`;
const reqCount = global.reqCount;
global.reqCount = 0;
return [