Skip to content

chore: update flexsearch to v0.8 (issue #161)#176

Merged
josecelano merged 3 commits intodevelopfrom
feature/issue-161-update-flexsearch-to-v0.8
Feb 25, 2026
Merged

chore: update flexsearch to v0.8 (issue #161)#176
josecelano merged 3 commits intodevelopfrom
feature/issue-161-update-flexsearch-to-v0.8

Conversation

@josecelano
Copy link
Member

Summary

Resolves #161 — updates flexsearch from v0.7.43 to v0.8.212 (breaking change) and fixes all resulting type and Svelte 5 warnings discovered during the process.

Commits

  1. chore: add pre-commit hook for lint and type checks

    • scripts/pre-commit.sh — runs Prettier, ESLint, and svelte-check before each commit
    • .githooks/pre-commit — git hook entry point delegating to the script
    • npm run pre-commit for manual invocation
    • prepare npm script auto-installs the hook on npm install
  2. chore: update flexsearch from v0.7.43 to v0.8.212

    • Replace default import with named import: import { Index } from 'flexsearch'
    • Remove FlexSearch namespace type: let postsIndex: Index
    • Use new Index() instead of new FlexSearch.Index()
    • Cast search results to number[] for explicit typing
  3. fix: resolve Svelte 5 warnings in ShareButton

    • Wrap encodedBody, encodedSlug, and socialLinks in $derived() runes so they stay reactive when props change (was flagged by the new pre-commit hook)

Testing

  • npm run pre-commit — 0 errors, 0 warnings ✔
  • npm run build — completes successfully ✔
  • npm run lint — passes ✔
  • npm run check — 0 errors, 0 warnings ✔

- Add scripts/pre-commit.sh that runs Prettier, ESLint, and svelte-check
- Add .githooks/pre-commit entry point delegating to the script
- Add 'pre-commit' npm script for manual runs: npm run pre-commit
- Add 'prepare' npm script to auto-register .githooks on npm install

Note: --no-verify used for this bootstrapping commit only, as the hook
itself cannot validate the state before the flexsearch upgrade is applied.
- Update flexsearch dependency to v0.8.212
- Replace default import with named import: `import { Index } from 'flexsearch'`
- Remove FlexSearch namespace type usage: `let postsIndex: Index`
- Use `new Index()` instead of `new FlexSearch.Index()`
- Cast search results to `number[]` for explicit typing

Closes #161
Replace plain const assignments referencing props with $derived() runes
so that encodedBody, encodedSlug and socialLinks stay reactive when
props change, eliminating the 'only captures initial value' warnings
reported by svelte-check.
@josecelano
Copy link
Member Author

ACK 2037252

@josecelano josecelano merged commit c9d5426 into develop Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: update flexsearch to v0.8 (breaking change)

1 participant