indykoning / grumphp-prettier

0 stars 1 forks source link

Any way to specify the plugin to automatically fix prettier errors? #1

Open sharafat opened 6 days ago

sharafat commented 6 days ago

@indykoning Hi! Thanks a lot for the nice plugin! I've been using it regularly. However, I wish the plugin could automatically fix the prettier errors instead of prompting to fix it. Is there any way I can achieve that? Thanks.

indykoning commented 6 days ago

Currently that is not possible because we use a "FixableProcessResultProvider" which means it will give you the option to fix automatically, or fix it automatically in git context using fix_by_default https://github.com/indykoning/grumphp-prettier/blob/master/src/PrettierTask.php#L135

However, because of the nature of how GrumPHP deals with failed tasks it will not silently add the files in the background while you commit. But it cancels your commit so you can review the changes. (which is how i prefer it, but i can understand why someone would want it that way)

Maybe we could head the same way as this Pint task as https://github.com/YieldStudio/grumphp-laravel-pint/blob/main/src/LaravelPintTask.php#L106