Refactor extension internals and add repo-wide quality checks#1
Open
MaximilianMauroner wants to merge 1 commit into
Open
Refactor extension internals and add repo-wide quality checks#1MaximilianMauroner wants to merge 1 commit into
MaximilianMauroner wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the extension’s content-script internals into focused content/ and shared/ modules, centralizes settings/cache contracts, and adds repo-wide quality checks (ESLint + Vitest with fixture-backed DOM parsing tests) that are now run in CI/release workflows.
Changes:
- Split the monolithic content script into modular content/shared files (DOM parsing, rendering, fetching, storage, cache, settings).
- Add Vitest (jsdom) tests with HTML fixtures covering settings/cache behavior and GitHub DOM parsing/extraction helpers.
- Add ESLint flat config and expand CI/release workflows to run
bun run check(typecheck + lint + test + release validations).
Reviewed changes
Copilot reviewed 33 out of 34 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Adds Vitest jsdom configuration for DOM-focused unit tests. |
| tsconfig.tests.json | Introduces a dedicated TS config for test typechecking. |
| tests/.test.ts + tests/helpers/fixtures.ts + tests/fixtures/.html | Adds fixture-backed parsing/extraction tests for settings, cache payloads, and GitHub DOM variations. |
| src/shared/types.ts | Exports shared extension contracts (settings, cache payloads, row model, etc.). |
| src/shared/settings.ts | Centralizes default settings + sanitization/merge behavior. |
| src/shared/cache.ts | Centralizes cache versioning and persisted payload helpers. |
| src/popup.ts | Switches popup logic to use shared settings/cache contracts. |
| src/content/* | New modular content-script implementation (DOM selection/parsing, extractors, fetch queue, render, storage wrapper, app bootstrap). |
| src/content.ts | Replaces the monolithic script with a thin bootstrap wrapper. |
| eslint.config.mjs | Adds ESLint flat config for src/scripts/tests with TS support. |
| package.json | Adds lint/test scripts and a repo-wide check script; expands typecheck to include tests. |
| scripts/check-release.ts | Tightens typing for built manifest validation. |
| popup.html / README.md / manifest.json / docs/release-checklist.md | Aligns wording/scope with current PR-list-only behavior and updates release/check instructions. |
| .github/workflows/ci.yml / release.yml | Updates CI/release to run bun run check. |
| bun.lock | Locks newly added lint/test dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| return null; | ||
| } | ||
|
|
||
| const diffSeconds = Math.max(1, Math.round((now - target) / 1000)); |
| "lint:firefox": "bun run build:firefox && web-ext lint -s dist/firefox", | ||
| "check:release": "bun run typecheck && bun run build:chrome && bun run build:firefox && bun run lint:firefox && bun run scripts/check-release.ts && bun run pack:chrome && bun run pack:firefox" | ||
| "check:release": "bun run typecheck && bun run build:chrome && bun run build:firefox && bun run lint:firefox && bun run scripts/check-release.ts && bun run pack:chrome && bun run pack:firefox", | ||
| "check": "bun run typecheck && bun run lint && bun run test && bun run check:release" |
Comment on lines
+31
to
+37
| this.activeFetches += 1; | ||
| next.taskFactory() | ||
| .then(next.resolve, next.reject) | ||
| .finally(() => { | ||
| this.activeFetches -= 1; | ||
| this.pump(); | ||
| }); |
Comment on lines
+11
to
+18
| return new Promise((resolve) => { | ||
| getStorageArea(area).get(keys, (items) => resolve(items as Record<string, unknown>)); | ||
| }); | ||
| } | ||
|
|
||
| export function chromeStorageSet(area: StorageArea, value: Record<string, unknown>): Promise<void> { | ||
| return new Promise((resolve) => { | ||
| getStorageArea(area).set(value, () => resolve()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor the extension into focused content/shared modules, centralize settings and cache contracts, and add lint/test coverage with fixture-backed DOM parsing tests.
Align product metadata and popup wording with actual behavior, and update CI to run the broader repository validation flow.
Why
Testing
bun run checkFuture improvements
Confidence