vastec / ember-unused-components

Search for unused components in your Ember project
51 stars 12 forks source link

Handle other ember objects #7

Open ctjhoa opened 5 years ago

ctjhoa commented 5 years ago

Right now the addon only handle components but we can imagine other algorithm to find unused routes, views, partials...

The addon can be renamed ember-unused and can provides multiple commands like ember unused:views.

Is it something you have in mind for futur releases?

tniezurawski commented 5 years ago

That's an interesting idea, although I don't know yet how to recognize if a view/route/controller is not used. We could search for links and transitions to some route and based on that analyze if it has a chance to be used :) But there might be routes that are not used inside the project but users are directed to them via email for example. I can imagine a landing page that says that you were unsubscribed from something which is handled in a different way in the app itself.

Any idea @ctjhoa?

ctjhoa commented 5 years ago

Route can be tricky to track, indeed. Another thing to take into account is that this addon act like a linter, so it doesn't force you to do something. It's just a warning and you should be able to silence that warning.

However we can notify routes that aren't present in the router.js at least. Services should be straight too as if there is no injection nor import, it should be consider as dead code. Controller without attached routes should be considered dead too.