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

New rule: no-deprecated-transition-methods #1074

Closed
rwjblue opened this issue Jan 21, 2021 · 4 comments · Fixed by #1715
Closed

New rule: no-deprecated-transition-methods #1074

rwjblue opened this issue Jan 21, 2021 · 4 comments · Fixed by #1715
Labels
enhancement New Rule Idea for a new lint rule

Comments

@rwjblue
Copy link
Member

rwjblue commented Jan 21, 2021

Adds a nice way to handle emberjs/rfcs#674 by flagging them as an issue, and adding a fixer to use the router service.

This would flag:

  • Using this.transitionTo from a route
  • Using this.replaceWith from a route
  • Using this.transitionToRoute from a controller
  • Using this.replaceRoute from a controller

The fixer would be:

  • this.transitionTo -> adding router service + this.router.transitionTo
  • this.replaceWith -> adding router service + this.router.replaceWith
  • this.transitionToRoute -> adding router service + this.router.transitionTo
  • this.replaceRoute -> adding router service + this.router.replaceWith

The deprecation was implemented in emberjs/ember.js#19255 and will be included in Ember 3.26.

(note: I'm not super in love with the name)

@jaydgruber
Copy link
Contributor

name suggestion: prefer-router-service-methods?

@rwjblue
Copy link
Member Author

rwjblue commented Feb 1, 2021

Ya, I'm not super sold on my original name suggestion here. The thing that I want to make clear though, is that this is about deprecation avoidance (not a general preference / stylistic thing).

@bmish probably has a better handle on existing naming scheme for us to follow here

@bmish
Copy link
Member

bmish commented Feb 1, 2021

Agreed with @rwjblue that the name should state of the goal of deprecation avoidance. So no-deprecated-transition-methods or possibly no-deprecated-router-transition-methods would be even more clear.

@bmish bmish added the New Rule Idea for a new lint rule label May 16, 2022
@rtablada
Copy link
Contributor

We're hitting the same deprecation. While it seems like the deprecation is pushed back a while, this is an easy lint/codemod candidate.

I implemented a similar rule with class state, adding service injection, etc in #1714 so I think I can knock this one out pretty easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New Rule Idea for a new lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants