diff --git a/build/prepare.js b/build/prepare.js index 4cefc8878..5c5ca56a8 100644 --- a/build/prepare.js +++ b/build/prepare.js @@ -13,10 +13,11 @@ const withoutTypes = (data) => ({ compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')), }); -/** @type {import('typescript/lib/typescript').CompilerOptions} */ +/** @type {import('typescript').CompilerOptions} */ const compilerOptionsBase = { target: 'es2022', - lib: ['esnext'], + lib: ['esnext', 'DOM'], + types: ['node'], module: 'preserve', esModuleInterop: true, moduleResolution: 'bundler', @@ -103,9 +104,9 @@ const UIConfig = { module: 'ESNext', skipLibCheck: true, allowSyntheticDefaultImports: true, - baseUrl: '.', jsx: 'react-jsx', outDir: path.join(baseOutDir, 'ui'), + types: ['node', 'webpack-env'], useDefineForClassFields: true, lib: ['esnext', 'DOM', 'DOM.Iterable'], @@ -187,7 +188,6 @@ const pluginsConfig = { compilerOptions: { ...compilerOptionsBase, rootDir: '.', - baseUrl: '.', outDir: path.join(baseOutDir, 'plugins'), skipLibCheck: true, paths: { diff --git a/framework/eslint-config/package.json b/framework/eslint-config/package.json index 7d6901c33..2af4ab83a 100644 --- a/framework/eslint-config/package.json +++ b/framework/eslint-config/package.json @@ -20,6 +20,6 @@ "eslint": ">= 9" }, "optionalDependencies": { - "typescript": "^5.9.3" + "typescript": "6.0.3" } } diff --git a/package.json b/package.json index 1dc0248b0..564b0fb4f 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@types/autocannon": "^7.12.7", "@types/chai": "^5.2.3", "@types/cross-spawn": "^6.0.6", - "@types/node": "24.10.13", + "@types/node": "24.13.3", "@types/semver": "^7.8.0", "autocannon": "^8.0.0", "cac": "^7.0.0", @@ -61,7 +61,7 @@ "simple-git": "^3.36.0", "supertest": "^7.2.2", "supports-hyperlinks": "^4.5.0", - "typescript": "5.8.3", + "typescript": "6.0.3", "wtfnode": "^0.10.1" }, "resolutions": { diff --git a/packages/ui-default/backendlib/markdown-it-media.ts b/packages/ui-default/backendlib/markdown-it-media.ts index b543624bc..1d160f858 100644 --- a/packages/ui-default/backendlib/markdown-it-media.ts +++ b/packages/ui-default/backendlib/markdown-it-media.ts @@ -3,7 +3,7 @@ /* eslint-disable regexp/no-useless-non-capturing-group */ /* eslint-disable regexp/optimal-quantifier-concatenation */ -import type MarkdownIt from 'markdown-it'; +import type { MarkdownIt } from 'markdown-it'; import { v4 as uuid } from 'uuid'; const allowFullScreen = ' webkitallowfullscreen mozallowfullscreen allowfullscreen'; @@ -103,8 +103,8 @@ declare module 'hydrooj' { export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boolean } = {}) { const supported = ['youtube', 'vimeo', 'vine', 'prezi', 'bilibili', 'youku', 'msoffice']; md.renderer.rules.video = function tokenizeReturn(tokens, idx) { - const src = tokens[idx].attrGet('src'); - const service = tokens[idx].attrGet('service').replace(/[^A-Z0-9]/gi, '').toLowerCase(); + const src = (tokens[idx].attrGet('src') ?? '').toString(); + const service = (tokens[idx].attrGet('service') ?? '').toString().replace(/[^A-Z0-9]/gi, '').toLowerCase(); if (Hydro?.module?.richmedia?.[service]) { const result = Hydro?.module?.richmedia[service].get(service, src, md); if (result) return result; @@ -138,7 +138,7 @@ export function Media(md: MarkdownIt, { pdfToolbar = false }: { pdfToolbar?: boo return `\ `; } return `
${md.utils.escapeHtml(src)}
`; diff --git a/packages/ui-default/pages/problem_detail.page.tsx b/packages/ui-default/pages/problem_detail.page.tsx index 2bea3a643..00507ec11 100644 --- a/packages/ui-default/pages/problem_detail.page.tsx +++ b/packages/ui-default/pages/problem_detail.page.tsx @@ -119,7 +119,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor // @ts-ignore .transition( { opacity: 1 }, - { duration: 200, easing: 'easeOutCubic' }, + 200, + 'easeOutCubic', ) .promise(); } @@ -129,7 +130,8 @@ const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homewor // @ts-ignore .transition( { opacity: 0 }, - { duration: 200, easing: 'easeOutCubic' }, + 200, + 'easeOutCubic', ) .promise(); } diff --git a/packages/vjudge/src/proxy.ts b/packages/vjudge/src/proxy.ts index c873d1fd0..0dcc8332b 100644 --- a/packages/vjudge/src/proxy.ts +++ b/packages/vjudge/src/proxy.ts @@ -1,6 +1,6 @@ declare module 'superagent' { interface Request { - proxy: (url: string) => this; + proxy(url: string): this; } } export default {};