Skip to content
Latchkey

Svelte "Component has unused export property" warning fails CI

The Svelte compiler warns when a component declares export let x (a prop) that the component never reads. A CI gate that fails on warnings turns this into a build failure.

What this error means

A check or build fails on "Component has unused export property 'X'. If it is for external reference only, please consider using export const" while local dev only warns.

svelte-check
Warn: Component has unused export property 'theme'. If it is for external reference
only, please consider using `export const theme` (src/lib/Card.svelte:2:1)

Common causes

A declared prop is never used internally

You wrote export let theme but the component body does not reference theme, so the compiler flags it as an unused export.

A value meant for external reference uses export let

A value only read by parents via bind:this or a ref should be export const; using export let triggers the warning.

How to fix it

Use the prop or remove it

  1. Decide whether the component actually needs the prop.
  2. If it does, reference it in markup or logic.
  3. If it does not, delete the export let line.
Card.svelte
<script>
  export let theme = 'light';
</script>
<div class={theme}>...</div>

Switch to export const for reference-only values

When a value is for external reference only, declare it export const to silence the warning intentionally.

Card.svelte
<script>
  export const VERSION = '1.0.0';
</script>

How to prevent it

  • Remove props that a component no longer uses.
  • Use export const for values exposed only for external reference.
  • Run svelte-check in CI so unused exports surface on the PR.

Frequently asked questions

What causes ""has unused export property""?
You wrote export let theme but the component body does not reference theme, so the compiler flags it as an unused export.
How do I fix "has unused export property"?
Use the prop or remove it

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card