erb-parser-maintenance
Perform maintenance tasks for @markuplint/erb-parser: add or modify ERB ignoreTags patterns.
Input
$ARGUMENTS specifies the task. Supported tasks:
| Task | Description |
|---|---|
add-ignore-tag | Add a new ERB tag pattern to ignoreTags |
modify-ignore-tag | Modify an existing ignoreTags pattern |
If omitted, defaults to add-ignore-tag.
Reference
Before executing any task, read docs/maintenance.md (or docs/maintenance.ja.md)
for the full guide. The recipes there are the source of truth for procedures.
Also read:
- •
ARCHITECTURE.md-- Package overview, ignoreTags configuration, and integration points - •
src/parser.ts-- ERubyParser class (source of truth for ignoreTags configuration)
Task: add-ignore-tag
Add a new ERB tag pattern to the ignoreTags array. Follow recipe #1 in docs/maintenance.md.
Step 1: Determine the pattern
- •Read
src/parser.tsto see existing ignoreTags entries - •Define the new tag's
type,start, andendpatterns - •Determine the correct position in the array (more specific patterns first)
Step 2: Add the entry
- •Add the new entry to the
ignoreTagsarray in theERubyParserconstructor - •Use a string for literal start patterns, or a regex for patterns requiring lookahead/lookbehind
Step 3: Verify
- •Build:
yarn build --scope @markuplint/erb-parser - •Add test cases to
src/index.spec.tsverifying the new tag type appears as#ps:<type>in the AST - •Test:
yarn test --scope @markuplint/erb-parser
Task: modify-ignore-tag
Modify an existing ignoreTags pattern. Follow recipe #2 in docs/maintenance.md.
Step 1: Identify the pattern
- •Read
src/parser.tsand locate the ignoreTags entry to modify - •Understand why the change is needed (e.g., new ERB syntax, false matches)
Step 2: Make the change
- •Update the
start,end, ortypefields as needed - •Ensure pattern ordering is still correct (more specific patterns first)
- •If changing a regex pattern, verify it does not match escaped ERB delimiters (
<%%)
Step 3: Verify
- •Build:
yarn build --scope @markuplint/erb-parser - •Update test cases in
src/index.spec.tsif the AST node names changed - •Test:
yarn test --scope @markuplint/erb-parser
Rules
- •Pattern order matters -- More specific patterns (e.g.,
<%=,<%#) must appear before general patterns (e.g.,/<%(?!%)/). - •Escaped delimiters --
<%%must not be matched by any pattern. Use negative lookahead(?!%)on general patterns. - •Add JSDoc comments to document any new tag types.
- •No downstream impact -- This is a leaf parser with no downstream dependencies.