fix(no-navigation-without-resolve): allow empty URL in shallow goto()

#1610

Closing issue

Pull request

Merged at Nov 28, 2026, 3:58 AM by baseballyama
M
marekdedic
Oct 17, 2026, 7:40 PM

Fixes

SvelteKit 3 deprecates pushState() / replaceState() in favour of goto(url, { state, shallow: true }) (see the ). The rule already allowed pushState('') / replaceState(''), but reported the equivalent goto('', { shallow: true }).

goto() now allows an empty URL when its options have a truthy shallow (matching SvelteKit's if (opts.shallow)). The options are resolved with the existing lookupProperty() helper, so they can be inline, in a variable or nested in an object (e.g. goto('', config.opts)), and spreads and computed keys are applied in order. Still reported:

  • non-empty URLs, even with shallow: true (e.g. goto('/foo', { shallow: true }))
  • goto('') without a truthy shallow
  • options where shallow: true may be overridden by a later spread or a computed key that cannot be statically resolved

While addressing review, two fixes that apply to the whole rule (each in its own commit, with its own changeset):

  • Variables are only followed if they are const or never reassigned (like getStaticValue()), so e.g. let url = resolve('/'); url = '/foo'; goto(url); is now reported.
  • TypeScript as, satisfies, ! and <T> wrappers are looked through, so e.g. goto('', { shallow: true } as const) or const paths = [resolve('/')] as const are no longer reported.

Docs and changesets are included.