Skip to content

refactor: convert remaining application JavaScript to TypeScript - #943

Open
0xbrayo wants to merge 4 commits into
ActivityWatch:masterfrom
0xbrayo:migrate-to-typescript
Open

0xbrayo wants to merge 4 commits into
ActivityWatch:masterfrom
0xbrayo:migrate-to-typescript

Conversation

@0xbrayo

@0xbrayo 0xbrayo commented Aug 22, 2026

Copy link
Copy Markdown
Member

The last application JavaScript under src/ is now TypeScript. Test files and root tooling configs are unchanged.

What changed

  • Renamed the remaining src/ modules to .ts: main, route, stores/index, mixins/asyncErrorCaptured, util/{fakedata,filters,swimlane,tooltip}.
  • Set <script lang="ts"> on CustomVisualization.vue, Calendar.vue, and SunburstClock.vue.
  • Pointed webpack (vue.config.js) and Vite at src/main.ts, and dropped explicit .js import suffixes.
  • Added light types / any only where needed so Vue 2 Options API plus lodash/moment still typecheck. No Options API → composition rewrite, and strict is still off.

Tests

New jsdom tests (still .js, as requested) cover the shipped buildTooltip, getSwimlane, and Vue filter registrations. Existing route.test.js still imports the router.

Jest: 35 suites, 229 tests. Production build succeeds.

@codecov

codecov Bot commented Aug 22, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.09%. Comparing base (926c5fe) to head (f9864c9).

Files with missing lines Patch % Lines
src/mixins/asyncErrorCaptured.ts 0.00% 6 Missing ⚠️
src/main.ts 0.00% 5 Missing ⚠️
src/util/filters.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #943      +/-   ##
==========================================
+ Coverage   63.30%   64.09%   +0.79%     
==========================================
  Files          52       52              
  Lines        3608     3643      +35     
  Branches      840      840              
==========================================
+ Hits         2284     2335      +51     
+ Misses       1309     1308       -1     
+ Partials       15        0      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Converts JavaScript source files to TypeScript.

The PR appears safe to merge; no actionable issue was identified in its base-to-head changes.

Summary

The PR converts the remaining application JavaScript modules and Vite configuration to TypeScript, updates both build entry points, migrates tests to TypeScript, and adds coverage for filters, swimlanes, and tooltips.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Webpack[Webpack entry] --> Main[src/main.ts]
  Vite[Vite HTML injection] --> Main
  Main --> Router[src/route.ts]
  Main --> Stores[src/stores/index.ts]
  Main --> Filters[src/util/filters.ts]
Loading

Reviews (3) · Last reviewed commit: "refactor(test): convert tests and Vite c..."

@0xbrayo
0xbrayo force-pushed the migrate-to-typescript branch from 8d5b91d to 348d949 Compare August 22, 2026 20:36
@0xbrayo
0xbrayo marked this pull request as ready for review August 22, 2026 20:40
@0xbrayo
0xbrayo marked this pull request as draft August 22, 2026 20:55
@ErikBjare
ErikBjare marked this pull request as ready for review August 26, 2026 11:15
@ErikBjare

Copy link
Copy Markdown
Member

@0xbrayo ready or no?

@0xbrayo

0xbrayo commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

@ErikBjare not yet tested.

@0xbrayo

0xbrayo commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

Compiles and works, as far as I can test, Ready for merge :)

@0xbrayo
0xbrayo force-pushed the migrate-to-typescript branch from 348d949 to 9b12c04 Compare September 30, 2026 05:51
@0xbrayo

0xbrayo commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

🤖 Claude, on behalf of @0xbrayo

@greptile review

Migrate the last src/ .js modules and JS Vue SFCs to TypeScript, point
webpack/Vite at src/main.ts, and add unit tests for tooltip, swimlane,
and filters. Test files and tooling configs stay JavaScript.
- Rename all remaining `.js` tests (unit and e2e) to `.ts` and point jest
  at `*.test.ts`.
- `queries.test.node.js` clashed with the existing `queries.test.node.ts`, so
  the snapshot test becomes `queriesSnapshot.test.node.ts` with its snapshot.
- Convert `vite.config.js` to `vite.config.ts` (already referenced by
  `tsconfig.node.json`).
- Add `tsconfig.test.json` and `npm run typecheck:test`; ts-jest runs with
  `isolatedModules`, so jest alone doesn't type-check the tests. Fix the type
  errors this surfaced.
@0xbrayo
0xbrayo force-pushed the migrate-to-typescript branch from 93e15d6 to f9864c9 Compare October 2, 2026 12:50
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.

2 participants