Skip to content

Commit e4c0c28

Browse files
authored
chore: bump eslint typescript plugin (@Miodec) (monkeytypegame#6915)
1 parent cb68421 commit e4c0c28

28 files changed

+337
-164
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ docker
44
backend/scripts
55
backend/private
66
**/vitest.config.ts
7+
node_modules

backend/src/dal/leaderboards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export async function update(
226226
//update speedStats
227227
const boundaries = [...Array(32).keys()].map((it) => it * 10);
228228
const statsKey = `${language}_${mode}_${mode2}`;
229-
const src = await db.collection(lbCollectionName);
229+
const src = db.collection(lbCollectionName);
230230
const histogram = src.aggregate(
231231
[
232232
{

backend/src/dal/new-quotes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export async function approve(
187187
if (compareTwoStrings(old.text, quote.text) > 0.8) {
188188
throw new MonkeyError(409, "Duplicate quote");
189189
}
190+
return true;
190191
});
191192
let maxid = 0;
192193
quoteObject.quotes.map(function (q) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ BannerEvent.subscribe(() => {
316316
updateVerticalMargin();
317317
});
318318

319-
$(document).ready(() => {
319+
$(() => {
320320
updateBreakpoint(true);
321321
updateBreakpoint2();
322322
});

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

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ function updateUI(): void {
7272
if (Config.keymapMode === "next" && Config.mode !== "zen") {
7373
if (!Config.language.startsWith("korean")) {
7474
void KeymapEvent.highlight(
75-
TestWords.words
76-
.getCurrent()
77-
.charAt(TestInput.input.current.length)
78-
.toString()
75+
TestWords.words.getCurrent().charAt(TestInput.input.current.length)
7976
);
8077
} else {
8178
//word [가다]
@@ -1194,10 +1191,7 @@ $(document).on("keydown", async (event) => {
11941191

11951192
if (
11961193
Config.layout !== "default" &&
1197-
!(
1198-
event.ctrlKey ||
1199-
(event.altKey && window.navigator.platform.search("Linux") > -1)
1200-
)
1194+
!(event.ctrlKey || (event.altKey && Misc.isLinux()))
12011195
) {
12021196
const char: string | null = await LayoutEmulator.getCharFromEvent(event);
12031197
if (char !== null) {
@@ -1217,6 +1211,8 @@ $("#wordsInput").on("keydown", (event) => {
12171211
"spacing debug keydown STOPPED - repeat",
12181212
event.key,
12191213
event.code,
1214+
//ignore for logging
1215+
// eslint-disable-next-line @typescript-eslint/no-deprecated
12201216
event.which
12211217
);
12221218
return;
@@ -1236,7 +1232,7 @@ $("#wordsInput").on("keydown", (event) => {
12361232
const now = performance.now();
12371233
setTimeout(() => {
12381234
const eventCode =
1239-
event.code === "" || event.which === 231 ? "NoCode" : event.code;
1235+
event.code === "" || event.key === "Unidentified" ? "NoCode" : event.code;
12401236
TestInput.recordKeydownTime(now, eventCode);
12411237
}, 0);
12421238
});
@@ -1247,6 +1243,8 @@ $("#wordsInput").on("keyup", (event) => {
12471243
"spacing debug keydown STOPPED - repeat",
12481244
event.key,
12491245
event.code,
1246+
//ignore for logging
1247+
// eslint-disable-next-line @typescript-eslint/no-deprecated
12501248
event.which
12511249
);
12521250
return;
@@ -1265,7 +1263,7 @@ $("#wordsInput").on("keyup", (event) => {
12651263
const now = performance.now();
12661264
setTimeout(() => {
12671265
const eventCode =
1268-
event.code === "" || event.which === 231 ? "NoCode" : event.code;
1266+
event.code === "" || event.key === "Unidentified" ? "NoCode" : event.code;
12691267
TestInput.recordKeyupTime(now, eventCode);
12701268
}, 0);
12711269
});

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ export async function navigate(
171171
Notifications.add("No quit funbox is active. Please finish the test.", 0, {
172172
important: true,
173173
});
174-
event?.preventDefault();
174+
//todo: figure out if this was ever used
175+
// event?.preventDefault();
175176
return;
176177
}
177178

frontend/src/ts/elements/account/result-filters.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ function selectBeforeChangeFn(
697697
group: ResultFiltersGroup,
698698
selectedOptions: Option[],
699699
oldSelectedOptions: Option[]
700-
): void | boolean {
700+
): boolean {
701701
const includesAllNow = selectedOptions.some(
702702
(option) => option.value === "all"
703703
);
@@ -819,7 +819,7 @@ export async function appendButtons(
819819
closeOnSelect: false,
820820
},
821821
events: {
822-
beforeChange: (selectedOptions, oldSelectedOptions): void | boolean => {
822+
beforeChange: (selectedOptions, oldSelectedOptions): boolean => {
823823
return selectBeforeChangeFn(
824824
"language",
825825
selectedOptions,
@@ -851,7 +851,7 @@ export async function appendButtons(
851851
closeOnSelect: false,
852852
},
853853
events: {
854-
beforeChange: (selectedOptions, oldSelectedOptions): void | boolean => {
854+
beforeChange: (selectedOptions, oldSelectedOptions): boolean => {
855855
return selectBeforeChangeFn(
856856
"funbox",
857857
selectedOptions,
@@ -889,10 +889,7 @@ export async function appendButtons(
889889
closeOnSelect: false,
890890
},
891891
events: {
892-
beforeChange: (
893-
selectedOptions,
894-
oldSelectedOptions
895-
): void | boolean => {
892+
beforeChange: (selectedOptions, oldSelectedOptions): boolean => {
896893
return selectBeforeChangeFn(
897894
"tags",
898895
selectedOptions,

frontend/src/ts/elements/keymap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ export async function refresh(): Promise<void> {
477477
}
478478
}
479479

480-
const isMacLike = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
480+
const isMacLike = Misc.isMacLike();
481481
const symbolsPattern = /^[^\p{L}\p{N}]{1}$/u;
482482
type KeymapLegendStates = [letters: 0 | 1 | 2 | 3, symbols: 0 | 1 | 2 | 3];
483483
let keymapLegendStates: KeymapLegendStates = [0, 0];

frontend/src/ts/firebase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export async function createUserWithEmailAndPassword(
172172
}
173173

174174
export async function getIdToken(): Promise<string | null> {
175-
const user = await getAuthenticatedUser();
175+
const user = getAuthenticatedUser();
176176
if (user === null) return null;
177177
return firebaseGetIdToken(user);
178178
}

frontend/src/ts/modals/custom-text.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,21 +555,21 @@ async function setup(modalEl: HTMLElement): Promise<void> {
555555
});
556556
modalEl.querySelector(".button.wordfilter")?.addEventListener("click", () => {
557557
void WordFilterPopup.show({
558-
modalChain: modal as AnimatedModal<unknown, unknown>,
558+
modalChain: modal as AnimatedModal,
559559
});
560560
});
561561
modalEl
562562
.querySelector(".button.showSavedTexts")
563563
?.addEventListener("click", () => {
564564
void SavedTextsPopup.show({
565-
modalChain: modal as AnimatedModal<unknown, unknown>,
565+
modalChain: modal as AnimatedModal,
566566
});
567567
});
568568
modalEl
569569
.querySelector(".button.saveCustomText")
570570
?.addEventListener("click", () => {
571571
void SaveCustomTextPopup.show({
572-
modalChain: modal as AnimatedModal<unknown, unknown>,
572+
modalChain: modal as AnimatedModal,
573573
modalChainData: { text: cleanUpText() },
574574
});
575575
});

0 commit comments

Comments
 (0)