developer-stylechain / gulp-stylelint

Gulp plugin for running Stylelint results through various reporters.
MIT License
14 stars 4 forks source link

Using fix:true overwrites the file with an error if it fails. #7

Open theenoahmason opened 1 year ago

theenoahmason commented 1 year ago

If an error prevents the fix from completing, like if there is a missing bracket, the file is overwritten with the error.

I cannot get the task to fail before the file is written.

smustgrave commented 11 months ago

Verified I'm seeing this too. The fix flag doesn't seem to do anything.

ronilaukkarinen commented 10 months ago

This is actually something I'm not sure how to fix. I'll investigate it later. Help appreciated.

theenoahmason commented 10 months ago

Just thinking out loud:

I would say you need to emit an error, and instruct the user to always listen for the error so they can emit an end to the process before writing it to the file.

This may require splitting the processing and writing to 2 different functions so the user can bail before its written.

OR it may be as simple as just adding an option for like a "bailOnError" flag where it doesn't write the file if it has an error or something?