Skip to content

Latest commit

 

History

History
61 lines (45 loc) · 1.85 KB

no-export-load-in-svelte-module-in-kit-pages.md

File metadata and controls

61 lines (45 loc) · 1.85 KB
pageClass sidebarDepth title description
rule-details
0
svelte/no-export-load-in-svelte-module-in-kit-pages
disallow exporting load functions in `*.svelte` module in Svelte Kit page components.

svelte/no-export-load-in-svelte-module-in-kit-pages

disallow exporting load functions in *.svelte module in Svelte Kit page components.

  • This rule has not been released yet.

📖 Rule Details

This rule reports unexpected exported load function at <script context="module">. At SvelteKit v1.0.0-next.405, load function has been moved into a separate file — +page.js for pages, +layout.js for layouts. And the API has changed.

<script> const config = { settings: { kit: { files: { routes: "", }, }, }, } </script>
<script context="module">
  /* eslint svelte/no-export-load-in-svelte-module-in-kit-pages: "error" */
  /* ✓ GOOD  */
  export function foo() {}
  export function bar() {}
  /* ✗ BAD  */
  export function load() {}
  // export const load = () => {}
</script>

🔧 Options

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

📚 Further Reading

🔍 Implementation