eslint-plugin-ember-data-sync-relationships

1.0.0 • Public • Published

eslint-plugin-ember-data-sync-relationships

Build Status npm version

An ESLint plugin that ensures all of your Ember Data relationships are sync.

Why?

We think async relationships do more harm than good. If you agree, you can use this ESLint plugin to help you migrate an app away from async relationships and ensure no new async relationships are added by mistake.

Installation

Install the plugin as a dev dependency in your Ember CLI project.

npm install --save-dev eslint-plugin-ember-data-sync-relationships

This makes the plugin available to ESLint.

Usage

Add the plugin and rule to your app's .eslintrc.js:

// .eslintrc.js
 
module.exports = {
 
  plugins: [
    'ember-data-sync-relationships'
  ],
 
  rules: {
    "ember-data-sync-relationships/no-async-relationships": "warn" // warn or error
  }
 
};

You can make the rule either "warn" or "error".

Using warn will show ESLint warnings whenever you build your app, for example when you run ember serve.

If you'd like to start removing async relationships from an existing app that relies on them, this is a good option, since it won't fail your test suite. You can eliminate async relationships one at a time until you arrive at fully synchronous bliss, at which time you can switch this ESLint rule to "error".

Using error will add any failures to your test suite. This is a stronger way to enforce all relationships stay sync, since Ember Data's default is async and it can be easy to forget the additional { async: false }.

About

This library is developed and maintained by EmberMap. If your company is looking to see how it can get the most out of Ember, please get in touch!

Package Sidebar

Install

npm i eslint-plugin-ember-data-sync-relationships

Weekly Downloads

4,343

Version

1.0.0

License

ISC

Last publish

Collaborators

  • samselikoff