diff --git a/eslint.config.ts b/eslint.config.ts index 2f710bd936..8d5b435397 100644 --- a/eslint.config.ts +++ b/eslint.config.ts @@ -15,6 +15,7 @@ import vue from 'eslint-plugin-vue'; import vueScopedCss from 'eslint-plugin-vue-scoped-css'; import wc from 'eslint-plugin-wc'; import {defineConfig, globalIgnores} from 'eslint/config'; +import type {ESLint} from 'eslint'; const jsExts = ['js', 'mjs', 'cjs'] as const; const tsExts = ['ts', 'mts', 'cts'] as const; @@ -62,8 +63,7 @@ export default defineConfig([ '@stylistic': stylistic, '@typescript-eslint': typescriptPlugin.plugin, 'array-func': arrayFunc, - // @ts-expect-error -- https://github.com/un-ts/eslint-plugin-import-x/issues/203 - 'import-x': importPlugin, + 'import-x': importPlugin as unknown as ESLint.Plugin, // https://github.com/un-ts/eslint-plugin-import-x/issues/203 regexp, sonarjs, unicorn, @@ -156,7 +156,7 @@ export default defineConfig([ '@typescript-eslint/adjacent-overload-signatures': [0], '@typescript-eslint/array-type': [0], '@typescript-eslint/await-thenable': [2], - '@typescript-eslint/ban-ts-comment': [2, {'ts-expect-error': false, 'ts-ignore': true, 'ts-nocheck': false, 'ts-check': false}], + '@typescript-eslint/ban-ts-comment': [2, {'ts-expect-error': true, 'ts-ignore': true, 'ts-nocheck': false, 'ts-check': false}], '@typescript-eslint/ban-tslint-comment': [0], '@typescript-eslint/class-literal-property-style': [0], '@typescript-eslint/class-methods-use-this': [0], @@ -924,8 +924,7 @@ export default defineConfig([ }, extends: [ vue.configs['flat/recommended'], - // @ts-expect-error - vueScopedCss.configs['flat/recommended'], + vueScopedCss.configs['flat/recommended'] as any, ], rules: { 'vue/attributes-order': [0], diff --git a/tsconfig.json b/tsconfig.json index d2149a37bd..7b16df0196 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "target": "es2020", "module": "esnext", "moduleResolution": "bundler", - "lib": ["dom", "dom.iterable", "dom.asynciterable", "esnext"], + "lib": ["dom", "dom.iterable", "dom.asynciterable", "esnext", "webworker"], "allowImportingTsExtensions": true, "allowJs": true, "allowSyntheticDefaultImports": true, diff --git a/types.d.ts b/types.d.ts index ccce6c5554..59d6ecf149 100644 --- a/types.d.ts +++ b/types.d.ts @@ -2,18 +2,105 @@ declare module '@techknowlogick/license-checker-webpack-plugin' { const plugin: any; export = plugin; } + declare module 'eslint-plugin-no-use-extend-native' { import type {Eslint} from 'eslint'; const plugin: Eslint.Plugin; export = plugin; } + declare module 'eslint-plugin-array-func' { import type {Eslint} from 'eslint'; const plugin: Eslint.Plugin; export = plugin; } + declare module 'eslint-plugin-github' { import type {Eslint} from 'eslint'; const plugin: Eslint.Plugin; export = plugin; } + +declare module '*.svg' { + const value: string; + export default value; +} + +declare module '*.css' { + const value: string; + export default value; +} + +declare module '*.vue' { + import type {DefineComponent} from 'vue'; + const component: DefineComponent; + export default component; + // Here we declare all exports from vue files so `tsc` or `tsgo` can work for + // non-vue files. To lint .vue files, `vue-tsc` must be used. + export function initDashboardRepoList(): void; + export function initRepositoryActionView(): void; +} + +declare module 'htmx.org/dist/htmx.esm.js' { + const value = await import('htmx.org'); + export default value; +} + +declare module 'swagger-ui-dist/swagger-ui-es-bundle.js' { + const value = await import('swagger-ui-dist'); + export default value.SwaggerUIBundle; +} + +declare module 'asciinema-player' { + interface AsciinemaPlayer { + create(src: string, element: HTMLElement, options?: Record): void; + } + const exports: AsciinemaPlayer; + export = exports; +} + +declare module '@citation-js/core' { + export class Cite { + constructor(data: string); + format(format: string, options?: Record): string; + } + export const plugins: { + config: { + get(name: string): any; + }; + }; +} + +declare module '@citation-js/plugin-software-formats' {} +declare module '@citation-js/plugin-bibtex' {} +declare module '@citation-js/plugin-csl' {} + +declare module 'vue-bar-graph' { + import type {DefineComponent} from 'vue'; + + interface BarGraphPoint { + value: number; + label: string; + } + + export const VueBarGraph: DefineComponent<{ + points?: Array; + barColor?: string; + textColor?: string; + textAltColor?: string; + height?: number; + labelHeight?: number; + }>; +} + +declare module '@mcaptcha/vanilla-glue' { + export let INPUT_NAME: string; + export default class Widget { + constructor(options: { + siteKey: { + instanceUrl: URL; + key: string; + }; + }); + } +} diff --git a/web_src/js/bootstrap.ts b/web_src/js/bootstrap.ts index 9d30e9ea52..adad927af6 100644 --- a/web_src/js/bootstrap.ts +++ b/web_src/js/bootstrap.ts @@ -80,13 +80,12 @@ function initGlobalErrorHandler() { // we added an event handler for window error at the very beginning of