Skip to content

Commit 091b3e6

Browse files
authored
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.
1 parent af0196c commit 091b3e6

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

.eslintrc.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ module.exports = {
326326
'@typescript-eslint/no-unnecessary-type-arguments': [0],
327327
'@typescript-eslint/no-unnecessary-type-assertion': [2],
328328
'@typescript-eslint/no-unnecessary-type-constraint': [2],
329+
'@typescript-eslint/no-unnecessary-type-conversion': [2],
329330
'@typescript-eslint/no-unsafe-argument': [0],
330331
'@typescript-eslint/no-unsafe-assignment': [0],
331332
'@typescript-eslint/no-unsafe-call': [0],
@@ -645,7 +646,7 @@ module.exports = {
645646
'no-multi-str': [2],
646647
'no-negated-condition': [0],
647648
'no-nested-ternary': [0],
648-
'no-new-func': [2],
649+
'no-new-func': [0], // handled by @typescript-eslint/no-implied-eval
649650
'no-new-native-nonconstructor': [2],
650651
'no-new-object': [2],
651652
'no-new-symbol': [2],

web_src/js/modules/toast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast };
4444

4545
// See https://github.com/apvarun/toastify-js#api for options
4646
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
47-
const body = useHtmlBody ? String(message) : htmlEscape(message);
47+
const body = useHtmlBody ? message : htmlEscape(message);
4848
const parent = document.querySelector('.ui.dimmer.active') ?? document.body;
4949
const duplicateKey = preventDuplicates ? (preventDuplicates === true ? `${level}-${body}` : preventDuplicates) : '';
5050

web_src/js/utils/dom.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ export function isElemVisible(el: HTMLElement): boolean {
283283
// This function DOESN'T account for all possible visibility scenarios, its behavior is covered by the tests of "querySingleVisibleElem"
284284
if (!el) return false;
285285
// 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
286-
return !el.classList.contains('tw-hidden') && Boolean((el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none');
286+
return !el.classList.contains('tw-hidden') && (el.offsetWidth || el.offsetHeight || el.getClientRects().length) && el.style.display !== 'none';
287287
}
288288

289289
// replace selected text in a textarea while preserving editor history, e.g. CTRL-Z works after this

0 commit comments

Comments
 (0)