How can we fail a build job if JSBeautifier in Grunt needs to format a file?

126 Views Asked by At

Usually certain Grunt tasks have the option to "fail on warning", making it possible to put it as a step in your build process.

I am looking at JSBeautifier but it seems like there is no option.

Any suggestions on how we can make our build fail, if a JavaScript file gets formatted by JSBeautifier a build step?

1

There are 1 best solutions below

0
On BEST ANSWER

If mode is "VERIFY_ONLY", then task will fail if at least one file can be beautified. This is useful for pre-commit check.

https://www.npmjs.com/package/grunt-jsbeautifier#options-mode-optional