Skip to content

Latest commit

 

History

History
49 lines (34 loc) · 1.61 KB

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

File metadata and controls

49 lines (34 loc) · 1.61 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 is included in "plugin:svelte/recommended".

📖 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 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