Starting with Ember 3, the steps to remove jQuery as a dependency have begun. After doing some transition work with a few of our larger components, I’ve noticed a few things that might come in handy for anyone else updating their work. All of these should work in 2.18 and will help smooth final transitions you may make in 3.x.

Tests

I would definitely say tests are where the majority of the jQuery you use will exist. Fortunately, we’ll get a lot of help on this one thanks to a codemod. The codemod is basically a little set of scripts that will do a ton of the conversion work for you, updating a lot of your tests to use the newer Ember Test Helpers. Depending on the complexity of your tests, this could very well cover everything, however you may find yourself hunting down jQuery methods trying to run off the native HTML objects and failing. I like to use a combo of You Might Not Need jQuery and DevDocs to help hunt down the correct equivalents of anything the codemod may have missed.

$

I believe if you search for $(, you will be able to find all the manual jQuery you have sprinkled throughout your code. At which point, you can use the previous 2 links to help you convert jQuery code into vanilla JS. This code seems to generally appear in one/some of the life-cycle hooks of the component. This is generally a straight forward process, depending how comfortable your are with vanilla JS. Some more complex .ajax calls did need some extra referencing. This post, along with this one, may help you in converting them into a native XMLHttpRequest.

Add-ons

This is where things might get tricky. Hopefully you do your due diligence and keep your add-ons as up to date as you can, unfortunately sometimes you’ll find that there’s been a major release that changes a good amount of code and the upgrade effort jumps dramatically. I noticed this happen on our side with Ember Test Selectors. We’ve been using an older version in our style guide and they’ve updated one of their major syntax styles to which we had unknowingly missed, and have already used across other applications. That means in order to use the newest test selector package, we also have to update a lot of test code manually, in all the different places we’re still using the older style. Depending on which add-ons you use, you might even find yourself in a spot where you realize it’s not even being maintained anymore or hasn’t received any updates yet. This is definitely a good time to assess your package tree and make sure you are depending on stuff you need and that is maintained, otherwise it may be wise to switch packages or write your own code!

Other

As far as I’m aware, that about covers all your bases. If you are using Ember Data, you’ll need to swap in ember-fetch to opt out of the jQuery needs. If you’re not already set up with ESLint, you should do that and make sure you have the ember plugin installed as well, which now has a rule for “no jQuery”. That way, you shouldn’t need to hunt down the $s manually, the linter can tell you what line and where! Once you’ve cleaned up all the jQuery cruft from your code, you should check out some of the other tweaks and optimizations Ember 3.x can bring to your code.