no-navigation-without-resolve doesn't work with search params
#1327
Development PRs
updated (without refactor): #1383 (comment)
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.
Mô tả
Triển khai giao diện tương tác và luồng người dùng cho hệ thống Hàng chờ ảo (Virtual Queue). Đảm bảo trải nghiệm liền mạch từ khi bắt đầu xếp hàng cho đến khi chọn ghế, đồng thời cho phép người dùng tiếp tục lướt web thông qua widget nổi.
See #105
Loại thay đổi
- 💄 UI / Style
Screenshots / Demo
Phòng chờ & Polling: Hiển thị đúng số thứ tự, tính năng "Thu nhỏ" hoạt động mượt mà
Chống xếp hàng chéo: Đang chờ sự kiện A, bấm mua sự kiện B -> Hiện Modal cảnh báo. Bấm "Rời cũ" -> Hủy A, bắt đầu chờ B.
Grace Period (Tới lượt): Nhận được trạng thái active -> Bắt đầu đếm ngược 60s. Bấm "Vào chọn ghế" -> Gọi API /confirm -> Chuyển sang /seats.
Bảo vệ phiên chọn ghế (Holding): Khi đang ở /seats, lỡ tay bấm sang Trang chủ -> Widget cảnh báo "Đang có phiên chọn ghế" hiện lên đếm ngược 5 phút.
Thời gian đếm ngược khi chọn ghế
Kéo thả Widget
Thiết kế UI Mobile
Thu gọn Widget trong UI Mobile
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
- Virtual queue system with real-time status, positions and a dedicated queue page
- Floating, draggable queue widget shown across customer pages with minimize/dock behavior
- Cross-queue confirmation modal when switching events
- Ready/holding/waiting UI components with per-second countdowns and holding session during seat selection
- Persistent queue state across reloads (localStorage/sessionStorage)
- API to cancel/leave a queue from the client
-
Bug Fixes
- Ensured queue slot cleanup on logout and after successful checkout
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
fixes :- #515
Summary by CodeRabbit
- Bug Fixes
- Improved step navigation to reliably preserve template selections and clean up query parameters when returning to the primary screen.
- Refined “Next” navigation during template conversion so the updated template selection is reflected immediately while maintaining scroll and focus.
- Improved form population by copying available configuration fields from loaded test/template data.
- UI Improvements
- Made the stepper and question list headings conditional during template conversion (“Review Questions” vs “Select Questions”).
- Updated the questions view to match the conversion state consistently.
This adds a contextual person details panel when a person page/chat window is opened. On this PR I also added end to end tests for this feature but discovered some other things I needed to fix before I could run and test them so they are fixed in this PR as well.
https://www.loom.com/share/ed1289e43267414ab9a3efeb084b074a
Summary by CodeRabbit
- New Features
- Added a person context panel with profile details, communication status, contact info, teams/tags, notes, and last active activity.
- Included desktop sidebar and mobile drawer experiences with expand/collapse, close, and “view full profile” navigation.
- Added loading, error, permission, and not-found states.
- Added support to toggle person data loading when needed.
- Improvements
- Notes now show the latest (and ignore deleted entries) and support adding notes from the panel.
- Added localized strings for the new person context UI.
- Tests
- Expanded end-to-end coverage for the person context panel and notes flows.
What does this PR do?
This PR fixes two related issues in the compliance course flow:
• Teachers can now create compliance courses even if they haven't set a certificate deadline yet. • Previously, courses without a certificate deadline would prevent students from enrolling (showing errors or blocking enrollment entirely). • Additionally, fixed an infinite error loop that was appearing on the course enrollment page in some cases.
These changes make compliance course creation more flexible while ensuring enrollment works reliably.
Type of change
- Bug fix (non-breaking change which fixes an issue)
- Chore (refactoring code, technical debt, workflow improvements)
- Enhancement (small improvements)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change adds a new database migration
- This change requires a documentation update
How should this be tested?
Create a new Compliance course as a teacher. Try saving/publishing the course without setting a certificate deadline. Verify that the course can be published successfully. As a student, attempt to enroll in that course — it should work without errors. Test the course enrollment page to ensure no infinite error loops appear.
Checklist
Required
- Filled out the "How to test" section in this PR
- Self-reviewed my own code
- Commented on my code in hard-to-understand bits
- Ran
pnpm build - Checked for warnings, there are none
- Removed all
console.logs - Merged the latest changes from main onto my branch with
git pull origin main - My changes don't cause any responsiveness issues
Appreciated
- If a UI change was made: Added a screen recording or screenshots to this PR
- Updated the ClassroomIO Docs if changes were necessary
Summary by CodeRabbit
-
New Features
- Added guided navigation that highlights relevant settings and controls.
- Added certificate deadline validation for downloadable certificates and compliance course publishing.
- Added prompts directing users to certificate settings when a deadline is required.
- Added clearer enrollment error messages.
- Added URL-based tab selection and highlighting for certificate settings.
- Added reactive AI tutor settings loading when switching organizations.
-
Bug Fixes
- Improved handling of AI tutor settings loading errors.
- Prevented issues when reordering questions containing missing data.
Greptile Summary
This PR fixes compliance course creation and enrollment: teachers can now publish a compliance course without a certificate deadline (a dialog gates publishing and redirects to certificate settings), and an infinite auto-enrollment loop on the enroll page is resolved. It also introduces a reusable AttentionHighlight component and goAndHighlight routing utility for URL-driven scroll-and-pulse UX across several settings pages.
- Compliance publish gate:
onPublishToggleinsettings.svelteintercepts publishing of compliance courses with no certificate deadline, showing a dialog that navigates teachers to certificate settings with the deadline field highlighted. - Enrollment loop fix:
enrollmentErroris added to the$effectguard inenroll/+page.svelte, stopping infinite re-triggers on failure; acatchblock and in-page error render ensure users always see failure feedback. - AttentionHighlight / goAndHighlight: New shared components provide typed, URL-based scroll-and-highlight navigation replacing the old hash-based approach; org-settings now re-initializes reactively on org change.
Confidence Score: 4/5
Safe to merge with the tab snap-back fixed; the enrollment loop and compliance publish gating changes are solid.
The tab snap-back in certificate-edit.svelte is a present behavioral defect: the $effect reading page.url re-fires when AttentionHighlight's replaceState cleans up the ?highlight param, overriding any manual tab change the user made during the 3-second pulse window. Everything else — the enrollment loop fix, the compliance publish dialog, AttentionHighlight, and goAndHighlight — looks correct and well-structured.
Files Needing Attention: apps/dashboard/src/lib/features/course/components/ceritficate/certificate-edit.svelte — the $effect for URL-based tab initialization needs a run-once guard.
Important Files Changed
| Filename | Overview |
|---|---|
| apps/dashboard/src/lib/features/course/components/ceritficate/certificate-edit.svelte | Switches activeTab from a bindable prop to URL-derived local state; the reactive $effect re-fires on every page.url change (including the highlight cleanup replaceState), snapping the tab back to settings if the user navigated away during the pulse window. |
| apps/dashboard/src/lib/features/ui/attention-highlight.svelte | New component that pulses/scrolls a wrapped element when the URL's ?highlight or #hash matches its id, then cleans up the URL param via replaceState after a configurable duration. |
| apps/dashboard/src/lib/routing/go-and-highlight.ts | New utility that builds a typed route URL with a ?highlight query param and calls goto(). Path tokens are encoded, extra keys become query params. |
| apps/dashboard/src/lib/routing/routes.ts | New typed routing constants: ROUTE_NAME enum, ROUTE_PATHS, ROUTE_SECTIONS, and utility types. |
| apps/dashboard/src/lib/features/course/pages/settings.svelte | Adds onPublishToggle that intercepts compliance course publishing when no certificate deadline is set, showing a dialog that navigates to certificate settings via goAndHighlight. |
| apps/dashboard/src/lib/features/course/components/ceritficate/certificate-settings.svelte | Adds derived certificateValidationErrors and wraps cert-deadline and cert-threshold fields in AttentionHighlight. The deadline_required message renders in two places simultaneously. |
| apps/dashboard/src/routes/(org-site)/course/[slug]/enroll/+page.svelte | Fixes the infinite auto-enrollment loop by adding enrollmentError to the $effect guard; adds a catch block with user-facing error display and snackbar notification. |
| apps/dashboard/src/lib/features/course/api/course.svelte.ts | Adds a specific handler for VALIDATION_ERROR/certificate.deadline responses during enrollment, showing a targeted snackbar. |
| apps/dashboard/src/lib/features/ai-tutor-settings/pages/org-settings.svelte | Migrates initialization from onMount to a $effect that re-runs when currentOrg changes. |
| apps/dashboard/src/lib/features/ai-tutor-settings/api/ai-tutor.svelte.ts | Adds onError handler to fetchOrgSettings that clears orgSettings and shows a snackbar; returns fetched settings for callers. |
| apps/dashboard/src/lib/features/ai-tutor-settings/pages/course-settings.svelte | Wraps inheritance and tutor-settings fields in AttentionHighlight for URL-based scroll-and-highlight navigation. |
| apps/dashboard/src/lib/features/course/components/course-context-menu-content.svelte | Replaces manual hash-redirect publish navigation with goAndHighlight. |
| apps/dashboard/src/lib/features/course/components/exercise/store.ts | Adds optional chaining on question properties inside the type guard filter, preventing crashes on undefined map entries. |
| apps/dashboard/src/lib/utils/translations/en.json | Adds deadline_required, deadline_required_enroll, and certificate settings strings in correct English. |
| apps/dashboard/src/lib/features/ui/index.ts | Exports the new AttentionHighlight component from the UI feature barrel. |
| apps/dashboard/src/routes/(app)/org/[slug]/setup/+page.svelte | Updates the publish course setup step to use goAndHighlight. |
Reviews (11): Last reviewed commit: "Merge branch 'main' into Course-creation..." | Re-trigger Greptile
Continuation of #1482 (originally #1444), rebased onto current main, with the review feedback from #1482 addressed.
What this does
svelte/no-navigation-without-resolve no longer reports:
- Resolved URLs followed by a query string or a fragment, e.g.
resolve('/foo') + '?page=2',`${resolve('/foo')}#section`,resolve('/') + (searchParams.size ? `?${searchParams}` : ''), or<a href="{resolve('/foo')}?page=2">. A URL counts as resolved if it starts withresolve()/asset()or aResolvedPathnamevalue. - Query-only and fragment-only URLs, e.g.
goto('?page=2'),<a href="?{searchParams}">orreplaceState('#top', {}), as they keep the current path. Fragment-only URLs were previously only allowed in links.
A resolved value followed by anything other than a query or a fragment (e.g. resolve('/foo') + '/bar') is still reported, since it bypasses the route type-checking of resolve(). This follows the discussion in sveltejs/kit#14750.
URLs may be built with + concatenation, template literals, multi-part href attributes, variables, array elements, object properties, {#each} items and ternaries, in any combination.
Behaviour change for href attributes
Previously, only the first part of a multi-part href attribute was checked, so <a href="{resolve('/foo')}/bar"> was not reported. All parts are now checked, so it is reported. To fix such links, pass the whole path to resolve() (e.g. resolve('/blog/[slug]', { slug })) and start a query or fragment with a literal ? or # (e.g. href="{resolve('/search')}?{params}").
Leading and trailing whitespace in an href is ignored, as browsers strip it, so <a href=" {resolve('/foo')} "> is not reported. Whitespace between the parts is kept, as it stays in the URL.
Review feedback from #1482
- Fixed a crash on template literals containing only
resolve()(or nothing). - Concatenation is only recognised for the
+operator. - Replaced the separate
BinaryExpression/TemplateLiteralhandling with a single check over the URL's parts. Variables, member accesses and{#each}items are expanded along the way. Cyclic definitions are guarded by a set of the variables expanded on the current path, rather than aFindVariableContext, because a shared one would make the branches of a ternary interfere with each other, and a fresh one per branch loops forever on cyclic definitions. - Documented queries, fragments and
ResolvedPathnamein the rule docs.
Related: #1381 adds suffix support behind an option; this PR enables it by default.
Removes what the site ships or installs without using: six model files, about 1.8 MB of Draco and Basis decoders, @threlte/extras, and the sv create library-template packaging. The build drops from 5.0 MB to 1.8 MB.
Changes
d33a11fremoves six model files fromstatic/three/that the page never requests (1.3 MB). The scene loads onlydaniel-whole.min.gltfanddaniel-whole.bin.87c4964drops@threlte/extras. Since three r186, DRACOLoader and KTX2Loader point at their decoders withnew URL(..., import.meta.url), and extras imports both loaders from its single entry file, so Vite emitted the decoders even though the model isn't Draco-compressed.daniel.sveltenow loads the model with three'sGLTFLoaderthroughuseLoaderfrom@threlte/core.rig.sveltefollows the pointer from a windowpointermovelistener in place ofinteractivity()and an invisible plane. The lockfile loses 15 packages.- The same commit adds
optimizeDeps.includefor the scene's dependencies. Withforce: true, Vite re-bundled them and reloaded the page partway through every vitest run, on main too. After dropping extras, the reload landed whileCanvaswas mounting and raised an unhandled error. It may explain the unexplainednpm testfailure seen during #4. 5d3ae0dremoves aT.PerspectiveCamerawithoutmakeDefault, so Threlte's default camera atz = 5was the one rendering, and aPointLightthatMeshNormalMaterialignores.59aba41removes the library-template packaging.buildno longer runssvelte-packageandpublintor writes an unuseddist/. Thefiles,sideEffects,svelte,types,exportsandpeerDependenciesfields,src/lib/index.tsand the@sveltejs/packageandpublintdevDependencies are gone.package.jsonis now"private": true.7890e77and3a9eea4update the README's 3D section for the new loading and pointer handling, fix its camera position (it saidz = 6), and remove the CONTRIBUTING note about decoder files.45316d5rewrites twoeslint.config.jscomments. One now names what sveltejs/eslint-plugin-svelte#1327 is about.
Behavior change
The camera now follows the pointer over the links card too. Before, the card sat over the canvas and blocked the pointer events, so the scene stopped moving while the pointer was on it. I compared it with the old build in the browser and kept it.
Testing
- Compared builds with content hashes masked. After
87c4964the decoder files are gone, and the three.js chunk goes from 217.7 KB to 208.4 KB gzipped. After59aba41all 28 files match the previous commit, apart from the per-build version inindex.html. - A headless Chromium probe on both builds requested only the two model files and logged no errors. The resting view after
5d3ae0dis pixel-identical to the commit before it. - Checked the page in the browser on
npm run preview, side by side with main's build. npm run check(0 errors, 0 warnings),npm run lintandnpm run knippass. vitest passed 13/13 on three runs, and Playwright 1/1.npm auditshows the same 8 known findings as main.
The removed model files are kept outside the repo in case they're needed again.
🤖 Generated with Claude Code
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
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?
Configuration
// ESLint flat config for SvelteKit + TypeScript + Prettier // Migrated from .eslintrc.cjs to eslint.config.js (Flat Config)import js from "@eslint/js"; import eslintConfigPrettier from "eslint-config-prettier/flat"; import svelte from "eslint-plugin-svelte"; import globals from "globals"; import svelteConfig from "./svelte.config.js";
// Use the typescript-eslint aggregator for flat config presets // (requires devDependency: "typescript-eslint") import tseslint from "typescript-eslint";
export default [ // Ignore generated and build artifacts { ignores: [ // migrated from .eslintignore ".DS_Store", "node_modules", "build", ".svelte-kit", "package", ".env", ".env.*", "pnpm-lock.yaml", "package-lock.json", "yarn.lock", // additional "dist", ".vite", "drizzle", "supabase//migrations/" ] },
// Base language options and globals
{
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: {
...globals.browser,
...globals.node,
// Svelte built-in types
$$Generic: "readonly",
App: "readonly"
}
}
},
// Core JS recommended rules
js.configs.recommended,
// TypeScript rules (no type-aware rules by default)
...tseslint.configs.recommended,
// Svelte plugin recommended rules for Svelte files
...svelte.configs["flat/recommended"],
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
// Ensure TS within <script lang="ts"> is parsed
parser: tseslint.parser,
projectService: true,
extraFileExtensions: [".svelte"],
// Pass through SvelteKit config for better rule behavior
svelteConfig
}
}
},
// Turn off formatting-related Svelte rules to avoid conflicts with Prettier
...svelte.configs["flat/prettier"],
// Project-wide rule tweaks
{
rules: {
"require-yield": "off",
// disabled because it doesn't support search params
"svelte/no-navigation-without-resolve": "off"
}
},
// Keep Prettier last to disable conflicting stylistic rules
eslintConfigPrettier
];
<a
href={`/?redirect=${encodeURIComponent(`${page.url.pathname}${page.url.search}`)}`}
class="bg-base-200/50 text-base-content hover:bg-base-300 flex h-12 items-center gap-2 rounded-lg p-2 transition-colors"
>
<span class="flex h-full flex-1 items-center justify-center font-semibold">Sign In</span>
</a>
What did you expect to happen?
I expect to be able to use search params in links and goto without either TS or eslint complaining.
What actually happened?
As far as I can tell, there's no way to make this href work such that it satisfies the resolve() type and the no-navigation-without-resolve rule.
Link to GitHub Repo with Minimal Reproducible Example
eslint complains:
href={`/?redirect=${encodeURIComponent(`${page.url.pathname}${page.url.search}`)}`}
href={resolve("/")+`?redirect=${encodeURIComponent(`${page.url.pathname}${page.url.search}`)}`}
typescript complains:
href={resolve(`/?redirect=${encodeURIComponent(`${page.url.pathname}${page.url.search}`)}`)}
Additional comments
The only way to make it work is to assert the type:
href={resolve(`/?redirect=${encodeURIComponent(`${page.url.pathname}${page.url.search}`)}` as Pathname & {})}
The same problem also occurs for hash (#) urls.
I think href and goto accepting any of the following should help:
type Href = ResolvedPathname || `${ResolvedPathname}?${string}` || `${ResolvedPathname}#${string}`Hello,
I'm looking into this and it seems like for external navigation, you use an absolute URL and that should bypass this rule. For internal navigation, if you are using goto(), you pass the values as the state in the second parameter. But if you want to do internal navigation using a <a> link, that seems tricky.
Currently, the lint rule for links reports any value that isn't a) Resolved (using the resolve() function) b) Absolute URL or c) Fragment URL (#anchor).
It seems to me that we could do 2 things here to enable your use-case:
- Add search-param URLS (i.e.
?some=value) to the list of allowed values - Add combinations of these as allowed (i.e. something like
<a href={resolve("/blog") + "#section2"}>)
Does that make sense to you? If yes, I'll try to add this when complicating the logic to support #1308 (comment) as well.
So long as I can mix them like /some/path?some=param. Without the path, the params only url would only apply to the current page.
if you are using goto(), you pass the values as the state in the second parameter.
state != query params. You can not pass query params in the second parameter to goto.
IMO, all those should be possible with goto and <a href:
// const preResolved = resolve('/');
// const searchParams = new URLSearchParams(...);
// const query = searchParams.size ? '?' + searchParams : '';
goto('?query=param')
goto('?' + searchParams)
goto(`?${searchParams}`)
goto(query)
goto(preResolved)
goto(preResolved + '?query=param')
goto(preResolved + '?' + searchParams)
goto(preResolved + `?${searchParams}`)
goto(preResolved + query)
goto(`${preResolved}`)
goto(`${preResolved}?query=param`)
goto(`${preResolved}?${searchParams}`)
goto(`${preResolved + query}`)
goto(`${preResolved}${query}`)
goto(resolve('/') + '?query=param')
goto(resolve('/') + '?' + searchParams)
goto(resolve('/') + `?${searchParams}`)
goto(resolve('/') + query)
goto(`${resolve('/')}?query=param`)
goto(`${resolve('/')}?${searchParams}`)
goto(`${resolve('/') + query}`)
goto(`${resolve('/')}${query}`)
<a href="?query=param">
<a href="?{searchParams}">
<a href={'?' + searchParams}>
<a href={query}>
<a href={preResolved}>
<a href={preResolved + '?query=param'}>
<a href="{preResolved}?query=param">
<a href={preResolved + '?' + searchParams}>
<a href="{preResolved}?{searchParams}">
<a href={preResolved + query}>
<a href="{preResolved}{query}">
<a href={resolve('/') + '?query=param'}>
<a href="{resolve('/')?query=param">
<a href={resolve('/') + '?' + searchParams}>
<a href="{resolve('/')}?{searchParams}">
<a href={resolve('/') + query}>
<a href="{resolve('/')}{query}">Thanks for the extensive examples, #1444 should fix all of them :)
@PatrickG And what about external URLs that are loaded dynamically?
E.g.
<script>
import { brand } from '$lib/config/brand';
</script>
<a href={brand.social.instagram} target="_blank">
Instagram
</a>
The value of brand.social.instagram is "https://www.instagram.com/instagram_username".
But for href={brand.social.instagram} it still displays the error:
Unexpected href link without resolve(). eslint ()
EDIT:
Just found the solution:
rel="external" does the trick.
Here the full example again:
<script>
import { brand } from '$lib/config/brand';
</script>
<a href={brand.social.instagram} target="_blank" rel="external">
Instagram
</a>And what about external URLs that are loaded dynamically?
Add rel="external" to the link.