Skip to content

Commit 1121296

Browse files
authored
chore: remove last bits of jquery (@Miodec) (#7410)
<img width="247" height="168" alt="image" src="https://github.com/user-attachments/assets/2e1625f7-ad38-4144-9804-cbcbb5d83dd7" />
1 parent 0d08924 commit 1121296

File tree

13 files changed

+3
-124
lines changed

13 files changed

+3
-124
lines changed

docs/CONTRIBUTING_ADVANCED.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ If you are on a UNIX system and you get a spawn error, run npm with `sudo`.
150150

151151
Code formatting is enforced by [Prettier](https://prettier.io/docs/en/install.html), which automatically runs every time you make a commit.
152152

153-
We are currently in the process of converting from JQuery to vanilla JS. When submitting new code, please use the `qs`, `qsa` and `qsr` helper functions. These return a class with a lot of JQuery-like methods. You can read how they work and import them from `frontend/src/ts/utils/dom.ts`.
154-
155153
For guidelines on commit messages, adding themes, languages, or quotes, please refer to [CONTRIBUTING.md](./CONTRIBUTING.md). Following these guidelines will increase the chances of getting your change accepted.
156154

157155
## Questions

frontend/__tests__/__harness__/setup-jquery.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

frontend/__tests__/utils/dom.jsdom-spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ describe("dom", () => {
2626
handler({
2727
target: e.target,
2828
childTarget: e.childTarget,
29-
//@ts-expect-error will be added later, check TODO on the ChildEvent
3029
currentTarget: e.currentTarget,
3130
}),
3231
);
@@ -130,10 +129,6 @@ describe("dom", () => {
130129
await userEvent.click(clickTarget);
131130

132131
//THEN
133-
134-
//This is the same behavior as jQuery `.on` with selector.
135-
//The handler will be called two times,
136-
//It does NOT call on the <section> or the parent element itself
137132
expect(handler).toHaveBeenCalledTimes(2);
138133

139134
//First call is for childTarget inner2 (grand child of parent)

frontend/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"hangul-js": "0.2.6",
4848
"howler": "2.2.3",
4949
"idb": "8.0.3",
50-
"jquery": "3.7.1",
5150
"konami": "1.7.0",
5251
"lz-ts": "1.1.2",
5352
"modern-screenshot": "4.6.5",
@@ -73,7 +72,6 @@
7372
"@types/chartjs-plugin-trendline": "1.0.1",
7473
"@types/damerau-levenshtein": "1.0.0",
7574
"@types/howler": "2.2.7",
76-
"@types/jquery": "3.5.14",
7775
"@types/node": "24.9.1",
7876
"@types/object-hash": "3.0.6",
7977
"@types/subset-font": "1.4.3",

frontend/src/ts/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ addToGlobal({
9797
});
9898

9999
if (isDevEnvironment()) {
100-
void import("jquery").then((jq) => {
101-
addToGlobal({ $: jq.default });
102-
});
103100
void getDevOptionsModal().then((module) => {
104101
module.appendButton();
105102
});

frontend/src/ts/test/test-logic.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ type RestartOptions = {
131131
noAnim?: boolean;
132132
};
133133

134-
// withSameWordset = false,
135-
// _?: boolean, // this is nosave and should be renamed to nosave when needed
136-
// event?: JQuery.KeyDownEvent,
137-
// practiseMissed = false,
138-
// noAnim = false
139-
140134
export function restart(options = {} as RestartOptions): void {
141135
const defaultOptions = {
142136
withSameWordset: false,

frontend/src/ts/utils/dom.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,9 @@ type ElementWithValue =
153153

154154
type ElementWithSelectableValue = HTMLInputElement | HTMLTextAreaElement;
155155

156-
//TODO: after the migration from jQuery to dom-utils we might want to add currentTarget back to the event object, if we have a use-case for it.
157-
// For now we remove it because currentTarget is not the same element when using dom-utils intead of jQuery to get compile errors.
158-
export type OnChildEvent<T extends Event = Event> = Omit<T, "currentTarget"> & {
156+
export type OnChildEvent<T extends Event = Event> = T & {
159157
/**
160-
* target element matching the selector. This emulates the behavior of `currentTarget` in jQuery events registered with `.on(events, selector, handler)`
158+
* target element matching the selector.
161159
*/
162160
childTarget: EventTarget | null;
163161
};

frontend/src/ts/utils/misc.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -409,40 +409,6 @@ export function isAnyPopupVisible(): boolean {
409409
return popupVisible;
410410
}
411411

412-
export type JQueryEasing =
413-
| "linear"
414-
| "swing"
415-
| "easeInSine"
416-
| "easeOutSine"
417-
| "easeInOutSine"
418-
| "easeInQuad"
419-
| "easeOutQuad"
420-
| "easeInOutQuad"
421-
| "easeInCubic"
422-
| "easeOutCubic"
423-
| "easeInOutCubic"
424-
| "easeInQuart"
425-
| "easeOutQuart"
426-
| "easeInOutQuart"
427-
| "easeInQuint"
428-
| "easeOutQuint"
429-
| "easeInOutQuint"
430-
| "easeInExpo"
431-
| "easeOutExpo"
432-
| "easeInOutExpo"
433-
| "easeInCirc"
434-
| "easeOutCirc"
435-
| "easeInOutCirc"
436-
| "easeInBack"
437-
| "easeOutBack"
438-
| "easeInOutBack"
439-
| "easeInElastic"
440-
| "easeOutElastic"
441-
| "easeInOutElastic"
442-
| "easeInBounce"
443-
| "easeOutBounce"
444-
| "easeInOutBounce";
445-
446412
export async function promiseAnimate(
447413
el: HTMLElement | string,
448414
options: AnimationParams,

frontend/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "@monkeytype/typescript-config/base.json",
33
"compilerOptions": {
44
"lib": ["ESNext", "DOM", "DOM.Iterable"],
5-
"types": ["vite/client", "node", "jquery"],
5+
"types": ["vite/client", "node"],
66
"moduleResolution": "Bundler",
77
"module": "ESNext",
88
"allowUmdGlobalAccess": true,

frontend/vite-plugins/jquery-inject.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)