Skip to content

Commit 0b05b3c

Browse files
committed
refactor: enable ban-ts-comment rule
1 parent 1582266 commit 0b05b3c

27 files changed

+71
-71
lines changed

backend/.oxlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"plugins": ["jest", "vitest"],
1010
"rules": {
1111
"no-explicit-any": "allow",
12-
"explicit-function-return-type": "off"
12+
"explicit-function-return-type": "off",
13+
"ban-ts-comment": "off"
1314
}
1415
}
1516
]

backend/src/services/weekly-xp-leaderboard.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ export class WeeklyXpLeaderboard {
196196
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
197197
connection.set;
198198

199-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
200-
// @ts-ignore
201199
const [[, rank], [, totalXp], [, _count], [, result]] = (await connection
202200
.multi()
203201
.zrevrank(weeklyXpLeaderboardScoresKey, uid)
@@ -207,7 +205,8 @@ export class WeeklyXpLeaderboard {
207205
.exec()) as [
208206
[null, number | null],
209207
[null, string | null],
210-
[null, number | null]
208+
[null, number | null],
209+
[null, string | null]
211210
];
212211

213212
if (rank === null) {

frontend/.oxlintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"no-explicit-any": "allow",
1111
"explicit-function-return-type": "off",
1212
"no-array-for-each": "off",
13-
"eqeqeq": "off"
13+
"eqeqeq": "off",
14+
"ban-ts-comment": "off"
1415
}
1516
}
1617
]

frontend/__tests__/setup-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import $ from "jquery";
2-
// @ts-ignore
2+
//@ts-expect-error add to globl
33
global["$"] = $;
4-
// @ts-ignore
4+
//@ts-expect-error add to globl
55
global["jQuery"] = $;
66

