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

Parsing error for template tags within classes on v11.11.0 #1940

Closed
Techn1x opened this issue Aug 22, 2023 · 6 comments · Fixed by #1941
Closed

Parsing error for template tags within classes on v11.11.0 #1940

Techn1x opened this issue Aug 22, 2023 · 6 comments · Fixed by #1941
Labels

Comments

@Techn1x
Copy link

Techn1x commented Aug 22, 2023

I just bumped to eslint-plugin-ember 11.11.0 which consumes this PR #1920

However, now all of my GTS and GJS files seem to cause eslint parsing errors where they use the <template> tag within a class.

Within a class

Parsing error: Unexpected token. A constructor, method, accessor, or property was expected

Within a TOC

Parsing error: '>' expected

Here's an example component
Screenshot 2023-08-22 at 9 24 20 pm

and the error
Screenshot 2023-08-22 at 9 25 16 pm
eslint output
Screenshot 2023-08-22 at 9 25 46 pm

Relevant packages installed;
eslint 8.47
eslint-plugin-ember 11.11.0
ember-template-lint 5.11.2
ember-template-lint-plugin-prettier 5.0.0
prettier-plugin-ember-template-tag 1.0.2

@bmish bmish added the Bug label Aug 22, 2023
@Techn1x
Copy link
Author

Techn1x commented Aug 22, 2023

A suggestion made here was to not specify a parser #1920 (comment)

Unfortunately, that does not seem to resolve the issue (I've commented out my typescript-eslint parser in my eslintrc.js file)
Screenshot 2023-08-22 at 9 27 43 pm
(note: I also tried plugin:@typescript-eslint/base instead of recommended for the plugin, no luck with that either)

@bmish
Copy link
Member

bmish commented Aug 22, 2023

As mentioned in #1920 (comment), if #1920 is a breaking change, we will need to revert it.

@Techn1x
Copy link
Author

Techn1x commented Aug 22, 2023

After some messing around, what does fix it, is if I place the ember config after the typescript-eslint config, as well as commenting out the parser. recommended or base doesn't seem to matter for the typescript-eslint config here.

Screenshot 2023-08-22 at 9 45 14 pm

The parsing errors I mentioned go away (I just get a whole bunch of different ones, but I don't think they're related)

@bmish
Copy link
Member

bmish commented Aug 22, 2023

We can't control what order people set their configs in or whether they use a parser globally. So it sounds like a breaking change.

@patricklx let's do a revert then. Is there another approach you'd like to try that isn't breaking? Or an acceptable breaking change that we should save for a major release?

@Techn1x
Copy link
Author

Techn1x commented Aug 22, 2023

@patricklx
Copy link
Contributor

yes, that's what ember plugin also does in the recommended config. But eslint does not override the parser if its specified globally in the config :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants