Skip to content

chore: harden linting rules#47

Merged
BoxBoxJason merged 5 commits intomainfrom
fix/uncaught-exceptions
Mar 22, 2026
Merged

chore: harden linting rules#47
BoxBoxJason merged 5 commits intomainfrom
fix/uncaught-exceptions

Conversation

@BoxBoxJason
Copy link
Copy Markdown
Owner

This PR updates the eslint configuration to catch a lot more errors.

This fixes many uncaught exceptions and other promises errors, as well as poorly designed patterns, regular syntax errors, type hardening,...

This resolves some uncaught runtime exception erros (non blocking) that were happening

Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
@BoxBoxJason BoxBoxJason requested a review from Copilot March 22, 2026 16:08
@BoxBoxJason BoxBoxJason self-assigned this Mar 22, 2026
@BoxBoxJason BoxBoxJason added bug Something isn't working code Requires coding skills dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code labels Mar 22, 2026
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens TypeScript/ESLint rules and applies a broad set of type-safety and promise-handling changes across the VS Code extension (backend), webview (frontend), and tests, with the goal of reducing uncaught runtime exceptions and unsafe patterns.

Changes:

  • Introduces a new flat ESLint config and adds/updates lint-related dependencies.
  • Hardens types across webview messaging, controllers/models (including unknown usage and generics for DB helpers), and various handlers.
  • Refactors multiple async call sites to reduce floating promises and improve error handling.

Reviewed changes

Copilot reviewed 38 out of 40 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/views/window.d.ts Adds global window.vscode/window.imageUris typings for the webview.
src/views/requests/backend.ts Hardens message handling/types for backend webview requests.
src/views/management.ts Awaits backend message handling; minor refactors.
src/views/index.tsx Types imageUris access more safely.
src/views/icons.ts Changes PostMessage.data to unknown; minor refactors.
src/views/components/UserStats.tsx Uses typed window.vscode and typed payload parsing; refactors state typing.
src/views/components/SearchBar.tsx Tightens filter typing (Record<string, unknown>) and payload parsing.
src/views/components/AchievementsHolder.tsx Tightens filter typing and payload parsing.
src/views/components/AchievementDisplay.tsx Improves imageUris typing and date parsing flexibility.
src/utils/types.ts Makes parseValue accept/return unknown, safer parsing for JSON/date/number.
src/utils/logger.ts Switches logger varargs to unknown[]; removes console logging; minor formatting.
src/test/utils.ts Refactors mock extension context typing/formatting.
src/test/runTest.ts Cleans up test runner and uses void main() pattern.
src/test/listeners/files.test.ts Minor const refactors in tests.
src/test/listeners/extensions.test.ts Minor test refactors; avoids unused params.
src/test/extension.ui.test.ts Avoids unused rest args; minor formatting.
src/test/database.test.ts Adds generics to DB helper calls and asserts on nullable results.
src/test/connection-streak.test.ts Minor const refactor.
src/listeners/git.ts Improves typing around git extension/repo commit handler wiring.
src/listeners/files.ts Refactors map declaration to const.
src/listeners/extensions.ts Minor refactors; better typing for caught errors and unused params.
src/listeners/debug.ts Minor refactors; avoids unused params; formatting.
src/listeners/awarder.ts Adds explicit rejection handling for showInformationMessage().then(...).
src/extension.ts Refactors read-only UI flow and some minor style/async handling.
src/database/model/tables/Progression.ts Adds stronger typing for rows/params and generic DB helper usage.
src/database/model/tables/DailySession.ts Strengthens DB helper typing and null-handling for aggregates.
src/database/model/tables/Achievement.ts Strengthens typing for SQL params, criteria maps, and DB helper usage.
src/database/model/model.ts Changes DB helper signatures to generic get<T>/getAll<T> with SqlValue[].
src/database/model/migrations.ts Minor default param formatting.
src/database/model/init/init.ts Minor const refactor.
src/database/controller/timespent.ts Minor formatting and simpler filtering logic.
src/database/controller/progressions.ts Refactors loops/params; marks async calls with void.
src/database/controller/achievements.ts Minor const refactors in filter parsing.
src/config/config.ts Refactors async UI prompts; tightens updateConfig param type.
package.json Bumps version to 0.4.1 and adds new ESLint-related devDependencies.
package-lock.json Lockfile updates for new dependencies/version bump.
eslint.config.mjs Adds flat ESLint config, Promise rules, and broader globals/ruleset.
CHANGELOG.md Changelog regenerated/updated (but currently inconsistent with package version).
Comments suppressed due to low confidence (1)

src/views/components/UserStats.tsx:30

  • useEffect is missing a dependency array, so it runs after every render, re-registering the message event listener and re-sending the RETRIEVE_PROFILE request each time. This will cause duplicated listeners / repeated messages and can quickly spiral into performance issues. Add [] (or the correct dependencies) so the listener is registered once and cleaned up correctly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
@BoxBoxJason BoxBoxJason changed the title fix: uncaught exceptions chore: harden linting rules Mar 22, 2026
@BoxBoxJason BoxBoxJason merged commit 4627230 into main Mar 22, 2026
4 checks passed
@BoxBoxJason BoxBoxJason deleted the fix/uncaught-exceptions branch March 22, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working code Requires coding skills dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants