Move forward with warn-as-error by default

we set mtime of generated js file to be 0 and change the build system to think it is non-exist. Will publish a dev release for testing

1 Like

Awesome @Hongbo! This would really be best of both worlds.

bs-platform@8.3.0-dev.2 is available for testing
The obvious difference (desired behavior):

  • projects built which has warnings will have an exit code which is not 0
  • files with warnings will always trigger rebuild

The non-obvious difference:

  • generated js files which come from modules with warnings will have a faked old timestamp
  • If you have a js_post_build_command (ignore if you don’t know about it), it will not be triggered when the module has warnings
12 Likes

Sounds like the perfect compromise. I also like the non-zero exit code, to fail the CI when there are warnings, but still have a good dev experience.

I have to say I’m really impressed by the work you’ve done @Hongbo, managing to get the best experience for both use cases. It must be really hard to satisfy everybody and listening to feedback must sometimes feel overwhelming but that leads to great solutions, thank you a lot for taking the time! We not only have the best alt-js language, we also have a great community and it’s really cool to be able to benefit from it :smiley:

8 Likes

Just tested it on a large code base (I’m on OSX): The hack works like a charm. An error is reported but the file is built. Gotta love the wizardry :clap:t2:

4 Likes

Just tested it, too, and it worked perfectly. This is a huge relief! Thanks again for your awesome work @Hongbo! :smiley: :+1:

2 Likes

Will there be a proper solution for this “hack”? Faking the timestamp is interacting badly with the metro build system of react-native (probably it tracks if the timestamp to see if the file has been updated), so need to resolve all warnings first before a good fast-refresh is happening.

is the warn as error (but trigger build for non critical errors) default behavior in latest version? if not how can I enable it?

You can set:

"warnings" : { "error" : true}

in you config.

Note we introudced a more advanced approach so that warnigns are always reproducible without enforcing warn-as-error

2 Likes