svelte-markdown icon indicating copy to clipboard operation
svelte-markdown copied to clipboard

Remove supress warnings

Open dogagenc opened this issue 2 years ago • 7 comments

The code line console.warn = ... is causing an error in Firefox that interrupts the program's execution. In addition, I believe that it is not advisable to silence warnings from the framework or UI library when they are used as a sub-package.

dogagenc avatar Mar 04 '23 12:03 dogagenc

Hey! Is there a way to silence this warnings now? This was added due to many complaints about the "unused prop" warnings. The console can be flooded by these.

pablo-abc avatar May 30 '23 19:05 pablo-abc

Hey! Is there a way to silence this warnings now? This was added due to many complaints about the "unused prop" warnings. The console can be flooded by these.

@pablo-abc It is not wise to clear Svelte warnings. What if you miss a warning that helps you to fix a bug? I recommend that you keep it as is. You can always enable/disable warnings in browser console.

dogagenc avatar May 30 '23 21:05 dogagenc

Second the change. Silently modifying globals is a sure way to cause a lot of pain. If it helps, all modern consoles have filters that can be used to tune out unwanted logs.

aryzing avatar Oct 03 '23 13:10 aryzing

@aryzing Maintainer seems unresponsive. So, i have created and published fixed version to npm. See my comment here:

https://github.com/pablo-abc/svelte-markdown/issues/64#issuecomment-1454863643

dogagenc avatar Oct 03 '23 15:10 dogagenc

Thank you @dogagenc. I'll take a look at your fork.

Fyi @pablo-abc, if you've got too much on your plate now, you may want to consider adding contributors to this repo. Seems that if this repo doesn't receive more attention, more forks may start to take off. Given this repo's popularity, seems we would best served by capturing further improvements here.

aryzing avatar Oct 03 '23 15:10 aryzing

@pablo-abc suppressWarnings() appears to be killing our server, because you only undo the override in onMount i.e. on the client, so the server call-stack for console.warn just grows and grows 💥.

2023-11-27T11:20:41.244562118Z server-error-hook RangeError: Maximum call stack size exceeded
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3981:18)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
2023-11-27T11:20:41.244590339Z     at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
2023-11-27T11:20:41.244610389Z     at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
    at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5)
2023-11-27T11:20:41.244616359Z     at console.warn (file:///app/server/chunks/FormError-9675a090.js:3986:5) {

myieye avatar Nov 27 '23 11:11 myieye

FYI I opened a PR which is a bit less drastic than just suppressing all the warnings (which are truly annoying). I also noticed that even SvelteKit supresses warnings like this, so it seems fairly reasonable if done well.

myieye avatar Nov 28 '23 11:11 myieye