Skip to content

Use @marko/parse for parsing - #140

Open
DylanPiercey wants to merge 1 commit into
mainfrom
dpiercey-ws-eslint-wv2qux
Open

Use @marko/parse for parsing#140
DylanPiercey wants to merge 1 commit 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: bf8f3ab

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

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

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 defaults missing targets to "static". A minor-release Changeset documents the migration.

🚥 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%. 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 identifies the main change: using the shared @marko/parse package for parsing.
Description check ✅ Passed The description directly explains the parser migration, shared package integration, test status, and the required dependency update.
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.
✨ 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 from 378525e to 40f6437 Compare August 6, 2026 17:22
@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-eslint-wv2qux branch 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.

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