Conversation
* master: chore(deps): update (#719) chore(deps): update dependency happy-dom to v20.11.1 (#715) chore(deps): update dependency eslint to v10.8.0 (#714) chore(deps): update dependency @playwright/test to v1.62.0 (#713) chore(deps): update dependency @maxmilton/eslint-config to v0.3.4 (#711) chore(deps): update dependency @biomejs/biome to v2.5.5 (#710) chore(deps): update actions/checkout digest to 3d3c42e (#707) chore(deps): update qltysh/qlty-action digest to 08a0a86 (#709) chore(deps): update actions/setup-node digest to 2499707 (#708)
- Fix lint issues - Add comments for syntax highlighting
There was a problem hiding this comment.
Pull request overview
This PR merges the next branch changes into master, primarily expanding/refining the test suite and tightening the macro-based template compiler behavior, alongside small config/tooling updates and dependency bumps.
Changes:
- Strengthen macro template compilation/validation (refs, raw/verbatim text handling) and add extensive behavioral characterization tests.
- Expand and stabilize unit tests across runtime/fast/browser modes, reconciliation algorithms, events, store behavior, and dist output assertions.
- Update project tooling/config (Bun preload path, ESLint/Biome/VScode settings, Playwright config) and bump package/dev dependency versions.
Reviewed changes
Copilot reviewed 30 out of 32 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/utils.test.ts | Adds stronger type assertions and new DOM behavior tests for utils helpers. |
| test/unit/test-env.test.ts | Adjusts globals assertions with lint suppressions for unbound methods. |
| test/unit/store.test.ts | Adds type pinning and new behavioral tests (symbols, ordering, handler removal, new props). |
| test/unit/setup.ts | New Bun test preload to set up DOM + process-wide mocks for unit tests. |
| test/unit/runtime.test.ts | Improves runtime tests (guards, html tagged comments, expanded type pinning). |
| test/unit/runtime-fast.test.ts | Mirrors runtime tests for fast runtime + improves assertions and guards. |
| test/unit/reconcile.test.ts | Major expansion of reconcile algorithm tests (moves/LIS, boundaries, reuse cases). |
| test/unit/macro.test.ts | Large expansion of compile/macro correctness and HTMLRewriter behavior characterization. |
| test/unit/exports.test.ts | Adds export-surface tests for src/fast and improves export type assertions. |
| test/unit/events.test.ts | Stabilizes synthetic click tests (cleanup via onTestFinished) and adds coverage. |
| test/unit/dist.test.ts | New tests asserting dist output presence/types/sizes and package.json export shape. |
| test/unit/browser-runtime.test.ts | Refactors and expands browser runtime tests and typing assertions. |
| test/TestComponent.ts | Updates template strings to use /* html */ comments for tagged-template tooling. |
| test/TestComponent_fast.ts | Same /* html */ template comment updates for fast variant. |
| test/TestComponent_browser.ts | Same /* html */ template comment updates for browser variant. |
| test/setup.ts | Removes previous shared test setup (replaced by unit preload). |
| src/reconcile/non-keyed.ts | Simplifies eslint-disable header (unicorn rules moved to config). |
| src/reconcile/keyed.ts | Simplifies eslint-disable header (unicorn rules moved to config). |
| src/macro.ts | Adds ref validation + raw/verbatim handling + root checks + safer attribute iteration. |
| src/fast/runtime.ts | Removes now-unneeded unicorn suppression for new Array. |
| src/browser/runtime.ts | Documents intentional reverse attribute scan and known divergence vs macro compile. |
| playwright.config.js | Uses Boolean(process.env.CI) for CI toggles. |
| package.json | Bumps version to 0.11.0-next.0, updates test:ci, and bumps dev deps. |
| eslint.config.js | Disables additional unicorn rules and adds targeted overrides for test paths. |
| bunfig.toml | Updates test preload path to new unit setup and adds [run] config. |
| bun.lock | Updates lockfile to reflect dependency bumps. |
| build.ts | Passes project: "tsconfig.json" into createBundle for dts generation. |
| biome.jsonc | Removes Loader from configured globals. |
| .vscode/settings.json | Updates code actions and git worktree settings; adjusts formatter sections. |
| .vscode/extensions.json | Updates recommended VS Code extensions list/order. |
| .gitignore | Ignores local Claude settings file. |
| .claude/settings.json | Adds Claude worktree configuration. |
Suppressed comments (3)
src/macro.ts:74
doctype()currently callsfail("Found doctype but none was expected"), but the unit tests assert the exact message"Found doctype but none was expected in template:"(with the template passed as a second argument). Align the message string so the tests and runtime output are consistent.
doctype() {
fail("Found doctype but none was expected");
},
src/macro.ts:137
element()uses shorter error strings ("Found unsupported <template> element"/"Expected single root element") that don't match the messages asserted intest/unit/macro.test.ts("Found unsupported <template> element in template:"and"Expected template to have a single root element:"). This will break the error-message tests and makes diagnostics inconsistent across failure cases.
// A DOM <template> keeps its children in .content, which the
// firstChild/nextSibling walk in collect() cannot enter, so every
// distance past it would be wrong — reject rather than crash at runtime
if (node.tagName === "template") {
fail("Found unsupported <template> element");
}
if (isRoot) {
insideRoot = hasEndTag;
} else if (!insideRoot) {
fail("Expected single root element");
}
src/macro.ts:157
- The error string for multiple ref markers is missing words compared to the tests (
test/unit/macro.test.tsexpects"Found multiple ref markers on a single element in template:"). Aligning the message keeps test assertions and user-facing diagnostics consistent.
if (refAttrs.length > 1) {
fail("Found multiple ref markers on single element");
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+56
to
+68
| const fail = (message: string) => { | ||
| // eslint-disable-next-line no-console | ||
| console.error(`${message} in template:\n\x1B[2m${template}\x1B[0m`); | ||
| isSuccess = false; | ||
| }; | ||
|
|
||
| const addRef = (name: string) => { | ||
| if (!REF_NAME_RE.test(name)) fail(`Invalid ref name "${name}"`); | ||
| if (k.includes(name)) fail(`Duplicate ref name "${name}"`); | ||
| k.push(name); | ||
| d.push(distance); | ||
| distance = 0; | ||
| }; |
| test.each(invalidRefNames)("returns success false for invalid ref name in %j", (template) => { | ||
| expect.assertions(1); | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| using consoleSpy = spyOn(console, "error").mockImplementation(() => {}); |
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.
No description provided.