sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.36k stars 4.1k forks source link

Svelte 5: `svelte-ignore unused-export-let` is ignored #11890

Closed kyoshino closed 3 months ago

kyoshino commented 3 months ago

Describe the bug

When I build my Sveltia CMS app with Svelte 5 RC, I see a bunch of warnings about unused exports, e.g.

[vite-plugin-svelte] src/lib/components/contents/details/widgets/string/string-editor.svelte:15:13 Component has unused export property 'locale'. If it is for external reference only, please consider using export const locale

Here’s the relevant code.

I’ve noticed in #11833 that at some point svelte-ignore unused-export-let has become svelte-ignore export_let_unused. I can confirm that changing unused-export-let to export_let_unused can silence the warnings.

If it’s an intentional change, please mention it in the breaking changes document. Otherwise, please restore the support for unused-export-let and possibly other warning codes.

Additional context: These unused exports are used along with svelte-ignore unused-export-let to suppress browser console warnings like <String_editor> was created with unknown prop 'locale'. These components are loaded with <svelte:component>, and not all the components use all the props. It may no longer be necessary after migrating to the Svelte 5 $props rune (I haven’t tested it yet.) (Edit: it seems so, according to #4652)

Reproduction

  1. Clone the Sveltia CMS repo
  2. Run pnpm install svelte@next -D && pnpm build

Logs

No response

System Info

System:
    OS: macOS 14.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 549.19 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 20.14.0 - /usr/local/opt/node@20/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.7.0 - /usr/local/opt/node@20/bin/npm
    pnpm: 9.1.4 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 125.0.6422.142
    Firefox Nightly: 124.0a1
    Safari: 17.5
  npmPackages:
    svelte: 5.0.0-next.148 => 5.0.0-next.148

Severity

annoyance

dummdidumm commented 3 months ago

This is a bug in our legacy mode: replacements in extract_svelte_ignore.js needs the old code new code mapping

kyoshino commented 3 months ago

VERIFIED FIXED with svelte@5.0.0-next.150 👍🏼