ml-in-barcelona / jsoo-react

js_of_ocaml bindings for ReactJS. Based on ReasonReact.
https://ml-in-barcelona.github.io/jsoo-react
MIT License
138 stars 19 forks source link

Add linting on js files #14

Closed jchavarri closed 5 years ago

jchavarri commented 5 years ago

There are some basic mistakes that can happen all the time in .js files. Adding eslint (or typescript?) would help mitigate that.

jchavarri commented 5 years ago

We could also use BuckleScript (kidding / not kidding ) 😄

schinns commented 5 years ago

lol, I kinda like the idea of using BuckleScript. that would take care of both linting and type.

jchavarri commented 5 years ago

Yeah 😄 I have been thinking more, and if extra tooling is going to be added, we could just as well use jsoo Js module, and ppx (obj##.property, obj##method), which has quite good support to deal with JS data types (actually BuckleScript was inspired from it in many ways).

As an example, this:

https://github.com/jchavarri/rroo/blob/4aac16dac3c6fed395805b33c4e0ae6035a27ce6/lib/InteropUtils.js#L11-L13

would become this:

Js.Opt.to_option

😂

Maybe a small experiment with useState for example would throw more light, but it seems like the simplest path forward. If that was the case the external go away and are replaced with regular let where the converted logic for each function would go.

schinns commented 5 years ago

I wish I had more experience with jsoo to give constructive input. Although it's very fascinating to learn where bs drew some inspiration. 😅

So if I understand correctly, if we decided to just use the jsoo, lib/React.js would be replaced with one jsoo ffi implementation? Any no need for externals ?

jchavarri commented 5 years ago

@benschinn Exactly! No need for .js files anymore.