jfmengels / node-elm-review

CLI for elm-review
https://package.elm-lang.org/packages/jfmengels/elm-review/latest/
BSD 3-Clause "New" or "Revised" License
48 stars 25 forks source link

Add types to JS files #125

Closed jfmengels closed 3 weeks ago

jfmengels commented 1 year ago

I have added TypeScript to the project to help out with finding bugs during development.

Unfortunately, because without type annotations it determines that the arguments of pretty much every function is any, it doesn't report many problems in practice.

The idea is to add more types, so that there are none of these implicits any.

I have added TypeScript configuration that enables that setting for a few files, and have added all the necessary annotations for them, but I'm still missing a lot of the files. You can run it using

npx tsc --project tsconfig.no-implicit-any.json --watch

The idea is to update the tsconfig.no-implicit-any.json by adding a new file in the include list one and adding types until there are no more issues, and repeating until all files are done and we can enable the noImplicitAny setting in the regular tsconfig.json file. I recommend adding new files that only import files that are already in the include list. (To do that, just add an arbitrary file, and if TS reports issues for other files, then choose one of those files instead, and so on).

Note that adding type annotations and fixing issues can result in the "main" tsconfig.json starting to report new issues.

If you'd like to work on this, great! And thank you! Feel free to do as much or as little as you wish, I recommend to do small steps in this work, and to do for instance one PR per file added.

lishaduck commented 5 months ago

For the sake of future reference: #165, #166, #177, #179, #180, #181, #182, & #183.

lishaduck commented 4 months ago

Status: 30/51 production JS files (59%) (Not including tests, generated files, vendor, all of which are fully typed)

lishaduck commented 3 weeks ago

Making progress in #301!

Status: 41/53 files (77%)

lishaduck commented 3 weeks ago

I have an essay I don't wanna write, grinding these out: 48/53 (91%)!

jfmengels commented 3 weeks ago

I highly appreciate the work and excitement, but go write your essay! :sweat_smile: (as much as I understand why you prefer doing something else)

lishaduck commented 3 weeks ago

I highly appreciate the work and excitement, but go write your essay! ๐Ÿ˜… (as much as I understand why you prefer doing something else)

I know, I know. I'm gonna go finish it now ๐Ÿ™ƒ I do like writing, and I like the topic, this is just a lot more fun... Oh, to clarify, I only spent ~45 minutes not writing an essay. The rest of the day was mostly free (and I didn't spend the whole day doing this, either).

Well, off to write another couple hundred words... ๐Ÿ˜…

lishaduck commented 3 weeks ago

Oh, can you close #132 as superseded, @jfmengels?