Forbid localStorage access in eslint (#36461)
Followup to
59f812bc1c,
enforce using our localStorage wrapper in eslint.
Also did a few tweaks in the eslint config, like removing the incomplete
list of globals, this is a non-issue with typescript.
---------
Signed-off-by: silverwind <me@silverwind.io>
This commit is contained in:
@@ -22,7 +22,7 @@ export function request(url: string, {method = 'GET', data, headers = {}, ...oth
|
||||
headersMerged.set(name, value);
|
||||
}
|
||||
|
||||
return fetch(url, {
|
||||
return fetch(url, { // eslint-disable-line no-restricted-globals
|
||||
method,
|
||||
headers: headersMerged,
|
||||
...other,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
// Some people deploy Gitea under a subpath, so it needs prefix to avoid local storage key conflicts.
|
||||
// And these keys are for user settings only, it also needs a specific prefix,
|
||||
// in case in the future there are other uses of local storage, and/or we need to clear some keys when the quota is exceeded.
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import SwaggerUI from 'swagger-ui-dist/swagger-ui-es-bundle.js';
|
||||
import 'swagger-ui-dist/swagger-ui.css';
|
||||
import {load as loadYaml} from 'js-yaml';
|
||||
import {GET} from '../modules/fetch.ts';
|
||||
|
||||
window.addEventListener('load', async () => {
|
||||
const elSwaggerUi = document.querySelector('#swagger-ui')!;
|
||||
const url = elSwaggerUi.getAttribute('data-source')!;
|
||||
let spec: any;
|
||||
if (url) {
|
||||
const res = await fetch(url);
|
||||
const res = await GET(url);
|
||||
spec = await res.json();
|
||||
} else {
|
||||
const elSpecContent = elSwaggerUi.querySelector<HTMLTextAreaElement>('.swagger-spec-content')!;
|
||||
|
||||
@@ -5,7 +5,7 @@ const pngPhys = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAIAAAD91
|
||||
const pngEmpty = 'data:image/png;base64,';
|
||||
|
||||
async function dataUriToBlob(datauri: string) {
|
||||
return await (await globalThis.fetch(datauri)).blob();
|
||||
return await (await globalThis.fetch(datauri)).blob(); // eslint-disable-line no-restricted-properties
|
||||
}
|
||||
|
||||
test('pngChunks', async () => {
|
||||
|
||||
Reference in New Issue
Block a user