Skip to content

Use @marko/parse for parsing - #140

Open
DylanPiercey wants to merge 3 commits into
mainfrom
dpiercey-ws-eslint-wv2qux
Open

DylanPiercey wants to merge 3 commits into
mainfrom
dpiercey-ws-eslint-wv2qux

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Replaces the vendored syntax tree builder with the new shared @marko/parse package (marko-js/language-server#586), the same CST used by the language server, eslint-plugin-marko and (pending) @marko/compiler. All 484 fixtures pass unchanged.

Depends on @marko/parse being published — the link: dependency needs to be swapped for a version range before merge.

@changeset-bot

changeset-bot Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 116dd25

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

This PR includes changesets to release 1 package
Name Type
prettier-plugin-marko Patch

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

@coderabbitai

coderabbitai Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 18 days. After that, they cost $0.25 per reviewed file.

Or wait 15 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available. Your 37 included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 32904578-2cde-47b4-bf7f-e09d23ab0a08

📥 Commits

Reviewing files that changed from the base of the PR and between e82e635 and 116dd25.

📒 Files selected for processing (1)
  • src/index.ts

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: cfb9bc11-647e-4b74-829a-e853bac72525

📥 Commits

Reviewing files that changed from the base of the PR and between 3e0fd41 and e82e635.

📒 Files selected for processing (3)
  • .changeset/use-marko-parse.md
  • agent-feedback/items/2026-08-20-reject-a-template-the-parser-could-not-parse.md
  • src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/use-marko-parse.md

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


Walkthrough

The plugin now uses the shared @marko/parse package for parser types, utilities, and parsing. The local parser module was removed. The package dependency changed from htmljs-parser to the linked @marko/parse package. Parsing clears root comments after parsing. Static-node formatting derives the keyword boundary from the node target or name. The Changeset documents a patch release.

Merge Risk: 🟡 Moderate · up to e82e6

The PR currently depends on a local link: reference to @marko/parse and explicitly requires replacing it with a published version range before merge; until that prerequisite is completed, the package is not merge-ready.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: replacing the vendored parser with @marko/parse.
Description check ✅ Passed The description directly explains the parser replacement, shared CST integration, fixture results, and dependency condition. It is fully related to the changeset.
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 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dpiercey-ws-eslint-wv2qux

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

@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-eslint-wv2qux branch 2 times, most recently from 40f6437 to bf8f3ab Compare August 6, 2026 18:57

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 46: Replace the temporary local link for `@marko/parse` in package.json
with the appropriate semver range for its published release, and regenerate
pnpm-lock.yaml accordingly. Confirm the selected release provides the imports
used by src/ and validate installation from the packed plugin.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a3e7cbb-9dbf-4eda-a13a-1b595a05966c

📥 Commits

Reviewing files that changed from the base of the PR and between 2e7c68e and bf8f3ab.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by **
📒 Files selected for processing (8)
  • .changeset/use-marko-parse.md
  • package.json
  • src/index.ts
  • src/parser.ts
  • src/utils/get-formatted-body.ts
  • src/utils/get-parser-name.ts
  • src/utils/read.ts
  • src/utils/to-valid-doc.ts
💤 Files with no reviewable changes (1)
  • src/parser.ts

Comment thread package.json
},
"dependencies": {
"htmljs-parser": "^5.12.1"
"@marko/parse": "link:../language-server/packages/parse"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/sh
set -eu

node <<'NODE'
const fs = require("node:fs");
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
const dependency = pkg.dependencies?.["`@marko/parse`"];

if (!dependency || dependency.startsWith("link:")) {
  throw new Error(
    `Expected a published `@marko/parse` version range, got ${dependency}`,
  );
}
NODE

Repository: marko-js/prettier

Length of output: 793


🏁 Script executed:

#!/bin/sh
set -eu

printf '%s\n' '--- package.json dependency and scripts ---'
node <<'NODE'
const fs = require("node:fs");
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
console.log(JSON.stringify({
  name: pkg.name,
  version: pkg.version,
  dependencies: pkg.dependencies,
  devDependencies: pkg.devDependencies,
  scripts: pkg.scripts,
  files: pkg.files
}, null, 2));
NODE

printf '%s\n' '--- repository references to `@marko/parse` and link: ---'
rg -n --glob '!node_modules' --glob '!dist' --glob '!build' '`@marko/parse`|link:../language-server/packages/parse|language-server/packages/parse' . || true

printf '%s\n' '--- workspace and package metadata files ---'
git ls-files | rg '(^|/)(package\.json|yarn\.lock|package-lock\.json|pnpm-lock\.yaml|\.yarnrc|\.npmrc)$' | head -200

Repository: marko-js/prettier

Length of output: 2416


🏁 Script executed:

#!/bin/sh
set -eu

printf '%s\n' '--- imported `@marko/parse` exports ---'
rg -n -C 2 'from ["'\'']`@marko/parse`["'\'']' src

printf '%s\n' '--- lockfile entry ---'
sed -n '1,35p' pnpm-lock.yaml

printf '%s\n' '--- published `@marko/parse` metadata ---'
python3 - <<'PY'
import json
import urllib.request

url = "https://registry.npmjs.org/@marko%2Fparse"
with urllib.request.urlopen(url, timeout=10) as response:
    data = json.load(response)

print("latest:", data.get("dist-tags", {}).get("latest"))
print("versions:", list(data.get("versions", {}))[-10:])
for version in list(data.get("versions", {}))[-3:]:
    package = data["versions"][version]
    print(version, {
        "exports": package.get("exports"),
        "types": package.get("types"),
        "main": package.get("main"),
        "module": package.get("module"),
    })
PY

Repository: marko-js/prettier

Length of output: 4459


Replace the temporary link before publishing.

Update package.json and pnpm-lock.yaml to use a semver range for a published @marko/parse release that provides the imports used by src/. Validate a clean install from the packed plugin.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 46, Replace the temporary local link for `@marko/parse`
in package.json with the appropriate semver range for its published release, and
regenerate pnpm-lock.yaml accordingly. Confirm the selected release provides the
imports used by src/ and validate installation from the packed plugin.

@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-eslint-wv2qux branch from bf8f3ab to 3e0fd41 Compare September 2, 2026 19:03
DylanPiercey and others added 2 commits September 2, 2026 13:21
Slice static statement bodies from the keyword's actual end instead of
assuming `static`, document why the root comments list is cleared,
downgrade the changeset to a patch and describe the dependency change,
and repoint the stale parser feedback item at @marko/parse's errors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant