Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,18 @@ import type { Parser, ParseOptions } from "zmod";
*/
export const emberParser: Parser = {
parse(source: string, options?: ParseOptions): any {
const ast = toTree(source, { ...(options as any), includeParentLinks: false });
const ast = toTree(source, {
...(options as any),
includeParentLinks: false,
// zmod walks the tree via visitor keys; keep Glimmer comment nodes
// in GlimmerTemplate.body (with semantic types + longForm) so
// `root.find("GlimmerCommentStatement")` / `root.find("GlimmerMustacheCommentStatement")`
// can reach them. Without this opt-in, ember-estree's default
// removes them from body and surfaces only Block-typed clones
// in `ast.comments` — the right contract for ESLint consumers,
// but invisible to zmod's tree-walker.
keepCommentsInBody: true,
});

return ast;
},
Expand Down