Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.73 KB

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

File metadata and controls

50 lines (35 loc) · 1.73 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/no-export-load-in-svelte-module-in-kit-pages
disallow exporting load functions in `*.svelte` module in SvelteKit page components.
v2.12.0

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

disallow exporting load functions in *.svelte module in SvelteKit 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 you are not using the 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