eslint-plugin-ember icon indicating copy to clipboard operation
eslint-plugin-ember copied to clipboard

Incorrectly identifies components

Open amk221 opened this issue 6 years ago • 5 comments

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!)

screen shot 2018-03-11 at 19 59 45

If I rename the directory above "components" to something else, then all works as expected.

amk221 avatar Mar 11 '18 21:03 amk221

Anyone able to clarify this is a bug?

amk221 avatar Jul 26 '18 14:07 amk221

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...

rwjblue avatar Jul 26 '18 15:07 rwjblue

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 avatar May 20 '20 11:05 amk221

@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.

bmish avatar May 20 '20 15:05 bmish

Fab thanks!!

amk221 avatar May 20 '20 16:05 amk221