Skip to content
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

@glint directives do not work when used as TS/JS comments #503

Closed
aberres opened this issue Dec 19, 2022 · 2 comments · Fixed by #562
Closed

@glint directives do not work when used as TS/JS comments #503

aberres opened this issue Dec 19, 2022 · 2 comments · Fixed by #562
Labels
question Further information is requested

Comments

@aberres
Copy link

aberres commented Dec 19, 2022

We have a lot of test files with templates the way described here: https://typed-ember.gitbook.io/glint/using-glint/ember/rendering-tests

So far we do not yet have typed interfaces in place. To silence glint, I needed to add several hundred {{! @glint-nocheck }} throughout the test files like this.

await render<MyContext>(hbs`
    {{! @glint-nocheck }}
    <MyComponent @arg={{this.message}} />
`);

Adding them worked okish with some search/replace foo, but fixing the formatting will be a bunch of work.

It would be great if I could either completely disable checking templates in ts files or if // @glint-nocheck would work the same for hbs files.

@chriskrycho
Copy link
Member

The context in which a @glint directive applies (or ever will apply) just is templates—because Glint intentionally does not participate in what TS does with a TS or JS file. That is: we don't want to insert ourselves into the TS pipeline other than translating templates into a TS representation. So that'll be a hard no to // @glint-nocheck. 😅

For adding {{! @glint-nocheck }}, does the glint-auto-nocheck script not work for tests?

@chriskrycho chriskrycho changed the title @glint directives do not work in (test) .ts files @glint directives do not work when used as TS/JS comments Dec 19, 2022
@aberres
Copy link
Author

aberres commented Dec 20, 2022

@chriskrycho Thanks for the extensive answer! Maybe adding more or less what you have written to https://typed-ember.gitbook.io/glint/using-glint/directives could clarify things. Perhaps it is just us, but a colleague of mine also tried to use comments in the TS files.

I just checked the glint-auto-nocheck script. It works! When introducing glint initially, we were importing hbs from htmlbars-inline-precompile which did not trigger a check.
Indentation is broken for cases where a multiline comment does not have a line break after "hbs`" but this was already ugly before.

@dfreeman dfreeman added the question Further information is requested label Jan 4, 2023
@dfreeman dfreeman linked a pull request Apr 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants