Skip to content

Add rules to help migrate Svelte Kit (v1.0.0-next.405) #241

Closed
@ota-meshi

Description

@ota-meshi

Motivation

Before migrating the Svelte Kit, it might be useful to check the migration requirements in advance and let users know that migration is necessary.

Description

Perhaps we should add some rules.
For example:

It would be best to be able to automatically locate the svelte.config file if possible, read it, and locate the routes directory. If that's difficult, we'll have to ask the user to configure it with overrides in the eslint configuration.

If you have any other rules you need to migrate or ideas for rules that ESLint can check, please let me know.

Examples

<script context="module">
/* eslint svelte/no-export-load-in-svelte-module-in-kit-pages: error */

/* ✗ BAD */
export function load() { /* ... */}
export const load = () => { /* ... */}
</script>
<!-- ✗ BAD -->
<!-- Filename: index.svelte -->
<script>
/* eslint svelte/naming-convention-in-kit-routes: error */
</script>
/* ✗ BAD */
/* Filename: index.js */
/* eslint svelte/naming-convention-in-kit-routes: error */
<!-- ✓ GOOD -->
<!-- Filename: +page.svelte -->
<script>
/* eslint svelte/naming-convention-in-kit-routes: error */
</script>
/* ✓ GOOD */
/* Filename: +page.js */
/* eslint svelte/naming-convention-in-kit-routes: error */
<script>
/* eslint svelte/no-not-data-props-in-kit-pages: error */

/* ✗ BAD */
export let foo;

/* ✓ GOOD */
export let data;
$: ({foo} = data)
</script>

Additional comments

sveltejs/kit#5774

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions