Skip to content

svelte/no-navigation-without-resolve does not allow ResolvedPathname as href #1319

@AndersRobstad

Description

@AndersRobstad

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.34.0

What version of eslint-plugin-svelte are you using?

3.12.1

What did you do?

No real config for this rule used, its included in the svelte recommended rules

<script lang="ts">
	import { type ResolvedPathname } from '$app/types';

	interface Props {
		href: ResolvedPathname;
	}

	const { href }: Props = $props();
</script>

<!-- This shows error `Found a link with a url that isn't resolved.` -->
<a href={href}>
     Link here to a resolved pathname
</a>

What did you expect to happen?

I would expect to be able to pass in href's into a link which has types that imply that they are resolved, and thus valid hrefs for the application. This is very useful when a components link's are determined by where its being used, where its really handy to be able to just pass it a resolved href from the layout that is rendering it.

What actually happened?

I'm not able to do this which makes this rule very tedious to use

Link to GitHub Repo with Minimal Reproducible Example

Repro not needed as its shown in simple code above

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions