mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-27 10:07:21 +00:00
857d3d3df3
Update eslint and its plugins, enable more rules and fix their findings: 1. `unicorn/no-unsafe-string-replacement` found that uploading a file whose name contains `$&` inserted a broken markdown link, because `String#replace` expands such patterns in the replacement string 2. `@typescript-eslint/require-await` removes `async` from functions that never await 3. Plugin rules not covered by a preset are now listed explicitly --------- Co-authored-by: bircni <bircni@icloud.com>
13 lines
604 B
TypeScript
13 lines
604 B
TypeScript
import '../css/swagger-standalone.css';
|
|
import {initSwaggerUI} from './render/swagger.ts';
|
|
|
|
async function initGiteaAPIViewer() {
|
|
const elSwaggerUi = document.querySelector<HTMLElement>('#swagger-ui')!;
|
|
const url = elSwaggerUi.getAttribute('data-source')!;
|
|
const res = await fetch(url); // eslint-disable-line no-restricted-globals -- standalone entry, it must not pull in main site modules
|
|
// HINT: SWAGGER-CSS-IMPORT: this is used in the standalone page which already has the related CSS imported by `<link>`
|
|
initSwaggerUI(elSwaggerUi, {specText: await res.text()});
|
|
}
|
|
|
|
initGiteaAPIViewer();
|