diff --git a/.eslintrc b/.eslintrc index 7898fbf8294..d7350cda7f5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,3 +1,7 @@ { - "extends": "eslint-config-discourse" + "extends": "eslint-config-discourse", + "plugins": ["discourse-ember"], + "rules": { + "discourse-ember/global-ember": 2 + } } diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-api-keys-index.js.es6 index b0872696263..99176791bf2 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-index.js.es6 @@ -1,6 +1,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error"; +import Controller from "@ember/controller"; -export default Ember.Controller.extend({ +export default Controller.extend({ actions: { revokeKey(key) { key.revoke().catch(popupAjaxError); diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 index 7bb679f2d0d..42391beaf83 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-new.js.es6 @@ -1,7 +1,8 @@ import discourseComputed from "discourse-common/utils/decorators"; +import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; -export default Ember.Controller.extend({ +export default Controller.extend({ userModes: [ { id: "all", name: I18n.t("admin.api.all_users") }, { id: "single", name: I18n.t("admin.api.single_user") } diff --git a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js.es6 index 2e19ea57799..6927de87e7d 100644 --- a/app/assets/javascripts/admin/controllers/admin-api-keys-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-api-keys-show.js.es6 @@ -1,8 +1,10 @@ import { bufferedProperty } from "discourse/mixins/buffered-content"; +import Controller from "@ember/controller"; +import { isEmpty } from "@ember/utils"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { empty } from "@ember/object/computed"; -export default Ember.Controller.extend(bufferedProperty("model"), { +export default Controller.extend(bufferedProperty("model"), { isNew: empty("model.id"), actions: { @@ -21,7 +23,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), { cancel() { const id = this.get("userField.id"); - if (Ember.isEmpty(id)) { + if (isEmpty(id)) { this.destroyAction(this.userField); } else { this.rollbackBuffer(); diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 index bec36cf47da..0586a33505d 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 @@ -1,10 +1,10 @@ import discourseComputed, { observes } from "discourse-common/utils/decorators"; import { reads } from "@ember/object/computed"; -import { inject } from "@ember/controller"; -import Controller from "@ember/controller"; +import Controller, { inject } from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; import { bufferedProperty } from "discourse/mixins/buffered-content"; import { propertyNotEqual } from "discourse/lib/computed"; +import { run } from "@ember/runloop"; export default Controller.extend(bufferedProperty("model"), { adminBadges: inject(), @@ -23,7 +23,7 @@ export default Controller.extend(bufferedProperty("model"), { // this is needed because the model doesnt have default values // and as we are using a bufferedProperty it's not accessible // in any other way - Ember.run.next(() => { + run.next(() => { if (this.model) { if (!this.model.badge_type_id) { this.model.set( diff --git a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 index 350ec2dd4f0..a8e25fdec98 100644 --- a/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-customize-themes-show.js.es6 @@ -13,6 +13,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error"; import showModal from "discourse/lib/show-modal"; import ThemeSettings from "admin/models/theme-settings"; import { THEMES, COMPONENTS } from "admin/models/theme"; +import EmberObject from "@ember/object"; const THEME_UPLOAD_VAR = 2; @@ -67,7 +68,7 @@ export default Controller.extend({ @discourseComputed("model.parentThemes.[]") relativesSelectorSettingsForComponent() { - return Ember.Object.create({ + return EmberObject.create({ list_type: "compact", type: "list", preview: null, @@ -85,7 +86,7 @@ export default Controller.extend({ @discourseComputed("model.parentThemes.[]") relativesSelectorSettingsForTheme() { - return Ember.Object.create({ + return EmberObject.create({ list_type: "compact", type: "list", preview: null, diff --git a/app/assets/javascripts/admin/routes/admin-api-keys-show.js.es6 b/app/assets/javascripts/admin/routes/admin-api-keys-show.js.es6 index b21f2cd021e..0355241c037 100644 --- a/app/assets/javascripts/admin/routes/admin-api-keys-show.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-api-keys-show.js.es6 @@ -1,4 +1,6 @@ -export default Ember.Route.extend({ +import Route from "@ember/routing/route"; + +export default Route.extend({ model(params) { return this.store.find("api-key", params.api_key_id); } diff --git a/app/assets/javascripts/discourse-common/mixins/focus-event.js.es6 b/app/assets/javascripts/discourse-common/mixins/focus-event.js.es6 index 974d73c958a..0688c90831e 100644 --- a/app/assets/javascripts/discourse-common/mixins/focus-event.js.es6 +++ b/app/assets/javascripts/discourse-common/mixins/focus-event.js.es6 @@ -1,7 +1,8 @@ import { bind } from "@ember/runloop"; import { getOwner } from "discourse-common/lib/get-owner"; +import Mixin from "@ember/object/mixin"; -export default Ember.Mixin.create({ +export default Mixin.create({ ready() { this._super(...arguments); diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index 78e461d9b49..9e7780d9109 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -108,6 +108,10 @@ var define, requirejs; }, "@ember/error": { default: Ember.error + }, + + "@ember/object/internals": { + guidFor: Ember.guidFor } }; } diff --git a/app/assets/javascripts/discourse/components/global-notice.js.es6 b/app/assets/javascripts/discourse/components/global-notice.js.es6 index 6096ebe1de8..8ca725abaa5 100644 --- a/app/assets/javascripts/discourse/components/global-notice.js.es6 +++ b/app/assets/javascripts/discourse/components/global-notice.js.es6 @@ -2,6 +2,7 @@ import { bind, cancel } from "@ember/runloop"; import Component from "@ember/component"; import LogsNotice from "discourse/services/logs-notice"; import EmberObject from "@ember/object"; +import { computed } from "@ember/object"; const _pluginNotices = []; @@ -58,7 +59,7 @@ export default Component.extend({ this._tearDownObservers(); }, - notices: Ember.computed( + notices: computed( "site.isReadOnly", "siteSettings.disable_emails", "logNotice.{id,text,hidden}", diff --git a/app/assets/javascripts/discourse/components/reviewable-field-tags.js.es6 b/app/assets/javascripts/discourse/components/reviewable-field-tags.js.es6 index 3e23d8b884f..9280d8ee4dc 100644 --- a/app/assets/javascripts/discourse/components/reviewable-field-tags.js.es6 +++ b/app/assets/javascripts/discourse/components/reviewable-field-tags.js.es6 @@ -1,4 +1,6 @@ -export default Ember.Component.extend({ +import Component from "@ember/component"; + +export default Component.extend({ actions: { onChange(tags) { this.valueChanged && diff --git a/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 b/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 index e4a3a0187ee..d2d37058665 100644 --- a/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 +++ b/app/assets/javascripts/discourse/controllers/tag-groups-new.js.es6 @@ -1,7 +1,7 @@ -import Controller from "@ember/controller"; +import Controller, { inject } from "@ember/controller"; export default Controller.extend({ - tagGroups: Ember.inject.controller(), + tagGroups: inject(), actions: { onSave() { diff --git a/app/assets/javascripts/discourse/lib/discourse-location.js.es6 b/app/assets/javascripts/discourse/lib/discourse-location.js.es6 index d9d504171b9..8c10f353a82 100644 --- a/app/assets/javascripts/discourse/lib/discourse-location.js.es6 +++ b/app/assets/javascripts/discourse/lib/discourse-location.js.es6 @@ -1,5 +1,6 @@ import EmberObject from "@ember/object"; import { defaultHomepage } from "discourse/lib/utilities"; +import { guidFor } from "@ember/object/internals"; let popstateFired = false; const supportsHistoryState = window.history && "state" in window.history; const popstateCallbacks = []; @@ -174,7 +175,7 @@ const DiscourseLocation = EmberObject.extend({ @param callback {Function} */ onUpdateURL(callback) { - const guid = Ember.guidFor(this); + const guid = guidFor(this); $(window).on(`popstate.ember-location-${guid}`, () => { const url = this.getURL(); @@ -215,7 +216,7 @@ const DiscourseLocation = EmberObject.extend({ willDestroy() { this._super(...arguments); - const guid = Ember.guidFor(this); + const guid = guidFor(this); $(window).off(`popstate.ember-location-${guid}`); } }); diff --git a/app/assets/javascripts/discourse/lib/reports-loader.js.es6 b/app/assets/javascripts/discourse/lib/reports-loader.js.es6 index fefd6c4c4d6..1d41d0a1cf6 100644 --- a/app/assets/javascripts/discourse/lib/reports-loader.js.es6 +++ b/app/assets/javascripts/discourse/lib/reports-loader.js.es6 @@ -1,5 +1,6 @@ +import { run } from "@ember/runloop"; import { ajax } from "discourse/lib/ajax"; -const { debounce } = Ember.run; +const { debounce } = run; let _queue = []; let _processing = 0; diff --git a/app/assets/javascripts/discourse/routes/preferences-profile.js.es6 b/app/assets/javascripts/discourse/routes/preferences-profile.js.es6 index b56f1d7d786..02eb4df866c 100644 --- a/app/assets/javascripts/discourse/routes/preferences-profile.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-profile.js.es6 @@ -1,10 +1,11 @@ import RestrictedUserRoute from "discourse/routes/restricted-user"; +import { set } from "@ember/object"; export default RestrictedUserRoute.extend({ showFooter: true, setupController(controller, model) { if (!model.user_option.timezone) { - Ember.set(model, "user_option.timezone", moment.tz.guess()); + set(model, "user_option.timezone", moment.tz.guess()); } controller.set("model", model); diff --git a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 index 125b8701cf9..773c2b10e70 100644 --- a/app/assets/javascripts/select-kit/components/composer-actions.js.es6 +++ b/app/assets/javascripts/select-kit/components/composer-actions.js.es6 @@ -8,6 +8,7 @@ import { import Draft from "discourse/models/draft"; import { computed } from "@ember/object"; import { camelize } from "@ember/string"; +import { isEmpty } from "@ember/utils"; // Component can get destroyed and lose state let _topicSnapshot = null; @@ -49,7 +50,7 @@ export default DropdownSelectBoxComponent.extend({ _postSnapshot = this.get("composerModel.post"); } - if (Ember.isEmpty(this.content)) { + if (isEmpty(this.content)) { this.set("selectKit.isHidden", true); } }, diff --git a/app/assets/javascripts/select-kit/components/select-kit.js.es6 b/app/assets/javascripts/select-kit/components/select-kit.js.es6 index 39d47053125..333a8438a7d 100644 --- a/app/assets/javascripts/select-kit/components/select-kit.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit.js.es6 @@ -1,9 +1,12 @@ import { computed, default as EmberObject } from "@ember/object"; import Component from "@ember/component"; import deprecated from "discourse-common/lib/deprecated"; -const { get, isNone, makeArray } = Ember; +import { makeArray } from "discourse-common/lib/helpers"; +import { get } from "@ember/object"; import UtilsMixin from "select-kit/mixins/utils"; import PluginApiMixin from "select-kit/mixins/plugin-api"; +import Mixin from "@ember/object/mixin"; +import { isEmpty, isNone } from "@ember/utils"; import { next, debounce, @@ -26,7 +29,7 @@ export const MAIN_COLLECTION = "MAIN_COLLECTION"; export const ERRORS_COLLECTION = "ERRORS_COLLECTION"; const EMPTY_OBJECT = Object.freeze({}); -const SELECT_KIT_OPTIONS = Ember.Mixin.create({ +const SELECT_KIT_OPTIONS = Mixin.create({ mergedProperties: ["selectKitOptions"], selectKitOptions: EMPTY_OBJECT }); @@ -220,7 +223,7 @@ export default Component.extend( ); this.selectKit.setProperties({ - hasSelection: !Ember.isEmpty(this.value), + hasSelection: !isEmpty(this.value), noneItem: this._modifyNoSelectionWrapper() }); @@ -572,7 +575,7 @@ export default Component.extend( } } - const hasNoContent = Ember.isEmpty(content); + const hasNoContent = isEmpty(content); if ( this.selectKit.hasSelection && diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-body.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-body.js.es6 index dc4bfa62e3c..d590cfd3bc7 100644 --- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-body.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-body.js.es6 @@ -1,5 +1,6 @@ import Component from "@ember/component"; import { computed } from "@ember/object"; +import { bind } from "@ember/runloop"; export default Component.extend({ layoutName: "select-kit/templates/components/select-kit/select-kit-body", @@ -13,10 +14,7 @@ export default Component.extend({ init() { this._super(...arguments); - this.handleRootMouseDownHandler = Ember.run.bind( - this, - this.handleRootMouseDown - ); + this.handleRootMouseDownHandler = bind(this, this.handleRootMouseDown); }, didInsertElement() { diff --git a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 index a4a7fb6d1a1..99f9df0acbf 100644 --- a/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 +++ b/app/assets/javascripts/select-kit/components/select-kit/select-kit-row.js.es6 @@ -2,6 +2,7 @@ import Component from "@ember/component"; import { propertyEqual } from "discourse/lib/computed"; import { computed } from "@ember/object"; import { makeArray } from "discourse-common/lib/helpers"; +import { guidFor } from "@ember/object/internals"; import UtilsMixin from "select-kit/mixins/utils"; export default Component.extend(UtilsMixin, { @@ -30,7 +31,7 @@ export default Component.extend(UtilsMixin, { }), guid: computed("item", function() { - return Ember.guidFor(this.item); + return guidFor(this.item); }), ariaLabel: computed("item.ariaLabel", "title", function() { diff --git a/app/assets/javascripts/select-kit/mixins/tags.js.es6 b/app/assets/javascripts/select-kit/mixins/tags.js.es6 index 9a6faecba95..22198a25bb8 100644 --- a/app/assets/javascripts/select-kit/mixins/tags.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/tags.js.es6 @@ -3,6 +3,7 @@ import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import Mixin from "@ember/object/mixin"; import { makeArray } from "discourse-common/lib/helpers"; +import { isEmpty } from "@ember/utils"; export default Mixin.create({ searchTags(url, data, callback) { @@ -55,7 +56,7 @@ export default Mixin.create({ } const toLowerCaseOrUndefined = string => { - return Ember.isEmpty(string) ? undefined : string.toLowerCase(); + return isEmpty(string) ? undefined : string.toLowerCase(); }; const inCollection = content diff --git a/app/assets/javascripts/select-kit/mixins/utils.js.es6 b/app/assets/javascripts/select-kit/mixins/utils.js.es6 index d044416f22b..4ff1927b072 100644 --- a/app/assets/javascripts/select-kit/mixins/utils.js.es6 +++ b/app/assets/javascripts/select-kit/mixins/utils.js.es6 @@ -1,5 +1,5 @@ import Mixin from "@ember/object/mixin"; -const { get } = Ember; +import { get } from "@ember/object"; export default Mixin.create({ defaultItem(value, name) { @@ -57,7 +57,7 @@ export default Mixin.create({ }, findValue(content, item) { - const property = Ember.get(this.selectKit, "valueProperty"); + const property = get(this.selectKit, "valueProperty"); if (!property) { if (content.indexOf(item) > -1) { diff --git a/package.json b/package.json index c2af9eba6a4..94ff154a304 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@arkweid/lefthook": "^0.6.3", "chrome-launcher": "^0.12.0", "chrome-remote-interface": "^0.25", + "eslint-plugin-discourse-ember": "0.0.3", "eslint-config-discourse": "1.1.0", "lodash-cli": "https://github.com/lodash-archive/lodash-cli.git", "pretender": "^1.6", diff --git a/test/javascripts/components/badge-title-test.js.es6 b/test/javascripts/components/badge-title-test.js.es6 index a6af1eff06b..8f1630f844e 100644 --- a/test/javascripts/components/badge-title-test.js.es6 +++ b/test/javascripts/components/badge-title-test.js.es6 @@ -1,5 +1,6 @@ import selectKit from "helpers/select-kit-helper"; import componentTest from "helpers/component-test"; +import EmberObject from "@ember/object"; moduleForComponent("badge-title", { integration: true }); @@ -10,10 +11,10 @@ componentTest("badge title", { beforeEach() { this.set("subject", selectKit()); this.set("selectableUserBadges", [ - Ember.Object.create({ + EmberObject.create({ badge: { name: "(none)" } }), - Ember.Object.create({ + EmberObject.create({ id: 42, badge_id: 102, badge: { name: "Test" } diff --git a/test/javascripts/components/select-kit/category-drop-test.js.es6 b/test/javascripts/components/select-kit/category-drop-test.js.es6 index 79cbafdf80b..e44b8d24a7e 100644 --- a/test/javascripts/components/select-kit/category-drop-test.js.es6 +++ b/test/javascripts/components/select-kit/category-drop-test.js.es6 @@ -5,6 +5,7 @@ import { NO_CATEGORIES_ID, ALL_CATEGORIES_ID } from "select-kit/components/category-drop"; +import { set } from "@ember/object"; testSelectKitModule("category-drop"); @@ -82,8 +83,8 @@ componentTest("[not staff - TL0] displayCategoryDescription", { template: template(), beforeEach() { - Ember.set(this.currentUser, "staff", false); - Ember.set(this.currentUser, "trustLevel", 0); + set(this.currentUser, "staff", false); + set(this.currentUser, "trustLevel", 0); initCategories(this); }, @@ -103,8 +104,8 @@ componentTest("[not staff - TL1] displayCategoryDescription", { template: template(), beforeEach() { - Ember.set(this.currentUser, "staff", false); - Ember.set(this.currentUser, "trustLevel", 1); + set(this.currentUser, "staff", false); + set(this.currentUser, "trustLevel", 1); initCategories(this); }, @@ -124,8 +125,8 @@ componentTest("[staff - TL0] displayCategoryDescription", { template: template(), beforeEach() { - Ember.set(this.currentUser, "staff", true); - Ember.set(this.currentUser, "trustLevel", 0); + set(this.currentUser, "staff", true); + set(this.currentUser, "trustLevel", 0); initCategories(this); }, diff --git a/test/javascripts/components/select-kit/tag-drop-test.js.es6 b/test/javascripts/components/select-kit/tag-drop-test.js.es6 index 2a558ade855..70190d0d091 100644 --- a/test/javascripts/components/select-kit/tag-drop-test.js.es6 +++ b/test/javascripts/components/select-kit/tag-drop-test.js.es6 @@ -1,11 +1,12 @@ import componentTest from "helpers/component-test"; import { testSelectKitModule } from "./select-kit-test-helper"; import Site from "discourse/models/site"; +import { set } from "@ember/object"; testSelectKitModule("tag-drop", { beforeEach() { const site = Site.current(); - Ember.set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]); + set(site, "top_tags", ["jeff", "neil", "arpit", "régis"]); const response = object => { return [200, { "Content-Type": "application/json" }, object]; diff --git a/test/javascripts/controllers/topic-test.js.es6 b/test/javascripts/controllers/topic-test.js.es6 index 4ae05626666..da92e3df312 100644 --- a/test/javascripts/controllers/topic-test.js.es6 +++ b/test/javascripts/controllers/topic-test.js.es6 @@ -4,6 +4,7 @@ import Topic from "discourse/models/topic"; import PostStream from "discourse/models/post-stream"; import { Placeholder } from "discourse/lib/posts-with-placeholders"; import User from "discourse/models/user"; +import { Promise } from "rsvp"; moduleFor("controller:topic", "controller:topic", { needs: [ @@ -534,7 +535,7 @@ QUnit.test( reply_count: 3, destroy: () => { destroyed = true; - return Ember.RSVP.Promise.resolve(); + return Promise.resolve(); } }); diff --git a/test/javascripts/helpers/review-pretender.js.es6 b/test/javascripts/helpers/review-pretender.js.es6 index c37e63b7f80..406e02ebc39 100644 --- a/test/javascripts/helpers/review-pretender.js.es6 +++ b/test/javascripts/helpers/review-pretender.js.es6 @@ -1,3 +1,4 @@ +import { set } from "@ember/object"; export default function(helpers) { const { response } = helpers; @@ -136,7 +137,7 @@ export default function(helpers) { this.put("/review/:id", request => { let result = { payload: {} }; Object.entries(JSON.parse(request.requestBody).reviewable).forEach(t => { - Ember.set(result, t[0], t[1]); + set(result, t[0], t[1]); }); return response(200, result); }); diff --git a/test/javascripts/helpers/select-kit-helper.js.es6 b/test/javascripts/helpers/select-kit-helper.js.es6 index c5e1664de92..e78369de155 100644 --- a/test/javascripts/helpers/select-kit-helper.js.es6 +++ b/test/javascripts/helpers/select-kit-helper.js.es6 @@ -1,3 +1,5 @@ +import { isEmpty } from "@ember/utils"; + function checkSelectKitIsNotExpanded(selector) { if (find(selector).hasClass("is-expanded")) { // eslint-disable-next-line no-console @@ -90,7 +92,7 @@ function rowHelper(row) { }, value() { const value = row.attr("data-value"); - return Ember.isEmpty(value) ? null : value; + return isEmpty(value) ? null : value; }, exists() { return exists(row); @@ -105,7 +107,7 @@ function headerHelper(header) { return { value() { const value = header.attr("data-value"); - return Ember.isEmpty(value) ? null : value; + return isEmpty(value) ? null : value; }, name() { return header.attr("data-name"); diff --git a/test/javascripts/lib/preload-store-test.js.es6 b/test/javascripts/lib/preload-store-test.js.es6 index c43f2b8dd48..b0560b169c5 100644 --- a/test/javascripts/lib/preload-store-test.js.es6 +++ b/test/javascripts/lib/preload-store-test.js.es6 @@ -1,5 +1,6 @@ import PreloadStore from "preload-store"; import { asyncTestDiscourse } from "helpers/qunit-helpers"; +import { Promise } from "rsvp"; QUnit.module("preload-store", { beforeEach() { @@ -56,7 +57,7 @@ asyncTestDiscourse( assert.expect(1); const finder = function() { - return new Ember.RSVP.Promise(function(resolve) { + return new Promise(function(resolve) { resolve("hahahah"); }); }; @@ -75,7 +76,7 @@ asyncTestDiscourse( assert.expect(1); const finder = function() { - return new Ember.RSVP.Promise(function(resolve, reject) { + return new Promise(function(resolve, reject) { reject("error"); }); }; diff --git a/test/javascripts/widgets/widget-test.js.es6 b/test/javascripts/widgets/widget-test.js.es6 index 0ab65b0dc5c..9df74324c74 100644 --- a/test/javascripts/widgets/widget-test.js.es6 +++ b/test/javascripts/widgets/widget-test.js.es6 @@ -2,6 +2,7 @@ import { next } from "@ember/runloop"; import { moduleForWidget, widgetTest } from "helpers/widget-test"; import { createWidget } from "discourse/widgets/widget"; import { withPluginApi } from "discourse/lib/plugin-api"; +import { Promise } from "rsvp"; import hbs from "discourse/widgets/hbs-compiler"; moduleForWidget("base"); @@ -159,7 +160,7 @@ widgetTest("widget update with promise", { `, click() { - return new Ember.RSVP.Promise(resolve => { + return new Promise(resolve => { next(() => { this.state.name = "Robin"; resolve(); diff --git a/yarn.lock b/yarn.lock index ea469bf7996..4bf5e21b8cd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -741,6 +741,13 @@ eslint-config-discourse@1.1.0: eslint "^4.19" prettier "^1.19.1" +eslint-plugin-discourse-ember@0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-discourse-ember/-/eslint-plugin-discourse-ember-0.0.3.tgz#69e5876c2ece38ab3d6c4a05f0a20a7dc4c21e37" + integrity sha512-EFwWU4FlOSLBa4RolKZL8QD1eGOnvSkACLt4Big+o1ZUIpW7gGvfnJPtxkbaQ4XmhtZ5HetYt6862vVqhUMv9A== + dependencies: + requireindex "~1.1.0" + eslint-plugin-lodash@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-6.0.0.tgz#70fa487ab632e62627ecf01ad3e85c228e3ab9d3" @@ -2075,6 +2082,11 @@ require-uncached@^1.0.3: caller-path "^0.1.0" resolve-from "^1.0.0" +requireindex@~1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162" + integrity sha1-5UBLgVV+91225JxacgBIk/4D4WI= + resolve-dir@^1.0.0, resolve-dir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43"