eslint-plugin-ember
eslint-plugin-ember copied to clipboard
Incorrectly identifies components
I'm not aware of how eslint-plugin-ember
works internally, but I think it needs to be more intelligent in terms of how it determines what it is linting (specifically with regards to the order-in-
rules).
For example:
I have a Route here: lib/styleguide/app/routes/styleguide/common/components/tag-editor.js
But, this addon determines it as Component, as you can see in the screenshot.
(It says "Should be above setupController
, but components don't have setupController
!)

If I rename the directory above "components" to something else, then all works as expected.
Anyone able to clarify this is a bug?
AFAICT right now we only use the filename to determine the type, but in this case we should have been able to see that it extends from the @ember/router/route
default export (and is therefore not a component). Definitely seems like something we can/should fix...
This issue also raises its head as part of our build process.
For example, creating a branch with a name like "colocate-components" (Something very likely to be done)
Means everything passes locally, but the build server will spit out:
/home/jenkins/workspace/colocate-components/app/pods/dashboard/route.js
12:26:45 44:3 error The actions hash should be above the "model" method on line 14 ember/order-in-components
...due to the presence of the word components in the file path
@amk221 I have opened #821 which will help improve the situation (it will address your last comment specifically). The solution @rwjblue mentioned is still our long-term goal but a very large refactor would be needed to get there.
Fab thanks!!