figwheel-main
figwheel-main copied to clipboard
How to treat warnings as errors?
I'm trying to use figwheel-main
to produce the final minified js file and can't find the way to fail the build in case JS warnings are detected:
2019-02-19 00:40:33.016:INFO::main: Logging initialized @4830ms
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build min to "resources/public/js/spa.js"
[Figwheel:WARNING] Compile Warning /Users/yuri/xxxx line:44 column:22
Use of undeclared Var app.app/app123
...
[Figwheel] Successfully compiled build min to "resources/public/js/spa.js" in 61.212 seconds.
With cljsbuild
it was possible to achieve via :warning-handlers
(http://jakemccrary.com/blog/2015/12/19/clojurescript-treat-warnings-as-errors/).
This is crucial for automated CI builds. We don't want to deploy the buggy bundle.
So this is certainly possible and it sounds like a good feature to explore. The idea of failing on warnings when you are doing a build-once context. I like the idea of having this as a flag.
For reference, I've found some :warning-handlers
in figwheel.main
, for example here but it doesn't seem used.
Would you accept @bhauman to give some breadcrumbs about how to implement that, and would you consider a PR if you think it's a good first issue?