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.
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
- Decide whether the component actually needs the prop.
- If it does, reference it in markup or logic.
- If it does not, delete the
export letline.
<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.
<script>
export const VERSION = '1.0.0';
</script>How to prevent it
- Remove props that a component no longer uses.
- Use
export constfor values exposed only for external reference. - Run
svelte-checkin CI so unused exports surface on the PR.