build: upgrade to TypeScript 6

This commit is contained in:
undefined committed 2026-08-13 07:36:42 +00:00
1 parent 87f64d60fd
commit f050b0cc5d
6 files changed
+16 -14

No files matched your search

+4 -4
View File
@@ -13,10 +13,11 @@ const withoutTypes = (data) => ({
compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')), compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')),
}); });
/** @type {import('typescript/lib/typescript').CompilerOptions} */ /** @type {import('typescript').CompilerOptions} */
const compilerOptionsBase = { const compilerOptionsBase = {
target: 'es2022', target: 'es2022',
lib: ['esnext'], lib: ['esnext', 'DOM'],
types: ['node'],
module: 'preserve', module: 'preserve',
esModuleInterop: true, esModuleInterop: true,
moduleResolution: 'bundler', moduleResolution: 'bundler',
@@ -103,9 +104,9 @@ const UIConfig = {
module: 'ESNext', module: 'ESNext',
skipLibCheck: true, skipLibCheck: true,
allowSyntheticDefaultImports: true, allowSyntheticDefaultImports: true,
baseUrl: '.',
jsx: 'react-jsx', jsx: 'react-jsx',
outDir: path.join(baseOutDir, 'ui'), outDir: path.join(baseOutDir, 'ui'),
types: ['node', 'webpack-env'],
useDefineForClassFields: true, useDefineForClassFields: true,
lib: ['esnext', 'DOM', 'DOM.Iterable'], lib: ['esnext', 'DOM', 'DOM.Iterable'],
@@ -187,7 +188,6 @@ const pluginsConfig = {
compilerOptions: { compilerOptions: {
...compilerOptionsBase, ...compilerOptionsBase,
rootDir: '.', rootDir: '.',
baseUrl: '.',
outDir: path.join(baseOutDir, 'plugins'), outDir: path.join(baseOutDir, 'plugins'),
skipLibCheck: true, skipLibCheck: true,
paths: { paths: {
+1 -1
View File
@@ -20,6 +20,6 @@
"eslint": ">= 9" "eslint": ">= 9"
}, },
"optionalDependencies": { "optionalDependencies": {
"typescript": "^5.9.3" "typescript": "6.0.3"
} }
} }
+2 -2
View File
@@ -37,7 +37,7 @@
"@types/autocannon": "^7.12.7", "@types/autocannon": "^7.12.7",
"@types/chai": "^5.2.3", "@types/chai": "^5.2.3",
"@types/cross-spawn": "^6.0.6", "@types/cross-spawn": "^6.0.6",
"@types/node": "24.10.13", "@types/node": "24.13.3",
"@types/semver": "^7.8.0", "@types/semver": "^7.8.0",
"autocannon": "^8.0.0", "autocannon": "^8.0.0",
"cac": "^7.0.0", "cac": "^7.0.0",
@@ -61,7 +61,7 @@
"simple-git": "^3.36.0", "simple-git": "^3.36.0",
"supertest": "^7.2.2", "supertest": "^7.2.2",
"supports-hyperlinks": "^4.5.0", "supports-hyperlinks": "^4.5.0",
"typescript": "5.8.3", "typescript": "6.0.3",
"wtfnode": "^0.10.1" "wtfnode": "^0.10.1"
}, },
"resolutions": { "resolutions": {
@@ -3,7 +3,7 @@
/* eslint-disable regexp/no-useless-non-capturing-group */ /* eslint-disable regexp/no-useless-non-capturing-group */
/* eslint-disable regexp/optimal-quantifier-concatenation */ /* eslint-disable regexp/optimal-quantifier-concatenation */
import type MarkdownIt from 'markdown-it'; import type { MarkdownIt } from 'markdown-it';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
const allowFullScreen = ' webkitallowfullscreen mozallowfullscreen allowfullscreen'; const allowFullScreen = ' webkitallowfullscreen mozallowfullscreen allowfullscreen';
@@ -103,8 +103,8 @@ declare module 'hydrooj' {
export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boolean } = {}) { export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boolean } = {}) {
const supported = ['youtube', 'vimeo', 'vine', 'prezi', 'bilibili', 'youku', 'msoffice']; const supported = ['youtube', 'vimeo', 'vine', 'prezi', 'bilibili', 'youku', 'msoffice'];
md.renderer.rules.video = function tokenizeReturn(tokens, idx) { md.renderer.rules.video = function tokenizeReturn(tokens, idx) {
const src = tokens[idx].attrGet('src'); const src = (tokens[idx].attrGet('src') ?? '').toString();
const service = tokens[idx].attrGet('service').replace(/[^A-Z0-9]/gi, '').toLowerCase(); const service = (tokens[idx].attrGet('service') ?? '').toString().replace(/[^A-Z0-9]/gi, '').toLowerCase();
if (Hydro?.module?.richmedia?.[service]) { if (Hydro?.module?.richmedia?.[service]) {
const result = Hydro?.module?.richmedia[service].get(service, src, md); const result = Hydro?.module?.richmedia[service].get(service, src, md);
if (result) return result; if (result) return result;
@@ -138,7 +138,7 @@ export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boo
return `\ return `\
<iframe class="embed-responsive-item ${service}-player" type="text/html" \ <iframe class="embed-responsive-item ${service}-player" type="text/html" \
width="100%" style="min-height: 500px" ${allowFullScreen} \ width="100%" style="min-height: 500px" ${allowFullScreen} \
src="${md.utils.escapeHtml(resourceUrl(service, src, tokens[idx].attrGet('url')))}" src="${md.utils.escapeHtml(resourceUrl(service, src, (tokens[idx].attrGet('url') ?? '').toString()))}"
scrolling="no" border="0" frameborder="no" framespacing="0"></iframe>`; scrolling="no" border="0" frameborder="no" framespacing="0"></iframe>`;
} }
return `<div data-${service}>${md.utils.escapeHtml(src)}</div>`; return `<div data-${service}>${md.utils.escapeHtml(src)}</div>`;
@@ -119,7 +119,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
// @ts-ignore // @ts-ignore
.transition( .transition(
{ opacity: 1 }, { opacity: 1 },
{ duration: 200, easing: 'easeOutCubic' }, 200,
'easeOutCubic',
) )
.promise(); .promise();
} }
@@ -129,7 +130,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor
// @ts-ignore // @ts-ignore
.transition( .transition(
{ opacity: 0 }, { opacity: 0 },
{ duration: 200, easing: 'easeOutCubic' }, 200,
'easeOutCubic',
) )
.promise(); .promise();
} }
+1 -1
View File
@@ -1,6 +1,6 @@
declare module 'superagent' { declare module 'superagent' {
interface Request { interface Request {
proxy: (url: string) => this; proxy(url: string): this;
} }
} }
export default {}; export default {};