1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-16 07:18:37 +00:00

Tweak eslint config, fix new issues (#35019)

1. Enable
[`@typescript-eslint/no-unnecessary-type-conversion`](https://typescript-eslint.io/rules/no-unnecessary-type-conversion/),
I think the two cases that were hit are safe cases.
2. Disable `no-new-func`, `@typescript-eslint/no-implied-eval` does the
same but better.
This commit is contained in:
silverwind
2025-07-10 10:28:25 +02:00
committed by GitHub
parent af0196c145
commit 091b3e696d
3 changed files with 4 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast };
// See https://github.com/apvarun/toastify-js#api for options
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
const body = useHtmlBody ? String(message) : htmlEscape(message);
const body = useHtmlBody ? message : htmlEscape(message);
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;
const duplicateKey = preventDuplicates ? (preventDuplicates === true ? `${level}-${body}` : preventDuplicates) : '';

View File

@@ -283,7 +283,7 @@ export function isElemVisible(el: HTMLElement): boolean {
// This function DOESN'T account for all possible visibility scenarios, its behavior is covered by the tests of "querySingleVisibleElem"
if (!el) return false;
// checking el.style.display is not necessary for browsers, but it is required by some tests with happy-dom because happy-dom doesn't really do layout
return !el.classList.contains('tw-hidden') && Boolean((el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none');
return !el.classList.contains('tw-hidden') && (el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none';
}
// replace selected text in a textarea while preserving editor history, e.g. CTRL-Z works after this