Less strict no-navigation-without-resolve default
#1353
no-navigation-without-resolve defaultDevelopment PRs
Bumps eslint-plugin-svelte from 3.11.0 to 3.12.3.
Release notes
Sourced from eslint-plugin-svelte's releases.
[email protected]
Patch Changes
- #1305
d92dde0Thanks@ota-meshi! - fix(no-top-level-browser-globals): false positives for compound logical expression guards[email protected]
Patch Changes
#1299
5c7cba3Thanks@marekdedic! - feat: disabling more rules in runes mode#1299
5c7cba3Thanks@marekdedic! - feat: restricting SvelteKit rules to SvelteKit#1306
7cb3660Thanks@ota-meshi! - fix(no-unused-props): false positives forComponentProps<any>[email protected]
Patch Changes
- #1313
27573f4Thanks@marekdedic! - fix: Not reporting mailto: and other unusual schema addresses in no-nmavigation-without-resolve (and its deprecated versions)[email protected]
Minor Changes
#1308
abbcfddThanks@marekdedic! - feat(no-navigation-without-resolve): added to recommended rule set#1289
e2e791fThanks@marekdedic! - feat: added the no-navigation-without-resolve rule#1289
e2e791fThanks@marekdedic! - chore: deprecated the no-navigation-without-base rule
Changelog
Sourced from eslint-plugin-svelte's changelog.
3.12.3
Patch Changes
- #1305
d92dde0Thanks@ota-meshi! - fix(no-top-level-browser-globals): false positives for compound logical expression guards3.12.2
Patch Changes
#1299
5c7cba3Thanks@marekdedic! - feat: disabling more rules in runes mode#1299
5c7cba3Thanks@marekdedic! - feat: restricting SvelteKit rules to SvelteKit#1306
7cb3660Thanks@ota-meshi! - fix(no-unused-props): false positives forComponentProps<any>3.12.1
Patch Changes
- #1313
27573f4Thanks@marekdedic! - fix: Not reporting mailto: and other unusual schema addresses in no-nmavigation-without-resolve (and its deprecated versions)3.12.0
Minor Changes
#1308
abbcfddThanks@marekdedic! - feat(no-navigation-without-resolve): added to recommended rule set#1289
e2e791fThanks@marekdedic! - feat: added the no-navigation-without-resolve rule#1289
e2e791fThanks@marekdedic! - chore: deprecated the no-navigation-without-base rule
Commits
34d4022chore: alignrepositoryfield with svelte repo (#1342)1b23349chore: update pnpm v10 (#1340)cf9c21dchore: release eslint-plugin-svelte (#1333)d92dde0fix(no-top-level-browser-globals): false positives for compound logical expre...9d952fdchore: release eslint-plugin-svelte (#1330)7cb3660fix(no-unused-props): false positives forComponentProps\<any>(#1306)5c7cba3feat: limiting more rules to prevent false positives (#1299)ab848e4chore: release eslint-plugin-svelte (#1316)27573f4fix: Not reporting mailto: and other unusual schema addresses in no-nmavigati...8bd6198chore: release eslint-plugin-svelte (#1307)- Additional commits viewable in compare view
Maintainer changes
This version was pushed to npm by [GitHub Actions](https://www.npmjs.com/~GitHub Actions), a new releaser for eslint-plugin-svelte since your current version.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot mergewill merge this PR after your CI passes on it@dependabot squash and mergewill squash and merge this PR after your CI passes on it@dependabot cancel mergewill cancel a previously requested merge and block automerging@dependabot reopenwill reopen this PR if it is closed@dependabot closewill close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
no-navigation-without-resolve currently checks only the first chunk of a rel attribute, so rel="external{suffix}" can incorrectly exempt an internal link even when its complete value has no external token.
Check the complete string value instead, using static evaluation where possible. Unknown interpolations cannot create a token boundary; a known, separately delimited external token remains allowed. This also handles template literals and shorthand attributes, avoids a crash on a bare rel attribute, and stops relying on an initializer after the variable has been reassigned.
Internal links with data-sveltekit-reload still require resolve(), including "false", {false}, and enabled reload values. This retains the existing behavior on main and the external-link handling introduced in #1443.
Validation:
- Full suite: 1467 passing.
- All 95 rule fixtures independently checked with ESLint 8.57.1, 9.39.1, and 10.0.0, including message locations.
- JavaScript and TypeScript regression fixtures cover rel token boundaries, unknown interpolations, empty attributes, reassigned variables, and reload values.
- TypeScript build, ESLint (0 errors; 2 existing unrelated warnings), type coverage (99.06%), Prettier, and diff checks pass.
Related: #1353.
Please go easy on me as this is the first PR I'm making to this repository, I am more than open to any suggested changes. I've been trying to get some help with this PR from the official Discord server, but discussion was pretty stale. So I'm hoping by opening this PR we can get this change going. Or, if the conclusion is 'we shouldnt do this at all', that's fine too!
Adds optional arguments for URL params hash and searchParams to resolve(). Appends these to the returned URL after resolving the path.
Resolves #14750 and helps address sveltejs/eslint-plugin-svelte#1353
- Additionally updates the example docstring to show new usage:
import { resolve } from '$app/paths';
// using a pathname
const resolved = resolve(`/blog/hello-world`);
// using a route ID plus route parameters
const resolved = resolve('/blog/[slug]', {
slug: 'hello-world'
});
// using a route ID plus URL parameters
const resolved = resolve('/blog/search',
{ hash: 'results', searchParams: { author: 'John Doe', year: '2025' } }
});
// using a route ID plus route parameters and URL parameters
const resolved = resolve('/blog/[slug]',
{ slug: 'hello-world' },
{ hash: 'introduction' }
});
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- PR references an issue, but no discussion as of yet.
- This message body should clearly illustrate what problems it solves.
- Ideally, include a test that fails without this PR but passes with it.
- I tried writing some tests in
kit/packages/kit/test/apps/basics/test/client.test.js, but was met withReferenceError: __SVELTEKIT_PAYLOAD__ is not defined at ../../../../src/runtime/app/paths/internal/client.js:1. This makes sense, becauseresolveRouteis used inresolve, which usesbase, which needs__SVELTEKIT_PAYLOAD__. I wasn't able to find any existing tests forresolveorresolveRoute, other than atpackages/kit/test/apps/options/test/test.jsat line97, which seems to be more of an integration test than actually testingresolveRouteitself. This is my first PR for this repo, so I'm not sure where below tests should go. Willing to add these if I get some pointers in the right direction.
import { resolve } from '../../../../src/runtime/app/paths/client.js'; describe('resolve function', () => { it('resolves a simple pathname', () => { const result = resolve('/blog/hello-world'); expect(result).toBe('/blog/hello-world'); }); it('resolves a route ID with dynamic parameters', () => { const result = resolve('/blog/[slug]', { slug: 'hello-world' }); expect(result).toBe('/blog/hello-world'); }); it('resolves a route ID with URL parameters', () => { const result = resolve('/blog/search', { hash: 'results', searchParams: { author: 'John Doe', year: '2025' } }); expect(result).toBe('/blog/search?author=John%20Doe&year=2025#results'); }); it('resolves a route ID with both dynamic and URL parameters', () => { const result = resolve('/blog/[slug]', { slug: 'hello-world' }, { hash: 'introduction' }); expect(result).toBe('/blog/hello-world#introduction'); }); it('handles empty parameters gracefully', () => { const result = resolve('/blog/[slug]', {}); expect(result).toBe('/blog/[slug]'); }); }); - I tried writing some tests in
Tests
- Run the tests with
pnpm testand lint the project withpnpm lintandpnpm check
Changesets
- If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.- added a changeset as requested, but also somewhat unfamiliar with the 'correct' process for these, so a review is required.
Edits
- Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.
- fix(linter): relaxed rules for anchos
Issue opened here
-
chore(compiler): force runes
-
feat(ui): add
shadcn
-
temporarily silence `state_referenced_locally, will be working on that as a quick follow on, it is working as before but a new svelte-check warning with the svelte-check upgrade -- don't want this to flood people's consoles in the mean time!
-
remove
resolvefrom external URLs and disable the lint error that pops up cause of it -
note: keeping look out on what they do with this rule: sveltejs/eslint-plugin-svelte#1353
Addresses #5260
This PR addresses Sprint 1 Tasks 5 and 7. Specifically, this PR:
- contains the header and the footer for both admin and IT accounts
- contains the navigation bar for IT accounts
Moreover, this PR
- !IMPORTANT relaxes the
svelte/no-navigation-without-resolverule. See sveltejs/eslint-plugin-svelte#1353.
Changelog
1.1.0-beta.4 (2026-03-01)
Miscellaneous Chores
1.2.0-beta.0 (2026-03-01)
Features
- fix 404s, suppress sse errors, and apply security remediations (4083aba)
- settings: improve UX with cognitive layout, tooltips, and schema ordering (a4191fd)
Bug Fixes
- settings Tooltip.Provider for SSR; dashboard/downloader timeout and fallback (d53754f)
- settings: ensure @lucide/svelte import and bust build cache (8a99967)
- settings: use @lucide/svelte and remove redundant role for build (5d85428)
Miscellaneous Chores
- main: release 1.1.0-beta.3 (#28) (1afbb80)
- Node 20, deps update, fix 15 check errors and runes warnings (6b746c1)
- types: fix frontend type errors and alignment (fb37c28)
1.1.0-beta.3 (2026-03-01)
Features
- fix 404s, suppress sse errors, and apply security remediations (4083aba)
- settings: improve UX with cognitive layout, tooltips, and schema ordering (a4191fd)
Bug Fixes
- settings Tooltip.Provider for SSR; dashboard/downloader timeout and fallback (d53754f)
- settings: ensure @lucide/svelte import and bust build cache (8a99967)
- settings: use @lucide/svelte and remove redundant role for build (5d85428)
Miscellaneous Chores
- main: release 1.1.1-beta.0 (#27) (4a62ec1)
- Node 20, deps update, fix 15 check errors and runes warnings (6b746c1)
- types: fix frontend type errors and alignment (fb37c28)
1.1.1-beta.0 (2026-02-28)
Miscellaneous Chores
- deps: update frontend packages to fix security vulnerabilities (a09fde0)
Build System and Dependencies
- trigger frontend dev docker build (9a83817)
1.1.0-beta.2 (2026-02-28)
Miscellaneous Chores
- deps: update frontend packages to fix security vulnerabilities (a09fde0)
Build System and Dependencies
- trigger frontend dev docker build (9a83817)
1.1.0-beta.1 (2026-02-28)
Miscellaneous Chores
- sync prerelease-manifest to 1.1.0-beta.0 (f40bec3)
1.1.0-beta.0 (2026-02-28)
Features
- calendar: overhaul calendar ui bounds and render next up indicators (0319428)
- calendar: scroll fix, clickable items, daily/weekly/monthly views, QoL improvements (db5173b)
- calendar: skeleton loaders + null-tmdb tooltip feedback (16a8ab1)
Bug Fixes
- auth: revert strict URL validation on image field to fix registration (47787a3)
- calendar: remove unexported getLocalTimeZone usage to fix 500 error (e7c48b0)
- ci: sync release-manifest.json version to 1.1.1-beta.3 (5a80c36)
- ci: trigger workflow with synced release manifests (c1e7c0f)
- library: route standalone paused seasons and episodes to parent show (231e92a)
- rebuild docker image with auth registration fix (0f318cc)
- request-more: call /retry instead of /items/add when item already exists in Riven (1cb68bd)
- use data.riven?.id instead of rivenId to prevent TMDB ID fallback on request (de1775c)
1.0.0-beta.3 (2026-02-28)
Features
- calendar: overhaul calendar ui bounds and render next up indicators (0319428)
- calendar: scroll fix, clickable items, daily/weekly/monthly views, QoL improvements (db5173b)
- calendar: skeleton loaders + null-tmdb tooltip feedback (16a8ab1)
Bug Fixes
- calendar: remove unexported getLocalTimeZone usage to fix 500 error (e7c48b0)
- library: route standalone paused seasons and episodes to parent show (231e92a)
- rebuild docker image with auth registration fix (0f318cc)
- request-more: call /retry instead of /items/add when item already exists in Riven (1cb68bd)
- use data.riven?.id instead of rivenId to prevent TMDB ID fallback on request (de1775c)
Summary by CodeRabbit
Release Notes
-
New Features
- Added performance metrics monitoring system to track application performance
- Built comprehensive settings page with tabbed interface and API key regeneration
- Enhanced calendar with daily/weekly/monthly views and upcoming items section
- Extended search to include people and companies in addition to movies and TV shows
- Added deep-linking support for direct episode and calendar navigation
- Specified Node.js 20+ requirement for consistent runtime environment
-
Bug Fixes
- Improved error handling for offline scenarios and network timeouts
- Fixed season selection logic for TV show requests
- Enhanced accessibility directives on interactive elements
- Better fallback handling for missing backend data
-
Dependencies
- Updated multiple dependencies to latest compatible versions
- Bumped version to 1.2.0-beta.0
-
Chores
- Simplified release workflow configuration
- Added dependency documentation
I’ve renamed the core question field from explanation to rationale throughout the runtime codepath. This touches everything from the schema and Convex mutations to the admin UI, exports, and the local question corpus. Most of the logic changes are centered in src/convex/question.ts, schema.ts, and the export/UI utilities. I also included a compatibility helper and backfill mutations to handle existing data safely, while intentionally leaving the worktree changes in +layout.svelte and vercel.json untouched.
The main driver for this is that "rationale" more accurately describes the field's purpose: justifying the correct answer and its alternatives. In the codebase, "explanation" was becoming a bit of a catch-all for general notes and feedback. Explicitly calling it "rationale" in the schema and actions removes that ambiguity and makes the domain model much easier to work with.
This also brings the code in line with the actual product experience. The study and review UIs already use the term "Rationale," so matching the underlying contract to that language makes the system more consistent. It should make things a lot clearer for anyone working on analytics or AI prompting down the road since the field's intent is now baked into the name.
Summary by CodeRabbit
-
Product Updates
- "Explanation" replaced with "Rationale" across question creation, editing, review, previews, and exports.
- Existing explanations are automatically migrated to the new rationale field.
- Rationale content is now sanitized for safer HTML rendering.
- Analytics scripts now run only in production.
-
Documentation
- External docs site link updated to https://docs.learnterms.com/
Fixes #334
Summary by CodeRabbit
-
New Features
- Configurable inline edit/delete and inline custom actions in data tables.
- Sidebar toggle and refreshed sidebar/header controls.
-
Style
- Open Sans added and new color/design tokens applied app-wide.
- Updated table sizing, alignment, spacing, header/cell styles, rounded table container, inputs, and background accents.
- Many empty-state UIs redesigned; header action labels changed from “Add…” to “Create…”.
-
Tests
- Added/updated tests to cover inline table actions and updated UI copy expectations.
-
Chores
- Open Sans font dependency added.
Fixes #335
Also depends on sashakt-platform/sashakt-core#429
Summary by CodeRabbit
-
New Features
- Unified tag-type management table with single search, sort and pagination; create/update/delete actions accessible inline and via modals
- Modal dialog for creating/editing tag types and a confirm-delete dialog
- Inline tag creation and in-place tag editing using tag “chips”
- Consolidated permission-driven controls for header and empty-state actions
-
Bug Fixes
- Improved error reporting and failure feedback for tag/tag-type operations
-
UI
- Adjusted table header and cell spacing for improved readability
-
Removed
- Legacy separate create/edit pages and prior dual-tab UI
What this PR adds
Fullscreen search modal for mobile
Replaces the inline search input in the mobile navbar with a fullscreen modal overlay. This solves several UX issues on mobile:
- Keyboard stays open — no more keyboard closing/reopening when navigating between search and results
- Search state persists — tap a result → view details → press back → modal reopens with your previous search and results intact
- No page flash — modal stays visible until the destination page has fully loaded (previously you'd see the home page briefly during navigation)
- Clean dismiss — Escape or X button clears the search entirely
How it works
- Tapping the search bar opens a fullscreen overlay with auto-focusing input
- 300ms debounced search via TMDB API (movies + TV merged, sorted by popularity)
- Results displayed as portrait cards in a responsive 2-column grid
- Navigation to a result saves the query/results;
afterNavigatewithpopstatedetection reopens the modal on back - Transitions are instant during navigation (skip animations) but smooth for manual open/close
Back button on mobile
Adds a chevron-left button (top-left, glass-morphism style) on non-main pages. Hidden on main navigation pages (/, /explore, /dashboard, /library, /settings, /calendar, /logs).
Files
- New:
src/lib/components/search-modal.svelte— the fullscreen search overlay - Modified:
src/lib/components/mobile-nav.svelte— search trigger + back button
Screenshots
Mobile-only changes. Desktop search is unaffected.
Summary by CodeRabbit
-
New Features
- Mobile search now opens in a dedicated modal that restores saved query/results, focuses input on open, supports keyboard close (Esc), debounced typing with concurrent movie+TV lookups and in-flight request handling, shows loading/empty states, and navigates to details when a result is selected.
-
Refactor
- Mobile nav redesigned: search converted from inline input to tap-to-open modal and a conditional top-left back button added (uses history back with fallback to home).
Mô tả
Thêm giao diện Homepage hiển thị danh sách sự kiện published dạng card cho Customer.
Closes #12
Loại thay đổi
- ✨ Feature mới
- 🐛 Bug fix
- ♻️ Refactor
- 💄 UI / Style
- 📝 Documentation
- 🔧 Chore (config, dependencies,...)
Screenshots / Demo
Khi chưa có sự kiện
Khi có sự kiện
Người dùng đăng nhập
Responsive
Checklist
- Code chạy không lỗi (
bun run dev) - TypeScript check pass (
bun run check) - Lint pass (
bun run lint) - Đã format code (
bun run format) - Đã test thủ công chức năng
- Commit message đúng convention (
feat:,fix:,chore:,...)
Summary by CodeRabbit
- New Features
- Added a customer-facing homepage with hero, searchable events list, category filter, event cards, empty state, and pagination.
- Added customer UI: navbar, footer, logo, search bar, auth navigation (login/register, my tickets) and logout flow.
- Bug Fixes
- Refreshes cached app data after successful login/logout before redirecting to ensure up-to-date UI.
fixes :- #374
Summary by CodeRabbit
-
New Features
- Status filter component for toggling Active/Inactive across listings
- Inline delete enabled for entity tables
-
Improvements
- Back navigation and Save moved into headers; form fields now have labels/placeholders
- Centralized status filtering with server-side support and refined empty-state behavior
- Listing layout supports an optional back link; search and filters composed into reusable components
- Added a total-records column to entity tables
-
Tests
- Updated UI and server tests to match new navigation and status-param behavior
Fixes #423
Depends on Backend PR -sashakt-platform/sashakt-core#481
Summary by CodeRabbit
-
New Features
- Added a "Show:" segmented filter in test listings (All / Mine / Shared) for admins and users with assigned districts; changing it resets pagination and updates the URL parameter.
-
Bug Fixes / Behavior
- Filter selection is forwarded to backend requests when set; omitted when not present.
-
Tests
- Expanded tests for rendering, URL param behavior, navigation, and active-state logic.
Updates the navigation menu layout and nav flow in general. Also added some delegate based stuff to the attendance page.
Summary by CodeRabbit
Release Notes
-
New Features
- Added delegate presence tracking with per-committee statistics and progress indicators
- Introduced user avatar and role display in navigation menu with conference context
- Implemented attendance data export functionality for presence records
- Enhanced non-state actor attendance reporting with grouped delegate absence views
-
Localization
- Updated German, English, and Portuguese translations with new attendance and role labels
-
Style
- Updated button styling for set all present/absent actions
-
Bug Fixes
- Improved user authentication flow for SPA navigation
Description of change
Fixed the issue in image uploading that was causing this bug.
Issue Number
Closes #1030
Type of change
- Fix (a change which fixes an issue)
How the change has been tested
Manually.
Change checklist
- I have ensured that the CI Checks pass locally
- I have removed any unnecessary logic
- My code is well documented
- I have signed my commits
- My code follows the pattern of the application
- I have self reviewed my code
Summary by CodeRabbit
-
New Features
- Selected photos now persist more reliably when moving into the post flow by loading them into a reusable format beforehand.
- Uploaded photo entries now include image size metadata.
-
Bug Fixes
- Improved navigation handling to prevent repeated reload loops while images are being prepared.
- Reduced reliance on temporary browser-only links to avoid broken previews.
- Added safer handling when image loading fails, including user-facing feedback.
Rebuilds svelte/no-navigation-without-resolve to check statically identifiable URL patterns while skipping unknown values by default. The new strict option also reports values the analysis cannot verify.
This is a base-path navigation policy check, not proof that a URL is broken: the rule does not know the deployment origin or routing configuration.
Docs: no-navigation-without-resolve.md
Behavior
- Check links,
<area>, SVG<a>, form actions and submit-controlformaction, plusgoto(),pushState(),replaceState(),preloadData()andpreloadCode(). - Accept query/hash-only destinations, empty URLs,
page.url, query/hash suffixes afterresolve(), and nullableResolvedPathnamevalues in URL-taking sinks. Relative URLs usually keep the base path, so they are reported only withstrict(orallowRelativePaths: false). - Respect form ownership (including explicit
formattributes), submit-control types and effectiveformmethod; skip non-submitting controls and dialog submissions. Therel="external"exemption for links/forms expresses lint policy; it does not guarantee that SvelteKit routing oruse:enhanceis bypassed. - HTTP(S) and protocol-relative URLs in navigation calls may be same-origin: skip them by default and report them as unverifiable with
strict. Report non-HTTP(S) URLs in these calls. - Check only the supported first
preloadCode()argument: a root-relative pathname on Kit 2, a route ID on Kit 3. The pathname requirement is not relaxed byallowRelativePaths. - Follow variables, reassignments,
$state(),$derived(),$props()defaults, arrays, objects,{#each}and declared TypeScript literal types. Bound recursive evaluation, handle empty-string fallbacks and null/undefined defaults, and verify bindings before treating calls as read-only. - Provide targeted diagnostics and
resolve()/asset()suggestions. Run only on SvelteKit 2.26+; deprecateignoreGoto,ignoreLinks,ignorePushStateandignoreReplaceState.
The rule documentation describes accepted patterns, strict-mode behavior and analysis limitations. One minor changeset covers the change.
Specification checks
Rechecked SvelteKit's link options, form actions and navigation API, together with the Kit 2.26 implementation for version-specific behavior.
Validation
- Full plugin test suite: 1,710 passing. TypeScript, ESLint and formatting checks pass.
Real-project check
I ran the final rule (31948b7c) on 55 popular SvelteKit repositories, without type information. Each project used SvelteKit 2.70.3 or 3.1.1, matching its declared major version (pluja/whishper uses SvelteKit 1, so the rule does not run there).
- Default mode: 1,698 reports. All are root-relative paths such as
href="/about"orgoto('/login'). 1,674 have the path written on the reported line, and I checked all 24 others by hand: they hold literal paths like`/trail/view/${id}`. The only false positive found (base || '/'in huggingface/chat-ui) is fixed in this PR. - Existing
eslint-disablecomments: these repositories have 155 comments that disable this rule. 152 of those lines are no longer reported. The other 3 are root-relative paths. One of them is a link to a backend API, and the message suggestsrel="external"for that case. - Current rule (
main,8c8a881e): 3,151 reports on the same repositories, with the same setup. - Strict mode: 3,034 reports. The extra reports are unknown values (by design) and links with spread attributes.
- Not app code: most reports in
sveltejs/kit(test apps) andsveltejs/svelte.dev(tutorial apps) come from code that is not linted in practice. - Private app: I also ran the rule with type information on a large private SvelteKit monorepo (5 apps). Default mode gives 30 reports, all root-relative literals. The current rule gives 205 reports there, and at least 107 of them are false positives.
- No crashes.
Repositories
Issues
Fixes #1314, fixes #1327, fixes #1353, fixes #1487, fixes #1492, fixes #1502, fixes #1609, fixes #1615
- #1526: by design, unknown
data.pathis reported only withstrict; declared literal types can make a value statically identifiable. - #1524 (
redirect()): not included. Waiting for sveltejs/kit#17623. - Not covered: #1324 (
<link>), #1352 (custom resolve functions; unknown results are skipped in default mode).
Issue
Description
Since no-navigation-without-resolve is now in recommended (thx to #1308) it's triggering some discussions in different places.
In sv -> sveltejs/cli#702
About tutorial -> #1308 (comment)
Here 1 -> #1327
Here 2 -> #1319
Maybe, at the moment, the default config is a bit too aggressive. What do you think about relaxing it a bit like:
{
"svelte/no-navigation-without-resolve": [
"error",
{
"ignoreGoto": false,
"ignoreLinks": false,
"ignoreLinks": true,
"ignorePushState": false,
"ignoreReplaceState": false
}
]
}
Let me know
I think we should fix the issues with the rule (working on it, but PRs/reviews are slow-ish :( ) and then decide. Also, I don't see why links should be ignored and the others left turned on.
It looks like quite a few issues have been raised recently regarding no-navigation-without-resolve, probably because it’s now part of the recommended set.
I was thinking it might be better to make the rule a bit less aggressive while it’s still fresh. That way, adoption could be smoother in the long run. (as ignoreLinks is the first hit, I was suggesting this one, but maybe all reverted for now could be an option too)
Relaxing the recommendation a little would also mean we don’t have to change defaults later on (in ou projects), and it would give us (You? ^^, maybe me? :) ) time to improve things in a more relaxed manner.
I think we should fix the issues with the rule (working on it, but PRs/reviews are slow-ish :( ) and then decide. Also, I don't see why links should be ignored and the others left turned on.
I think the problem people are running into with links compared to the other options is links can be external and internal and I don't think it possible to resolve a link that's optional/undefined because there is not way to know if the link is external or internal. I think this is the reason someone would ignore links.
I am having problems with external links as well.
Sure, I can ignore them individually, but it's a pain.
<script>
import { PUBLIC_GITHUB } from '$env/static/public';
</script>
<!-- Found a link with a url that isn't resolved. -->
<a href={PUBLIC_GITHUB} target="_blank">TEXT</a>,This rule affects my page quite a bit as well and I find myself ignoring many of the errors as I used variables. It looks like they don't get checked whether they used resolve or may even come from an external source.
Also, I'm unsure whether a link flagged rel="external" should be checked at all.
Maybe a good compromise could be able to ignore links that are variables? See example given by @hyunbinseo
So instead of having a boolean setting, the options could allow something like: "all" | "variables" | "none"
At the same time I'm a bit confused to use options like ignoreLinks: false (or ignoreLinks: "none" if using the proposal) to enable it (double negation).
+1 re relaxing or revising the evaluation. we had to fully turn if off for now.
though great for destinations defined in source code, in our case the vast majority of href={..} and goto(..) instances source their values from a CMS.
- when we pass those
stringvalues into<a href>orgoto()as-is, this rule complains that the link is unresolved. - when we follow the rule's suggestion and wrap the value in
resolve(), TS then complains: "Type[string]is not assignable to type[route: ...].- (depending on the usecase, this may also not be the right solution, e.g. when a
basepath is used, and the external source already has that base value embedded)
- (depending on the usecase, this may also not be the right solution, e.g. when a
unsure if feasible in eslint, but should this rule perhaps only evaluate string literals? e.g.
- check:
goto('/string/literal') - likely check:
goto(`{base}/template/literal`) - likely check:
goto('/string' + '/expression') - ignore:
goto(someVariable)
Hi, the rule currently evaluates string concatenation, template literals and variables. There is one big limitation, which is that eslint works per-file, so if you import absolute URL variables, there's no possible way to detect that.
I'd like to add support for detecting imported resolved values based on their TS types (see #1321), but I'm currently blocked by other PRs not being merged yet.
I'd like to add support for detecting imported resolved values based on their TS types (see #1321), but I'm currently blocked by other PRs not being merged yet.
neat idea! but unfortunately i don't think this would resolve false reports when the destination is sourced externally and types as string?
is there room for a rule option to disabling checks for variables? might be a duct-tape solution tho
neat idea! but unfortunately i don't think this would resolve false reports when the destination is sourced externally and types as string?
No, it wouldn't, that's the limitation I wrote about.
is there room for a rule option to disabling checks for variables? might be a duct-tape solution tho
How about an option to ignore imported variables?
I think that it's all about timing. It was probably a bit early to put it in recommended with all these small things left. (at the same time it's was good to discover them!)
I originally suggested "ignoreLinks": true, but maybe it could be out of recommended until it's solid?
Having searchParams seems to be an issue as well.
I think that it's all about timing. It was probably a bit early to put it in recommended with all these small things left. (at the same time it's was good to discover them!)
In retrospect yes, but the rule has been in the plugin since March 2024 (in its older variant no-goto-without-base) and we only got all of the reports since including it in recommended 🤷
Having searchParams seems to be an issue as well.
Yes, that's in another issue as well :/
Yes, people don't opt-in rules regularly ^^
The older variant was not that strict (resolve was not there).
IMO, resolve should also manage searchParams, but it's some work to do (not identified). If it's managed one day inside resolve, then it's not a eslint direct concern.
is there room for a rule option to disabling checks for variables? might be a duct-tape solution tho
How about an option to ignore imported variables?
don't think that would help in our case (assuming you're referring to ESM-style imported variables)
in our case, most link & goto destinations come from server-side page data loaders, managed in an external CMS. simplifying a lot, that boils down to something like this:
<script>
let {data} = $props()
</script>
<a href={data.bogus.url}>
{data.bogus.title}
</a>
data.bogus.url would automatically typed as just string, and holds an absolute, resolved pathname (plus optional search/hash). AFAIK, these should not be wrapped in resolve(). currently, this rule (with its default config) is flagging the above href value as erroneous, though I don't think there is much an ESLint rule can or should check in this case.
unsure what the best resolution to this is. hence the vague idea to maybe ignore variables if feasible (be that by default, or as a new rule option)
This rule is also causing problems for me when I link to an external URL I get from an API:
<a rel="external" target="_blank" href={feed.url}>{feed.name}</a>
Shouldn't rel="external" be enough to automatically disabled this rule here?
Disabling for rel="external" and variables that can't be resolved to a constant string both make sense to me
this is causing issues for me after implementing a sidebar. the sidebar menu items are part of an array, when using #each this error will pop up even if used resolve to populate the href fields of each menu item in the array. I think recognizing the type returned by resolve in the linter will fix a bunch of pain points right away.
@cachesdev If you simply need a workaround, you can use the latter:
{#each paths as path}
<!-- Found a link with a url that isn't resolved. -->
<a href={path}>{path}</a>
{/each}
{#each paths as href}
<a {href}>{href}</a>
{/each}I came here because I just opened up a related issue in sveltejs/kit regarding searchParams and hash in resolve.
I'm still unsure whether this linting rule should be relaxed to allow for those, or whether resolve should allow those and return the URL with those appended. An alternative would be to have resolve() take in SvelteURL.
I'm keen to get your thoughts on that.
I've implemented the feat that allows hash and searchParams in resolve() in the above commit ( codevogel/kit@5853cb9 )
For anyone who's interested, I'll have to do some investigating on what tests I need to write before I can open up a PR to close this issue. If, in the meanwhile, someone can take a look at my work and review it, it'd be much appreciated, as this would be my first PR in the sveltejs/kit repo.
Just chiming in here to flag that this bit of code also triggers the linter
import { goto } from '$app/navigation';
import { resolve } from '$app/paths';
import type { ResolvedPathname } from '$app/types';
function getUrl(): ResolvedPathname {
return resolve('/');
}
const url = getUrl();
goto(url);
Considering that resolve() returns a ResolvePathname, I'm not sure what the linter error wants 😅
I strongly support the proposal mentioned earlier regarding rel="external".
I tried using Template Literal Types to handle external links safely:
type ExternalLink = `https://${string}` | `http://${string}`;
However, the linter doesn't respect this type definition, so having rel="external" as a standard opt-out would be much cleaner.
Current Workarounds
For dynamic internal links, I'm currently forcing it to work by casting variables to a Union Type to satisfy resolve. It's not ideal, but it works for now:
// Defined somewhere in types
type InternalLink = 'blog' | 'promo' | 'games' | 'about' | 'etc';
<a
href={resolve(`/(pages)/${props?.internalLink?.slug?.current as InternalLink}`)}
class="button"
>
{props.buttonText}
</a>
Remaining Issue I still haven't found a viable way to handle searchParams with this rule enabled. It currently makes simple URL manipulation very difficult.
Giving my 2 pence. It make sense to have this rule when navigating internally to the app, but not when navigating outside of the app.
Can we remove this rule from recommended, please?
FYI, in the meantime this rule can be disabled in eslint.config.js:
// ...
export default defineConfig(
// ...,
{
name: 'svelte',
files: ['**/*.svelte', '**/*.svelte.*'],
// ...,
rules: {
// @see https://github.com/sveltejs/eslint-plugin-svelte/issues/1353
'svelte/no-navigation-without-resolve': 'off',
// ...,
},
},
)Maybe I'm coming from a different perspective here, but I don't understand the need for this.
Isn't the whole point of svelte to make things easy?
This seems insane to me that I am expected to add resolve() to this. Svelte should just do this automatically. I don't understand the point of having this in eslint at all.
Sure, I can turn it off, but why have the need for this, and certainly not the default. I understand in complex links it may be necessary, but shouldn't Svelte just feel like using regular HTML... isn't that the point?
J
That's a bad example, it becomes immediately useful once you link to something other than root. This set as the default guides devs to write correct URL. Svelte is simple, not easy. By providing a low level API, if gives the control to the developer on how they want to approach it. In small projects, the rule can be disabled. In larger projects, a resuable <Link> can be made, which is likely to happen to keep consistent styles. There's even a workaround to get it work for <a> but it's not the default because there are edge cases.
I guess my point is that svelte(kit) is a compiler, why not just have SvelteKit intercept it? It already does this with the router under the hood anyway. Why not resolve the link automatically...
Then you can't turn it off...Plus, resolve also prepends base path. Sensible defaults with options and escape hatches. That is Svelte.
Could maybe Svelte include a Link component like this by default so we don't have to keep reinventing the wheel?
<script lang="ts">
import type { Snippet } from 'svelte';
import { resolve } from '$app/paths';
import { type HTMLAnchorAttributes } from 'svelte/elements';
import type { Pathname } from '$app/types';
type HTMLAnchor = HTMLAnchorAttributes & {
href: Pathname;
children?: Snippet;
};
const { href, children, ...restProps }: HTMLAnchor = $props();
</script>
<a {...restProps} href={resolve(href)}>
{@render children?.()}
</a>
Also, why do we need resolve on goto? goto can only be used as a route navigation. Shouldn't goto just do what resolve does internally?
I could equally make a route function or something similar that does goto(resolve(x)), but I shouldn't have to...
J
There is a workaround that enables this for <a>. It'snot built-in because there are edge cases.