Skip to content

feat: read a keyword after a spread's ... and runs of postfix ! - #255

Merged
DylanPiercey merged 1 commit into
dpiercey-ws-marko-invariants-jcdpv7-parserfixes-typesfrom
dpiercey-ws-marko-invariants-jcdpv7-parserfixes-lookbehind
Sep 28, 2026
Merged

DylanPiercey merged 1 commit into
dpiercey-ws-marko-invariants-jcdpv7-parserfixes-typesfrom
dpiercey-ws-marko-invariants-jcdpv7-parserfixes-lookbehind

Conversation

@DylanPiercey

@DylanPiercey DylanPiercey commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

A keyword operator right after a spread's ... was read as a property, so <div ...new Attrs() b/> split into the spread ...new and an attribute Attrs(); a keyword that starts the expression is now whole. Runs of non-null assertions (x!!) and ones after a string or template literal ("s"!, `s`!) now end an unenclosed value like x! does. A spaced x ! and a ! after } stay prefix, since after } it can follow a block.

🤖 Generated with Claude Code

A keyword counted as an operator only when the character before it was not
a word character or `.`, so a spread's `...` made `new`, `await` or `typeof`
right after it look like a property: `<div ...new Attrs() b/>` gave the
spread `...new` plus attributes `Attrs()` and `b`. A keyword that starts the
expression is now whole.

A trailing `!` was postfix only directly after a word, `)` or `]`, so `x!!`,
`"s"!` and `` `s`! `` still read as a prefix `!` and swallowed the next
attribute or line. The look-behind now steps over a run of `!` and accepts a
closing quote or backtick as the operand's end. A spaced `x !` and a `!`
after `}` stay prefix: after `}` it can follow a block.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@DylanPiercey
DylanPiercey added this pull request to stack #257 September 28, 2026 16:36
@changeset-bot

changeset-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 228b30f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
htmljs-parser Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.89%. Comparing base (6109ab6) to head (228b30f).

Additional details and impacted files
@@                                  Coverage Diff                                   @@
##           dpiercey-ws-marko-invariants-jcdpv7-parserfixes-types     #255   +/-   ##
======================================================================================
  Coverage                                                  99.89%   99.89%           
======================================================================================
  Files                                                         35       35           
  Lines                                                       4695     4711   +16     
  Branches                                                     907      912    +5     
======================================================================================
+ Hits                                                        4690     4706   +16     
  Misses                                                         4        4           
  Partials                                                       1        1           

☔ 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.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: bc5d1a25-5acb-4f3b-aa63-88301a374a44

📥 Commits

Reviewing files that changed from the base of the PR and between 6109ab6 and 228b30f.

⛔ Files ignored due to path filters (2)
  • src/__tests__/fixtures/attr-spread-keyword-operator/__snapshots__/attr-spread-keyword-operator.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/non-null-assertion-repeated-or-after-literal/__snapshots__/non-null-assertion-repeated-or-after-literal.expected.txt is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (4)
  • .changeset/spread-keyword-and-bang-runs.md
  • src/__tests__/fixtures/attr-spread-keyword-operator/input.marko
  • src/__tests__/fixtures/non-null-assertion-repeated-or-after-literal/input.marko
  • src/states/EXPRESSION.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.


Walkthrough

The parser now recognizes keyword operators immediately after spread syntax. It also handles repeated TypeScript non-null assertions and assertions after string or template literals. Keyword lookbehind receives expression metadata so it can accept a keyword at the expression start. New fixtures cover spread expressions and assertion cases. A minor changeset documents these parsing updates.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 228b3

The parser changes address the documented expression forms, and the available fixtures cover them. No material merge-blocking issue is established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately summarizes the spread keyword parsing change and the postfix non-null assertion changes.
Title check ✅ Passed The title clearly and concisely identifies both main parsing changes: keywords after spread operators and repeated postfix ! assertions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@DylanPiercey
DylanPiercey merged commit 278f259 into main Sep 28, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 28, 2026
@DylanPiercey DylanPiercey self-assigned this Oct 2, 2026
@DylanPiercey DylanPiercey moved this to Done in Roadmap Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant