Skip to content

Commit 0be1163

Browse files
committed
use eslint@9
1 parent 5ea61ae commit 0be1163

29 files changed

+134
-86
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.yaml

Lines changed: 0 additions & 30 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/* eslint-disable max-len */
2+
import { defineConfig, globalIgnores } from 'eslint/config';
3+
import globals from 'globals';
4+
import react from '@hydrooj/eslint-config';
5+
6+
export default defineConfig([globalIgnores([
7+
'**/dist',
8+
'**/*.d.ts',
9+
'**/node_modules',
10+
'**/.*.js',
11+
]), {
12+
extends: [react],
13+
14+
languageOptions: {
15+
ecmaVersion: 5,
16+
sourceType: 'module',
17+
},
18+
19+
settings: {
20+
'import/parsers': {
21+
'@typescript-eslint/parser': ['.ts', '.js', '.jsx', '.tsx'],
22+
},
23+
},
24+
25+
rules: {
26+
'@typescript-eslint/no-invalid-this': 1,
27+
28+
'simple-import-sort/imports': ['warn', {
29+
groups: [
30+
['^\\u0000'],
31+
[
32+
'^(node:)?(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)',
33+
'^(?!@?hydrooj)(@?\\w.+)',
34+
'^@?hydrooj',
35+
'^',
36+
'^\\.',
37+
]],
38+
}],
39+
},
40+
}, {
41+
files: [
42+
'**/packages/ui/**/*.{cjs,ts,tsx}',
43+
],
44+
45+
languageOptions: {
46+
globals: {
47+
...globals.browser,
48+
},
49+
parserOptions: {
50+
sourceType: 'module',
51+
ecmaVersion: 2020,
52+
ecmaFeatures: {
53+
impliedStrict: true,
54+
experimentalObjectRestSpread: true,
55+
jsx: true,
56+
defaultParams: true,
57+
legacyDecorators: true,
58+
allowImportExportEverywhere: true,
59+
},
60+
},
61+
},
62+
63+
settings: {
64+
'react-x': {
65+
version: '18.3.1',
66+
},
67+
},
68+
69+
rules: {
70+
'github/array-foreach': 0,
71+
'@typescript-eslint/no-invalid-this': 0,
72+
73+
// FIXME A bug with eslint-parser
74+
// 'template-curly-spacing': 'off',
75+
76+
'@stylistic/indent': [
77+
'warn',
78+
2,
79+
{ SwitchCase: 1 },
80+
],
81+
'function-paren-newline': 'off',
82+
'no-mixed-operators': 'off',
83+
'no-await-in-loop': 'off',
84+
'no-lonely-if': 'off',
85+
'no-script-url': 'off',
86+
},
87+
}]);

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
},
1717
"devDependencies": {
1818
"@expo-google-fonts/noto-sans-sc": "^0.2.3",
19-
"@hydrooj/eslint-config": "^1.1.1",
19+
"@hydrooj/eslint-config": "^2.0.0",
2020
"@hydrooj/register": "^1.0.3",
2121
"@hydrooj/utils": "^1.4.29",
2222
"@neutralinojs/neu": "^11.3.0",
2323
"@types/node": "^20.17.1",
2424
"@yao-pkg/pkg": "^5.16.1",
2525
"chardet": "^2.1.0",
2626
"dejavu-fonts-ttf": "^2.37.3",
27-
"eslint": "^8.57.1",
28-
"eslint-import-resolver-typescript": "^3.6.3",
27+
"eslint": "^9.28.0",
28+
"eslint-import-resolver-typescript": "^4.4.2",
2929
"iconv-lite": "^0.6.3",
30-
"typescript": "5.4.5"
30+
"typescript": "5.8.3"
3131
},
3232
"resolutions": {
3333
"formidable": "patch:formidable@npm%3A2.1.2#~/.yarn/patches/formidable-npm-2.1.2-40ba18d67f.patch",

packages/server/handler/balloon.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-await-in-loop */
21
import { Context } from 'cordis';
32
import { ValidationError } from '@hydrooj/framework';
43
import { Logger } from '../utils';

packages/server/handler/commands.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable no-empty-pattern */
2-
/* eslint-disable no-await-in-loop */
31
import { Context } from 'cordis';
42
import { BadRequestError } from '@hydrooj/framework';
53
import { config } from '../config';

packages/server/handler/misc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-await-in-loop */
21
// @ts-ignore
32
import { Context } from 'cordis';
43
import { Registry } from 'prom-client';

packages/server/handler/printer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-await-in-loop */
21
import path from 'path';
32
import { Context } from 'cordis';
43
import { BadRequestError, Handler, ValidationError } from '@hydrooj/framework';

packages/server/utils/commandRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-loop-func */
21
import child from 'child_process';
32
import fs from 'fs';
43
import { homedir } from 'os';
@@ -42,6 +41,7 @@ export async function executeOnHost(host: string, command: string, timeout = 100
4241
logger.info('executing', command, 'on', host);
4342
return await asyncCommand([
4443
'ssh', '-o', 'StrictHostKeyChecking no', '-o', `IdentityFile ${customKeyfile || keyfile}`,
44+
'-o', 'UserKnownHostsFile /dev/null',
4545
`root@${host}`,
4646
'bash', '-c', `'echo $(echo ${Buffer.from(command).toString('base64')} | base64 -d | bash)'`,
4747
], timeout);

packages/server/utils/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-loop-func */
2-
/* eslint-disable no-await-in-loop */
31
import { gunzipSync } from 'zlib';
42
import { decode } from 'base16384';
53
import Logger from 'reggol';

0 commit comments

Comments
 (0)