Skip to content

Commit b907b9f

Browse files
authored
Enable a few more tsconfig options (#35553)
Enable a few more useful options in tsconfig. `noImplicitReturns` had two cases which I've fixed. Also, partially sort the file.
1 parent c5d74e5 commit b907b9f

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

tsconfig.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"include": [
3-
"${configDir}/.*",
43
"${configDir}/*",
4+
"${configDir}/.*",
55
"${configDir}/tests/e2e/**/*",
66
"${configDir}/tests/e2e/**/.*",
77
"${configDir}/tools/**/*",
@@ -17,27 +17,31 @@
1717
"allowImportingTsExtensions": true,
1818
"allowJs": true,
1919
"allowSyntheticDefaultImports": true,
20+
"allowUnreachableCode": false,
21+
"allowUnusedLabels": false,
2022
"alwaysStrict": true,
2123
"erasableSyntaxOnly": true,
2224
"esModuleInterop": true,
25+
"exactOptionalPropertyTypes": false,
2326
"isolatedModules": true,
2427
"libReplacement": false,
2528
"noEmit": true,
29+
"noFallthroughCasesInSwitch": true,
30+
"noImplicitAny": true,
31+
"noImplicitReturns": true,
32+
"noImplicitThis": true,
33+
"noPropertyAccessFromIndexSignature": false,
34+
"noUnusedLocals": true,
35+
"noUnusedParameters": true,
2636
"resolveJsonModule": true,
2737
"skipLibCheck": true,
28-
"verbatimModuleSyntax": true,
29-
"stripInternal": true,
38+
"sourceMap": true,
3039
"strict": false,
3140
"strictBindCallApply": true,
3241
"strictBuiltinIteratorReturn": true,
3342
"strictFunctionTypes": true,
34-
"noImplicitAny": true,
35-
"noImplicitThis": true,
36-
"noUnusedLocals": true,
37-
"noUnusedParameters": true,
38-
"noPropertyAccessFromIndexSignature": false,
39-
"exactOptionalPropertyTypes": false,
40-
"sourceMap": true,
43+
"stripInternal": true,
44+
"verbatimModuleSyntax": true,
4145
"types": [
4246
"vitest/globals",
4347
"./web_src/js/globals.d.ts",

web_src/js/features/tablesort.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export function initTableSort() {
1010
}
1111

1212
function tableSort(normSort: string, revSort: string, isDefault: string) {
13-
if (!normSort) return false;
13+
if (!normSort) return;
1414
if (!revSort) revSort = '';
1515

1616
const url = new URL(window.location.href);

web_src/js/modules/toast.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type ToastOpts = {
4343
type ToastifyElement = HTMLElement & {_giteaToastifyInstance?: Toast};
4444

4545
/** See https://github.com/apvarun/toastify-js#api for options */
46-
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast {
46+
function showToast(message: string, level: Intent, {gravity, position, duration, useHtmlBody, preventDuplicates = true, ...other}: ToastOpts = {}): Toast | null {
4747
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) : '';
@@ -56,7 +56,7 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
5656
showElem(toastDupNumEl);
5757
toastDupNumEl.textContent = String(Number(toastDupNumEl.textContent) + 1);
5858
animateOnce(toastDupNumEl, 'pulse-1p5-200');
59-
return;
59+
return null;
6060
}
6161
}
6262

@@ -83,15 +83,15 @@ function showToast(message: string, level: Intent, {gravity, position, duration,
8383
return toast;
8484
}
8585

86-
export function showInfoToast(message: string, opts?: ToastOpts): Toast {
86+
export function showInfoToast(message: string, opts?: ToastOpts): Toast | null {
8787
return showToast(message, 'info', opts);
8888
}
8989

90-
export function showWarningToast(message: string, opts?: ToastOpts): Toast {
90+
export function showWarningToast(message: string, opts?: ToastOpts): Toast | null {
9191
return showToast(message, 'warning', opts);
9292
}
9393

94-
export function showErrorToast(message: string, opts?: ToastOpts): Toast {
94+
export function showErrorToast(message: string, opts?: ToastOpts): Toast | null {
9595
return showToast(message, 'error', opts);
9696
}
9797

0 commit comments

Comments
 (0)