From 3dae274ae6f1fc947354e7503a36e62493651fba Mon Sep 17 00:00:00 2001 From: Garrett Murphey Date: Wed, 20 Feb 2019 15:20:57 -0500 Subject: [PATCH] Converting codebase to use module imports. --- .eslintrc.js | 1 - addon/components/resize-detector.js | 11 ++++------- addon/services/resize-detector.js | 4 +++- tests/dummy/app/components/resizable-container.js | 11 ++++------- tests/dummy/app/controllers/application.js | 9 +++------ tests/integration/components/resize-detector-test.js | 8 ++------ 6 files changed, 16 insertions(+), 28 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c9a5082..3a9a150 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,7 +15,6 @@ module.exports = { browser: true }, rules: { - 'ember/new-module-imports': 'warn', 'ember/closure-actions': 'warn' }, overrides: [ diff --git a/addon/components/resize-detector.js b/addon/components/resize-detector.js index 94475fd..b87918b 100644 --- a/addon/components/resize-detector.js +++ b/addon/components/resize-detector.js @@ -1,11 +1,8 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { inject as service } from '@ember/service'; +import { bind, scheduleOnce } from '@ember/runloop'; import layout from '../templates/components/resize-detector'; -const { - inject: { service }, - run: { scheduleOnce, bind } -} = Ember; - /** * Replacement for jQuery $.height() * Borrowed with thanks from https://github.com/nefe/You-Dont-Need-jQuery#2.2 @@ -37,7 +34,7 @@ function getWidth(el) { } -export default Ember.Component.extend({ +export default Component.extend({ layout, tagName: '', resizeDetector: service(), diff --git a/addon/services/resize-detector.js b/addon/services/resize-detector.js index a41fcd3..c2934b9 100644 --- a/addon/services/resize-detector.js +++ b/addon/services/resize-detector.js @@ -1,12 +1,14 @@ /* global elementResizeDetectorMaker */ +import Service from '@ember/service'; + import Ember from 'ember'; const { Logger: { error } } = Ember; -export default Ember.Service.extend({ +export default Service.extend({ init() { this._super(...arguments); diff --git a/tests/dummy/app/components/resizable-container.js b/tests/dummy/app/components/resizable-container.js index 3c8734e..699ead3 100644 --- a/tests/dummy/app/components/resizable-container.js +++ b/tests/dummy/app/components/resizable-container.js @@ -1,11 +1,8 @@ -import Ember from 'ember'; +import Component from '@ember/component'; +import { htmlSafe } from '@ember/template'; +import { computed } from '@ember/object'; -const { - String: { htmlSafe }, - computed -} = Ember; - -export default Ember.Component.extend({ +export default Component.extend({ classNames: ['resizable-container'], style: computed('height', 'width', function(){ diff --git a/tests/dummy/app/controllers/application.js b/tests/dummy/app/controllers/application.js index e0fd67c..8b8f7cb 100644 --- a/tests/dummy/app/controllers/application.js +++ b/tests/dummy/app/controllers/application.js @@ -1,10 +1,7 @@ -import Ember from 'ember'; +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; -const { - inject: { service } -} = Ember; - -export default Ember.Controller.extend({ +export default Controller.extend({ notify: service(), actions: { diff --git a/tests/integration/components/resize-detector-test.js b/tests/integration/components/resize-detector-test.js index a3e65a9..b8514b6 100644 --- a/tests/integration/components/resize-detector-test.js +++ b/tests/integration/components/resize-detector-test.js @@ -1,13 +1,9 @@ -import Ember from 'ember'; +import { htmlSafe } from '@ember/template'; +import { later } from '@ember/runloop'; import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import wait from 'ember-test-helpers/wait'; -const { - String: { htmlSafe }, - run: { later } -} = Ember; - moduleForComponent('resize-detector', 'Integration | Component | resize detector', { integration: true });