Skip to content

Commit 1582266

Browse files
committed
refactor: enable eqeqeq rule
1 parent 3207a20 commit 1582266

File tree

18 files changed

+36
-34
lines changed

18 files changed

+36
-34
lines changed

frontend/.oxlintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"files": ["__tests__/**/*.ts"],
99
"rules": {
1010
"no-explicit-any": "allow",
11-
"explicit-function-return-type": "off"
11+
"explicit-function-return-type": "off",
12+
"no-array-for-each": "off",
13+
"eqeqeq": "off"
1214
}
1315
}
1416
]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function backspaceToPrevious(): void {
127127

128128
const wordElements = document.querySelectorAll("#words > .word");
129129
if (
130-
(TestInput.input.getHistory(TestState.activeWordIndex - 1) ==
130+
(TestInput.input.getHistory(TestState.activeWordIndex - 1) ===
131131
TestWords.words.get(TestState.activeWordIndex - 1) &&
132132
!Config.freedomMode) ||
133133
wordElements[wordElementIndex - 1]?.classList.contains("hidden")
@@ -716,7 +716,7 @@ function handleChar(
716716
(wordIsTheSame || shouldQuickEnd) &&
717717
(!isChinese ||
718718
(realInputValue !== undefined &&
719-
charIndex + 2 == realInputValue.length))
719+
charIndex + 2 === realInputValue.length))
720720
) {
721721
void TestLogic.finish();
722722
return;
@@ -1051,7 +1051,7 @@ $(document).on("keydown", async (event) => {
10511051
TestInput.input.current.slice(-1),
10521052
TestInput.input.current.length - 1
10531053
) &&
1054-
(TestInput.input.getHistory(TestState.activeWordIndex - 1) !=
1054+
(TestInput.input.getHistory(TestState.activeWordIndex - 1) !==
10551055
TestWords.words.get(TestState.activeWordIndex - 1) ||
10561056
Config.freedomMode)
10571057
) {

frontend/src/ts/elements/alerts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function updateInboxSize(): void {
309309
function deleteAlert(id: string): void {
310310
mailToDelete.push(id);
311311
$(`#alertsPopup .accountAlerts .list .item[data-id="${id}"]`).remove();
312-
if ($("#alertsPopup .accountAlerts .list .item").length == 0) {
312+
if ($("#alertsPopup .accountAlerts .list .item").length === 0) {
313313
$("#alertsPopup .accountAlerts .list").html(`
314314
<div class="nothing">
315315
Nothing to show

frontend/src/ts/elements/result-word-highlight.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ async function init(): Promise<boolean> {
222222
const word = wordEls[i] as HTMLElement;
223223
const prevWord = wordEls[i - 1] as HTMLElement;
224224

225-
if (word.offsetTop != prevWord.offsetTop) {
225+
if (word.offsetTop !== prevWord.offsetTop) {
226226
currLineIndex++;
227227
lineRect = Misc.getBoundingRectOfElements([
228228
wordEls[prevLineEndWordIndex + 1] as HTMLElement,
@@ -534,7 +534,7 @@ function getHighlightWidth(
534534
}
535535

536536
// If highlight is just one line...
537-
if (lineIndexOfWordStart == lineIndexOfWordEnd) {
537+
if (lineIndexOfWordStart === lineIndexOfWordEnd) {
538538
const highlightRect = Misc.getBoundingRectOfElements([startWord, endWord]);
539539
const lastWordElRect = endWord.getBoundingClientRect();
540540

frontend/src/ts/elements/test-activity-calendar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export class TestActivityCalendar implements TestActivityCalendar {
111111
text: format(month, "MMM").toLowerCase(),
112112
weeks: weeks,
113113
});
114-
} else if (i == 0) {
114+
} else if (i === 0) {
115115
results.push({ text: "", weeks: weeks });
116116
}
117117
}
@@ -148,7 +148,7 @@ export class TestActivityCalendar implements TestActivityCalendar {
148148
level: getValue(count),
149149
label:
150150
count !== undefined && count !== null
151-
? `${count} ${count == 1 ? "test" : "tests"} on ${day}`
151+
? `${count} ${count === 1 ? "test" : "tests"} on ${day}`
152152
: `no activity on ${day}`,
153153
});
154154
currentDate = addDays(currentDate, 1);

frontend/src/ts/elements/test-activity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function updateLabels(firstDayOfWeek: number): void {
143143
const days: (string | undefined)[] = [];
144144
for (let i = 0; i < 7; i++) {
145145
days.push(
146-
i % 2 != firstDayOfWeek % 2
146+
i % 2 !== firstDayOfWeek % 2
147147
? daysDisplay[(firstDayOfWeek + i) % 7]
148148
: undefined
149149
);

frontend/src/ts/elements/xp-bar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ async function addBreakdownListItem(
215215
</div>`
216216
);
217217
} else {
218-
const positive = amount == undefined ? undefined : amount >= 0;
218+
const positive = amount === undefined ? undefined : amount >= 0;
219219

220220
xpBreakdownListEl.append(`
221221
<div class="line" data-string='${string}'>

frontend/src/ts/pages/leaderboards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ function updateGetParameters(): void {
11401140
function readGetParameters(): void {
11411141
const urlParams = new URLSearchParams(window.location.search);
11421142

1143-
if (urlParams.size == 0) {
1143+
if (urlParams.size === 0) {
11441144
Object.assign(state, selectorLS.get());
11451145
return;
11461146
}

frontend/src/ts/test/caret.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,13 @@ export async function updatePosition(noAnim = false): Promise<void> {
219219
}
220220

221221
const smoothCaretSpeed =
222-
Config.smoothCaret == "off"
222+
Config.smoothCaret === "off"
223223
? 0
224-
: Config.smoothCaret == "slow"
224+
: Config.smoothCaret === "slow"
225225
? 150
226-
: Config.smoothCaret == "medium"
226+
: Config.smoothCaret === "medium"
227227
? 100
228-
: Config.smoothCaret == "fast"
228+
: Config.smoothCaret === "fast"
229229
? 85
230230
: 0;
231231

frontend/src/ts/test/funbox/funbox-functions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ async function readAheadHandleKeydown(
6060
const isCorrect = inputCurrentChar === wordCurrentChar;
6161

6262
if (
63-
event.key == "Backspace" &&
63+
event.key === "Backspace" &&
6464
!isCorrect &&
65-
(TestInput.input.current != "" ||
66-
TestInput.input.getHistory(TestState.activeWordIndex - 1) !=
65+
(TestInput.input.current !== "" ||
66+
TestInput.input.getHistory(TestState.activeWordIndex - 1) !==
6767
TestWords.words.get(TestState.activeWordIndex - 1) ||
6868
Config.freedomMode)
6969
) {
7070
$("#words").addClass("read_ahead_disabled");
71-
} else if (event.key == " ") {
71+
} else if (event.key === " ") {
7272
$("#words").removeClass("read_ahead_disabled");
7373
}
7474
}

0 commit comments

Comments
 (0)