# svelte/valid-prop-names-in-kit-pages

disallow invalid props in SvelteKit route components.

  • ⚙️ This rule is included in "plugin:svelte/recommended".

# 📖 Rule Details

This rule reports unexpected exported variables in <script>.
As of SvelteKit v1.0.0-next.405, instead of having multiple props corresponding to the props returned from a load function, page components now have a single data prop.

The valid props depend on the file type:

  • +page.svelte and +layout.svelte: data, errors, form, params, snapshot
  • +layout.svelte (Svelte 5): additionally allows children
  • +error.svelte (Svelte 5.53): error
<script>
  /* eslint svelte/valid-prop-names-in-kit-pages: "error" */
  /** ✓ GOOD */
  export let data;
  export let errors;
  export let form;
  export let params;
  export let snapshot;
  // export let { data } = { data: {} }

  /** ✗ BAD */
  export let 
disallow invalid props in SvelteKit route components. (svelte/valid-prop-names-in-kit-pages)
foo
;
export let
disallow invalid props in SvelteKit route components. (svelte/valid-prop-names-in-kit-pages)
bar
;
export let {
disallow invalid props in SvelteKit route components. (svelte/valid-prop-names-in-kit-pages)
baz
disallow invalid props in SvelteKit route components. (svelte/valid-prop-names-in-kit-pages)
, qux } = data;
export let { data: data2 } = { data: {} }; </script> {foo}, {bar}

# 🔧 Options

Nothing. But if use are using not default routes folder, please set configuration according to the user guide.

# 📚 Further Reading

# 🚀 Version

This rule was introduced in eslint-plugin-svelte v2.12.0

# 🔍 Implementation