workspace: apply eslint edits

This commit is contained in:
undefined committed 2025-03-21 09:48:17 +08:00
1 parent 040f7d8863
commit 0e7f5fe635
63 files changed
+47 -96

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
/* eslint-disable import/order */
/* eslint-disable import/first */
export * from './utils';
export { default as Notification } from './components/notification';
+5 -5
View File
@@ -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 -1
View File
@@ -1,5 +1,5 @@
import { AnsiUp } from 'ansi_up';
import { moment, ObjectId } from 'hydrooj';
import { AnsiUp } from 'ansi_up';
export { size, formatSeconds } from 'hydrooj';
+2 -2
View File
@@ -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';
+2 -3
View File
@@ -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 -1
View File
@@ -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
View File
@@ -1,4 +1,3 @@
/* eslint-disable global-require */
import {
ContestModel, Context, Handler, ObjectId, param, PERM, PRIV, ProblemModel, Schema,
SettingModel, SystemModel, Types, UserModel,