monkeytype icon indicating copy to clipboard operation
monkeytype copied to clipboard

Replace JSON.parse with parseJsonWithSchema

Open fehmer opened this issue 1 year ago • 2 comments

Replace JSON.parse with Misc.parseJsonWithSchema for type safety.

Example: https://github.com/monkeytypegame/monkeytype/blob/2a0a5b408cc38a678328c2ff44e281416ebb9c4d/frontend/src/ts/utils/url-handler.ts#L68-L92

fehmer avatar Sep 13 '24 10:09 fehmer

I think before we do this we should extract common util functions (like this one) to a package.

Miodec avatar Sep 14 '24 08:09 Miodec

It should be go on the discussion.

rajneesh-18 avatar Oct 05 '24 06:10 rajneesh-18

Hi @fehmer, Could you assign me that issue.

mohitpaddhariya avatar Jan 22 '25 10:01 mohitpaddhariya

@dev-mohit06 I'd say just work on it and create a PR

fehmer avatar Jan 22 '25 11:01 fehmer

Hey @fehmer, I’d prefer to avoid duplication of effort, so could you assign this issue to me if possible?

mohitpaddhariya avatar Jan 22 '25 11:01 mohitpaddhariya

@fehmer - Could you please indicate which files in the frontend need JSON.parse replacements? This will help ensure I cover all necessary changes.

mohitpaddhariya avatar Jan 22 '25 15:01 mohitpaddhariya

https://github.com/search?q=repo%3Amonkeytypegame%2Fmonkeytype+JSON.parse+language%3ATypeScript+path%3A%2F%5Efrontend%5C%2Fsrc%5C%2Fts%5C%2F%2F&type=code

fehmer avatar Jan 22 '25 16:01 fehmer

@fehmer thanks for helping me out

mohitpaddhariya avatar Jan 22 '25 18:01 mohitpaddhariya

Isn't this done in #6207?

nadalaba avatar Mar 17 '25 15:03 nadalaba

Isn't this done in #6207?

Backend is not using parseJsonWithSchema yet

Miodec avatar Mar 17 '25 15:03 Miodec

@Miodec I will be happy to do that. I will start now onwards.

mohitpaddhariya avatar Mar 18 '25 03:03 mohitpaddhariya

Isn't this done in #6207?

Backend is not using parseJsonWithSchema yet

been a while, should I give it a try?

byseif21 avatar Apr 21 '25 23:04 byseif21

@byseif21 broo I already finished 😅

mohitpaddhariya avatar Apr 22 '25 12:04 mohitpaddhariya

@byseif21 broo I already finished 😅

Oh shit, my bad! 😅 I thought you kinda had enough after the Frontend and won’t tackle this. I even checked the repos before going for it and noticed you hadn’t been active for a bit, so I assumed you were sitting this one out. Sorry for the overlap! I’ve got PR #6481 up with the changes. Can you take a look and let me know your thoughts? sorry again I really thought you won't do it :(

byseif21 avatar Apr 22 '25 14:04 byseif21

@byseif21 no problem

mohitpaddhariya avatar Apr 22 '25 19:04 mohitpaddhariya