False positive with svelte/no-navigation-without-resolve using variable in a list

#1314

Development PRs

Issue

P
patte
Sep 3, 2025, 5:53 PM

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.0

What did you do?

Resolved links in a list are not detected as resolved.

Minimal reproduction:

<script lang="ts">
	import { resolve } from '$app/paths';

	const works = resolve(`/`);

	const notWorkingList = [
		{ title: 'Home', url: resolve(`/`) },
		{ title: 'Clients', url: resolve(`/clients`) },
	];
</script>

<!-- ✅ works as expected -->
<a href={works}>Go to Home</a>

{#each notWorkingList as item (item.title)}
	<!-- ❌ Found a link with a url that isn't resolved. -->
	<a href={item.url}>{item.title}</a>
{/each}

This also doesn't work:

<script lang="ts">
	import { resolve } from '$app/paths';

	const notWorkingList = [
		{ title: 'Home', url: `/` },
		{ title: 'Clients', url: `/clients` },
	];
</script>

{#each notWorkingList as item (item.title)}
	<!-- ❌ Argument of type '[string]' is not assignable to parameter of type '[route: "/"] | [route: "/clients"] | ... -->
	<a href={resolve(item.url)}>{item.title}</a>
{/each}

What did you expect to happen?

Already resolved pathnames are detected whether they are in a list or not.

What actually happened?

Error: Found a link with a url that isn't resolved.eslint

Link to GitHub Repo with Minimal Reproducible Example

Will provide later if needed.

Additional comments

Related question: How to handle dynamic values like the when shallow routing?

👍 10