-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to make Cljs warnings fatal #106
Comments
With the warnings on fileset metadata this could even be a separate task. Not sure if there is much value in that besides keeping code out of the regular |
Yes, warning/error info on the fileset would be a great way to solve this. If we could draft a standard for this (perhaps functions in boot.core) then we could make completely separate tasks that could fail on error, print messages in some preferred format, send messages to other services, etc. The way it would work is the task that catches the error/warning/etc would attach that info to the fileset as metadata and passit down the pipeline. If a subsequent task handles it that task can remove the metadata from the fileset before it passes it on to the next task. Thus, when the fileset bubbles back up to the task where the error originated it can handle it in some default way if the metadata is still on the fileset. |
We have the following task in a project: (defn throw-when-cljs-warnings []
(b/with-pre-wrap fileset
(let [warnings (->> fileset
all-cljs-builds
(map :adzerk.boot-cljs/warnings)
(apply merge)
(remove empty?))]
(when (seq warnings)
(throw (Exception. "There were warnings from the cljs compile step!")))
fileset))) It works for us, helped catching some warnings :) |
@nberger thanks for the snippet, looks great. Adding this as a boot-cljs option would be a great addition however. I asked elsewhere if a "strict mode" (like |
@nberger @pesterhazy any of you up for making a PR? :) |
@martinklepsch, would love to but don't know when I'll get a chance |
See http://jakemccrary.com/blog/2015/12/19/clojurescript-treat-warnings-as-errors/ as an example of how to do this, with lein-cljsbuild. |
Boot-cljs overwrites the warning-handler to store the warnings in the fileset metadata, so that is not going to work with Boot-cljs current: https://github.com/adzerk-oss/boot-cljs/blob/master/src/adzerk/boot_cljs/impl.clj#L91 Boot-cljs could add the handler to those set by user, but I'm not sure if this is very useful. A separate task or option is good idea for this. |
For production builds it would be useful to have Cljs task fail completely if there are any warnings.
I think this should be a separate option.
The text was updated successfully, but these errors were encountered: