Skip to content

Latest commit

 

History

History
52 lines (30 loc) · 1.73 KB

use-ember-data-rfc-395-imports.md

File metadata and controls

52 lines (30 loc) · 1.73 KB

ember/use-ember-data-rfc-395-imports

💼 This rule is enabled in the ✅ recommended config.

🔧 This rule is automatically fixable by the --fix CLI option.

Use "Ember Data Packages" from Ember RFC #395.

The goal of this rule is to ease the migration to the new @ember-data packages.

Context

ember-data has been split in multiple packages. For instance, its store is now released in "@ember-data/store" package. These packages have been released starting from ember-data version 3.11.

For TypeScript users, imports from ember-data/types/registries/* are still allowed since there is currently no equivalent in the new packages.

Examples

Examples of incorrect code for this rule:

import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import DS from 'ember-data';

const { Model } = 'ember-data';

Examples of correct code for this rule:

import Model, { attr } from '@ember-data/model';

How to fix

This rule implements a fix function (or to be more precise: it leverages the no-old-shims fix function). If, as a user, you can get rid of all the import DS from "ember-data"; imports, you'll be able to use this rule fixer to complete the upgrade.

Note that a codemod is also available to complete the upgrade.

When Not To Use It

You don't want to use this rule if you're using ember-data@<3.11.

Further Reading

Ember Data Packages RFC