astro/packages
Eric Mika 0bf2cca5d7
Filter out Svelte's unknown class prop console warnings (#7291)
* Filter out Svelte's unexpected class prop console warnings

Astro's hydration code passes a `class` prop to Svelte components, inducing Svelte to log a warning about an unknown prop. Preempting this by exporting a `class` prop from the Svelte component isn't a viable workaround since `class` is a reserved identifier in JS.

This PR implements the console-filtering workaround suggested by @HiDeoo in #5665, borrowing the `useConsoleFilter` approach from the [preact integration](a1c0cbe604/packages/integrations/preact/src/server.ts (L72-L94)).

It would probably be better to generalize console filtering so it could be shared across multiple integrations.

Ideally there would be a way to handle this in Svelte, but as was pointed out in the issue thread even they resort to [similar cringe-inducing hackery](https://github.com/sveltejs/kit/blob/master/packages/kit/src/runtime/client/client.js#L1974-L1996) in sveltekit.

* Only filter Svelte console warnings in dev builds

* Add changeset

* Fix lint error.

---------

Co-authored-by: bluwy <bjornlu.dev@gmail.com>
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-08-15 17:31:01 -05:00
..
astro [ci] release (#8090) 2023-08-15 16:12:45 -05:00
astro-prism nit: export props has been unnecessary.. forever (#7646) 2023-07-14 09:57:06 -04:00
astro-rss [ci] release (#7958) 2023-08-07 13:51:05 -05:00
create-astro [ci] release (#8090) 2023-08-15 16:12:45 -05:00
integrations Filter out Svelte's unknown class prop console warnings (#7291) 2023-08-15 17:31:01 -05:00
internal-helpers [ci] release (#7937) 2023-08-03 15:16:51 -04:00
markdown Fix organize-imports-cli with satisfies operator (#7727) 2023-07-20 20:47:36 +08:00
telemetry Fix organize-imports-cli with satisfies operator (#7727) 2023-07-20 20:47:36 +08:00
underscore-redirects [ci] release (#7624) 2023-07-13 21:43:11 +08:00
webapi Improve sourcemap generation and performance (#7901) 2023-08-02 11:30:53 +08:00