astro/packages/integrations
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
..
alpinejs Move code block titles into comments to match docs (#7543) 2023-07-01 16:34:49 +02:00
cloudflare [ci] release (#8090) 2023-08-15 16:12:45 -05:00
deno [ci] release (#8090) 2023-08-15 16:12:45 -05:00
image [ci] release (#8090) 2023-08-15 16:12:45 -05:00
lit [ci] release (#7958) 2023-08-07 13:51:05 -05:00
markdoc [ci] release (#8090) 2023-08-15 16:12:45 -05:00
mdx Refactor and improve Astro config loading flow (#7879) 2023-08-01 17:11:26 +08:00
netlify [ci] release (#8090) 2023-08-15 16:12:45 -05:00
node [ci] release (#8090) 2023-08-15 16:12:45 -05:00
partytown fix broken partytown GitHub link (#7954) 2023-08-04 11:45:32 +02:00
preact [ci] release (#8000) 2023-08-09 15:31:34 -05:00
prefetch Fix prefetch test fail (#7902) 2023-08-01 23:05:36 +08:00
react [ci] release (#8064) 2023-08-15 22:35:58 +08:00
sitemap [ci] release (#8064) 2023-08-15 22:35:58 +08:00
solid nit: use node: prefix everywhere (#7692) 2023-07-18 02:17:59 +02:00
svelte Filter out Svelte's unknown class prop console warnings (#7291) 2023-08-15 17:31:01 -05:00
tailwind [ci] release (#8090) 2023-08-15 16:12:45 -05:00
turbolinks Format markdown files (#7439) 2023-06-26 11:34:13 +08:00
vercel [ci] release (#8090) 2023-08-15 16:12:45 -05:00
vue [ci] release (#8090) 2023-08-15 16:12:45 -05:00