-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For linting, we'd need to be able to emit a full AST, including nodes for the template #39
Comments
I need to look at eslint plugin again. I'm not sure this will work there. |
I think it would be best to provide functions which:
I think that would be the best approach and would support a wider range of tools |
some clarifying questions:
Why is not changing offsets important?
Why exactly do we need template nodes parsed? technically, with the content-tag proposal, any language could be used within a content-tag, not just glimmer |
yes, especially for linting
i just meant the ast node. it doesnt need to parse the glimmer content. just have 1 node with e.g. type=GlimmerTemplate. no child nodes. The other tools do not know about it, so template tag must be replaces with some other known JS code. the ast node of code can be found later and replaced. (like its done in eslint plugin now) |
Yeah, two things here, and I think we should do both:
|
That sounds good. |
This would probably also unblock reporting parsing errors on incorrect lines in: typed-ember/glint#655 |
In order to get the index / replacement / splice management out of eslint-plugin-ember or other tooling, additional APIs may be needed -- or a unified AST may need to be provided -- or more tooling so folks don't have to manage the template removing / insertion again.
eslint-plugin-ember
@glimmer/syntax
over the template and re-stitches together AST nodesprettier-plugin-ember-template-tag & ember-template-lint
Motivation
<template>
manipulation really belongs with the tool that already is supporting content-tag, because it can more easily assure that parsing and serialization is correct.Ideas:
format
makes the prettier plugin implementation easier.
the intermediary format is never seen.
parseAst
+serializeAst
This would produce a JSON AST for the whole JS +
<template>
contents, and would require@glimmer/syntax
for now, but I've volunteered myself to learn Rust and have a go at a rust-based glimmer template parser.cc @patricklx @wagenet, @gitKrystan
The text was updated successfully, but these errors were encountered: