Created by: emmenko
Summary
This PR introduces a small change in the eslint rule of webpack.config to exclude files ending with the suffix *.bs.js
(which are compiled files generated by BuckleScript).
NOTE: I'm no RegEx expert, so if someone has a better suggestion about the test rule feel free to leave a comment
🙏
Background
When working on a React project which includes fully or partially ReasonML, you need BuckleScript to generate the compiled JS sources. When you have the in-source
option active you will get the compiled JS sources (*.bs.js
) next to the Reason source file.
Those files will therefore "live" inside the src
folder, causing eslint to print some warnings:
This is a bit annoying and can simply be "solved" by telling eslint to ignore those files.
reason-scripts
?
Wait, ReasonML? What about As you might know, there is a package called reason-scripts
which is basically a "clone" of react-scripts
, with some things adapted to compile Reason files out of the box (e.g. entry point index.re
instead of index.js
).
However, as I pointed out in this issue, I don't think it's necessary to have reason-scripts
in the first place.
@rrdelaney also pointed out (correctly if I'm wrong) that bs-loader
should not be included in the package anymore.
In fact, you can run the BuckleScript compiler in watch mode as a parallel process, next to react-scripts start
. This way you don't need the loader at all and you can simply use the "normal" react-scripts
package.
"scripts": {
"start": "npm-run-all --parallel start:bsb start:app",
"start:app": "react-scripts start",
"start:bsb": "bsb -make-world -w",
}
Anyway, this is another story...
Btw, this change will need to be made in
reason-scripts
as well.
Hopefully this gives you enough background/context to understand this change. I'm open to any feedback/suggestion.
Thanks