vite-plugin-checker icon indicating copy to clipboard operation
vite-plugin-checker copied to clipboard

Show warnings only in console

Open GabriFila opened this issue 3 years ago • 10 comments

Hi, love this plugin!

Is there a way to now show any kind of warning (TS, ESlint, ...) as an overlay but show them only in the console? A bit like CRA behaves?

Thank you

GabriFila avatar Feb 21 '22 20:02 GabriFila

It's not configurable to disable the runtime code for now. But as a workaround, you can pass display: none; to the badgeStyle property to hide the badge entirely at development mode and no runtime of this plugin will be bundled in production mode. Check the documentaion https://github.com/fi3ework/vite-plugin-checker/blob/main/README.md#checker-common-config

fi3ework avatar Feb 22 '22 03:02 fi3ework

I didn't fully understand your answer, why do you mention runtime code? How difficult would it be to add this feature? Could I make a PR?

Thanks

GabriFila avatar Feb 22 '22 08:02 GabriFila

configure it like this and the badge will disappear.

export default defineConfig({
  plugins: [
    checker({
      overlay: { badgeStyle: 'display: none;' , }
    }),
  ],
})

The runtime code refers to the overlay code which is injected into the index.html under development mode. Ideally, if we disable the overlay, there's no injected runtime code at all. But for now, we can display: none to achieve the same target, but there's still runtime code injected without visibility. I can't tell how much it will cost to make a PR. Feel free to commit any code even you are not sure does it OK with all edge cases.

fi3ework avatar Feb 22 '22 08:02 fi3ework

@fi3ework I think what @GabriFila was trying to say is that if the warnings (most likely from ESLint) in the overlay could be hidden (not by default, but configurable) but visible in the terminal output.

SutuSebastian avatar Aug 05 '22 12:08 SutuSebastian

Yes that's it. Since the popup is blocking, to me it makes sense to have it only when it is an error. I like to see warnings only in the console like "I know it's there but I'll think about it later"

GabriFila avatar Aug 05 '22 13:08 GabriFila

@GabriFila I want to achieve the same exact behaviour 👍

SutuSebastian avatar Aug 05 '22 13:08 SutuSebastian

This issue is done, isn't it? I was able to disable the overlay with overlay: false:

plugins: [vue(), checker({ eslint: { lintCommand: 'eslint src' }, overlay: false })],

AndreKR avatar Aug 08 '22 19:08 AndreKR

@AndreKR the main issue is that we can't control the granularity on the "disabled" state of, for example: "warnings", being enabled in terminal output but disabled in the overlay.

SutuSebastian avatar Aug 08 '22 19:08 SutuSebastian

Hard agree. Would love to see both TS errors and eslint warnings in the console, but only ts errors in the overlay

slutske22 avatar Dec 28 '23 14:12 slutske22

Note to Quasar users. Plugin checker config is found in quasar.config.js

image

moander avatar Mar 13 '24 17:03 moander