-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
Conflicts with prettier-plugin-ember-template-tag + eslint-plugin-prettier when linting gjs/gts files #1659
Comments
Running the RegExp escape function recommended by MDN on the token before generating the RegExp prevents the error from being thrown, but the line numbers are still way off. I suspect this has to do with the fact that eslint-plugin-ember runs |
Here's more info about what is going wrong. If a user is running the following config:
This is what happens:
By the end everything is all sort of messed up, which causes bugs like:
|
Is the issue that the input from eslint comes preprocesses, and then prettier-plugin-ember-template-tag "preprocesses" it again? And if so, can the prettier plugin detect whether the input is already preprocessed? |
Re-preprocessing is essentially no-op, so that won't fix the issues unfortunately. However, I do think that detecting whether the input is already preprocessed might be useful. I suspect there are multiple issues happening here but the main issues appear to be:
I am working on a version of |
@gitKrystan sounds awesome! |
@NullVoxPopuli I just released prettier-plugin-ember-template-tag 0.1.0 which should have all the fixes necessary. I also did a little spike to make sure the fix would actually be helpful for this library: The tests are still failing, but things are way closer than they were before. |
Any progress with this? |
Eslint plugin ember fixed fixing yesterday - is this issue still an issue after updating? |
It worked for me 🎉 I was getting Prettier errors in preprocessed |
I think this issue is mostly fixed, but there is still a bug when running prettier on |
Note that this change was reverted: |
I had a bug filed on my new project regarding an error being thrown when run via eslint + eslint-plugin-ember + eslint-plugin-prettier: ember-tooling/prettier-plugin-ember-template-tag#20
The further I delve into the issue, the more I think I might need help from this team to solve it, and that possibly the solution might involve changes to this repo rather than mine.
Repro: gitKrystan/simple-gjs-project#2
This is the error thrown:
First of all, it seems like there should be some escaping happening here:
eslint-plugin-ember/lib/preprocessors/glimmer.js
Line 120 in db745a3
Because eslint-plugin-prettier runs Prettier as an ESLint rule, my plugin causes the Prettier ESLint rule to log the following violation message:
Interestingly, the message has the preprocessed
[__GLIMMER_TEMPLATE(
shenanigans when it probably should not. (Not sure yet if that because of something I am doing or because of something happening in this package).As a result, the line linked above is generating
new RegExp('\b[__GLIMMER_\b')
which indeed has an opening[
that the RegExp constructor interprets as the beginning of a character set.I've noticed that this doesn't always happen. For example, if I use the
<template>
tag in the "top-level class" position,npm run lint:js
works properly (ish..it still has[__GLIMMER_TEMPLATE()]
in the message, and I think the line/column numbers might be off):The text was updated successfully, but these errors were encountered: