nabla / vite-plugin-eslint

Plugs ESLint into Vite dev server
MIT License
125 stars 4 forks source link

Fix bug + Add quality of life features #21

Closed stereokai closed 1 year ago

stereokai commented 1 year ago
  1. Fixed a bug where setting ESLint options { errorOnUnmatchedPattern: false } would cause the plugin to fail
  2. Improved how the file path is calculated and presented to user
  3. Adjusted terminal logs to match Vite standard
  4. Ensured all references to plugin name are identical and follow standards
ArnaudBarre commented 1 year ago

I've taken 1. & 4. into the latest release, thanks for pointing out those. While I'm not against 3, your change 2 feels like you should provide your own logger because this since really a personal need to not print path too long.

stereokai commented 1 year ago

Hi @ArnaudBarre, I apologize, I missed your review from August 11. Please allow me to reply now:

I've taken 1. & 4. into the latest release, thanks for pointing out those.

Happy to hear that!

While I'm not against 3, your change 2 feels like you should provide your own logger because this since really a personal need to not print path too long.

I am not familiar with the ability to provide own logger. Is it simply using the builtin ESLint formatters?

ArnaudBarre commented 1 year ago

Yes I don't now the exact API but if you pass a path to the formatter option of the plugin it will be passed to ESLint.loadFormatter. I agree this is not as simple of providing a callback but I least you can get full control.

stereokai commented 1 year ago

Cool. What if you allowed either to use ESLint.loadFormatter and as an alternative, allow passing a custom formatter, so a custom behavior can be implemented? (on a different property, say customFormatter) Then everybody wins :)

ArnaudBarre commented 1 year ago

Because ESLint doesn't support passing a function, this could be done by allowing function for the formatter option directly. But this requires passing back message from the worker to the main thread which is ok but not one liner.

stereokai commented 1 year ago

What I mean is to simply expose the path that is log and the error level (this is already available in the plugin scope) to the user, and then they can pass in a function to the plugin that can accept that and they can log it however they like, to fit their desired developer experience :)

On Thu, Nov 16, 2023, 15:11 Arnaud Barré @.***> wrote:

Because ESLint doesn't support passing a function, this could be done by allowing function for the formatter option directly. But this requires passing back message from the worker to the main thread which is ok but not one liner.

— Reply to this email directly, view it on GitHub https://github.com/nabla/vite-plugin-eslint/pull/21#issuecomment-1814509219, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUPTLI4ZFXAAAUDJXG6M23YEYNKXAVCNFSM6AAAAAA3BM4ED6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJUGUYDSMRRHE . You are receiving this because you authored the thread.Message ID: @.***>

ArnaudBarre commented 1 year ago

Available in v2 🎉

stereokai commented 1 year ago

Awesome! Thank you very much 😎