77
vi.mock("../src/ts/constants/env-config", () => ({

frontend/src/ts/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1453,7 +1453,7 @@ function setThemes(
14531453
if (!isConfigValueValid("themes", theme, ConfigSchemas.ThemeNameSchema))
14541454
return false;
14551455

1456-
//@ts-expect-error
1456+
//@ts-expect-error config used to have 9
14571457
if (customThemeColors.length === 9) {
14581458
//color missing
14591459
if (customState) {
@@ -1539,7 +1539,7 @@ export function setCustomThemeColors(
15391539
nosave?: boolean
15401540
): boolean {
15411541
// migrate existing configs missing sub alt color
1542-
// @ts-expect-error
1542+
// @ts-expect-error legacy configs
15431543
if (colors.length === 9) {
15441544
//color missing
15451545
Notifications.add(
@@ -1931,8 +1931,8 @@ export function setCustomBackgroundFilter(
19311931
array: ConfigSchemas.CustomBackgroundFilter,
19321932
nosave?: boolean
19331933
): boolean {
1934-
//convert existing configs using five values down to four
1935-
//@ts-expect-error
1934+
// @ts-expect-error this used to be 5
1935+
// need to convert existing configs using five values down to four
19361936
if (array.length === 5) {
19371937
array = [array[0], array[1], array[2], array[3]];
19381938
}

frontend/src/ts/constants/env-config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ type Config = {
1010

1111
//@ts-expect-error these get replaced by vite
1212
const backendUrl = BACKEND_URL;
13-
// @ts-expect-error
13+
// @ts-expect-error ---
1414
const isDevelopment = IS_DEVELOPMENT;
15-
// @ts-expect-error
15+
// @ts-expect-error ---
1616
const clientVersion = CLIENT_VERSION;
17-
// @ts-expect-error
17+
// @ts-expect-error ---
1818
const recaptchaSiteKey = RECAPTCHA_SITE_KEY;
19-
// @ts-expect-error
19+
// @ts-expect-error ---
2020
const quickLoginEmail = QUICK_LOGIN_EMAIL;
21-
// @ts-expect-error
21+
// @ts-expect-error ---
2222
const quickLoginPassword = QUICK_LOGIN_PASSWORD;
2323

2424
export const envConfig: Config = {

frontend/src/ts/controllers/ad-controller.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ export async function checkAdblock(): Promise<void> {
143143
return new Promise((resolve) => {
144144
if (choice === "eg") {
145145
if (adBlock === undefined) {
146-
//@ts-expect-error
146+
//@ts-expect-error 3rd party ad code
147147
if (window.egAdPack === undefined) {
148148
adBlock = true;
149149
} else {
150150
adBlock = false;
151151
}
152152
}
153153
} else if (choice === "pw") {
154-
//@ts-expect-error
154+
//@ts-expect-error 3rd party ad code
155155
if (window.ramp === undefined) {
156156
adBlock = true;
157157
}
@@ -169,13 +169,13 @@ export async function checkCookieblocker(): Promise<void> {
169169
return;
170170
}
171171

172-
//@ts-expect-error
172+
//@ts-expect-error 3rd party ad code
173173
if (window.__tcfapi === undefined) {
174174
cookieBlocker = true;
175175
resolve();
176176
return;
177177
}
178-
//@ts-expect-error
178+
//@ts-expect-error 3rd party ad code
179179
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
180180
window.__tcfapi("getTCData", 2, (tcData, success) => {
181181
if (success as boolean) {
@@ -269,13 +269,13 @@ export function updateFooterAndVerticalAds(visible: boolean): void {
269269

270270
export function showConsentPopup(): void {
271271
if (choice === "eg") {
272-
//@ts-expect-error
272+
//@ts-expect-error 3rd party ad code, doesnt have types
273273
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
274274
window.__tcfapi("displayConsentUi", 2, function () {
275275
//
276276
});
277277
} else {
278-
//@ts-expect-error
278+
//@ts-expect-error 3rd party ad code, doesnt have types
279279
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
280280
ramp.showCmpModal();
281281
}
@@ -322,7 +322,7 @@ $(document).ready(() => {
322322
});
323323

324324
window.onerror = function (error): void {
325-
//@ts-expect-error
325+
//@ts-expect-error ---
326326
if (choice === "eg") {
327327
if (typeof error === "string" && error.startsWith("EG APS")) {
328328
$("#ad-result-wrapper .iconAndText").addClass("withLeft");

frontend/src/ts/controllers/captcha-controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function render(
1515
return;
1616
}
1717

18-
//@ts-expect-error
18+
//@ts-expect-error 3rd party code, no types
1919
const widgetId = grecaptcha.render(element, {
2020
sitekey: siteKey,
2121
callback,
@@ -29,7 +29,7 @@ export function reset(id: string): void {
2929
return;
3030
}
3131

32-
//@ts-expect-error
32+
//@ts-expect-error 3rd party code, no types
3333
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
3434
grecaptcha.reset(captchas[id]);
3535
}
@@ -39,7 +39,7 @@ export function getResponse(id: string): string {
3939
return "";
4040
}
4141

42-
//@ts-expect-error
42+
//@ts-expect-error 3rd party code, no types
4343
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
4444
return grecaptcha.getResponse(captchas[id]);
4545
}

frontend/src/ts/controllers/chart-controller.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ class ChartWithUpdateColors<
8787
}
8888

8989
getDataset(id: DatasetIds): ChartDataset<TType, TData> {
90-
//@ts-expect-error
90+
//@ts-expect-error its too difficult to figure out these types, but this works
9191
return this.data.datasets?.find((x) => x.yAxisID === id);
9292
}
9393

9494
getScale(
9595
id: DatasetIds extends never ? never : "x" | DatasetIds
9696
): DatasetIds extends never ? never : CartesianScaleOptions {
97-
//@ts-expect-error
97+
//@ts-expect-error its too difficult to figure out these types, but this works
9898
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access
9999
return this.options.scales[id];
100100
}
@@ -1155,7 +1155,7 @@ async function updateColors<
11551155

11561156
const gridcolor = blendTwoHexColors(bgcolor, subaltcolor, 0.75);
11571157

1158-
//@ts-expect-error
1158+
//@ts-expect-error its too difficult to figure out these types, but this works
11591159
chart.data.datasets[0].borderColor = (ctx): string => {
11601160
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
11611161
const isPb = ctx.raw?.isPb as boolean;
@@ -1177,7 +1177,7 @@ async function updateColors<
11771177
if (chart?.data?.datasets[0]?.type === undefined) {
11781178
if (chart.config.type === "line") {
11791179
dataset0.pointBackgroundColor = (ctx): string => {
1180-
//@ts-expect-error
1180+
//@ts-expect-error not sure why raw comes out to unknown, but this works
11811181
const isPb = ctx.raw?.isPb as boolean;
11821182
const color = isPb ? textcolor : maincolor;
11831183
return color;

frontend/src/ts/controllers/eg-ad-controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function init(): void {
1515

1616
export function renderResult(widerThanBreakpoint: boolean): void {
1717
if (widerThanBreakpoint) {
18-
//@ts-expect-error
18+
//@ts-expect-error 3rd party ad code
1919
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
2020
window.egAps.render([
2121
"ad-result",
@@ -24,7 +24,7 @@ export function renderResult(widerThanBreakpoint: boolean): void {
2424
"ad-footer",
2525
]);
2626
} else {
27-
//@ts-expect-error
27+
//@ts-expect-error 3rd party ad code
2828
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
2929
window.egAps.render([
3030
"ad-result-small",
@@ -37,7 +37,7 @@ export function renderResult(widerThanBreakpoint: boolean): void {
3737

3838
export function reinstate(): boolean {
3939
try {
40-
//@ts-expect-error
40+
//@ts-expect-error 3rd party ad code
4141
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
4242
window.egAps.reinstate();
4343
return true;
@@ -48,7 +48,7 @@ export function reinstate(): boolean {
4848
}
4949

5050
export async function refreshVisible(): Promise<void> {
51-
////@ts-expect-error
51+
////@ts-expect-error 3rd party ad code
5252
// const adDivs = Object.keys(window.egAdPack.gptAdSlots);
5353
// const visibleAdDivs = [];
5454
// for (let i = 0; i < adDivs.length; i++) {
@@ -63,6 +63,6 @@ export async function refreshVisible(): Promise<void> {
6363
// visibleAdDivs.push(adDivs[i]);
6464
// }
6565
// }
66-
// //@ts-ignore
66+
// //@ts-expect-error 3rd party ad code
6767
// window.egAps.refreshAds(visibleAdDivs);
6868
}

0 commit comments

Comments
 (0)