ember-cli / ember-cli/eslint-plugin-ember

<template> tag + eslint-plugin-sort-class-members (and possibly other plugins)

Open
#1,896 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
263
Forks
214
Avg merge
30m
Merged PRs (30d)
5

Description

This may not end up being a thing that needs to be handled in eslint-plugin-ember itself, but it may, and in any case it seems like a good place to have the discussion.

The issue I ran into is with an external plugin [eslint-plugin-sort-class-members](https://github.com/bryanrsmith/eslint-plugin-sort-class-members#usage). I found it because it's used by Discourse, but it's not specific to Discourse at all, and seems somewhat popular outside of Discourse, and seems like the kind of plugin that we would expect people to be able to use with `.gjs` files. I also think the issue is probably more general.

I ran into are two issues.

The first issue is that their default error message leaks the internal `__GLIMMER_TEMPLATE`:

```
3:3 error Expected property __GLIMMER_TEMPLATE to come before method bar sort-class-members/sort-class-members
```

The other issue is that if you try to relocate the template tag with `--fix`, it will emit `[__GLIMMER_TEMPLATE(...)]` to the moved location rather than ``.

It seems like this would be a problem in general for any rules that operate over the range of the template tag. Ideally, we would find some ways to fix this generally rather than something specific to the eslint-plugin-sort-class-members plugin, though I don't know enough about the eslint architecture to know what is possible.

Perhaps this is related to the idea of [representing the template tag as a custom AST node](https://github.com/emberjs/rfcs/pull/813#issuecomment-1416335759)? Not sure if that's actually going to help or make things worse (hard errors on the unknown AST node) with plugins in general.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.