DEV: Don't allow `Promise` unless imported from `"rsvp"`
We want to make sure we are using the correct promise implementation so let's lint out the browser version.
This commit is contained in:
parent
9799a651b6
commit
d7ae052efe
|
@ -84,6 +84,7 @@ var define, requirejs;
|
|||
},
|
||||
rsvp: {
|
||||
default: Ember.RSVP,
|
||||
EventTarget: Ember.RSVP,
|
||||
Promise: Ember.RSVP.Promise,
|
||||
hash: Ember.RSVP.hash,
|
||||
all: Ember.RSVP.all
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import ENV from "discourse-common/config/environment";
|
||||
import { EventTarget } from "rsvp";
|
||||
|
||||
// Track visible elemnts on the screen.
|
||||
const Eyeline = function Eyeline(selector) {
|
||||
|
@ -70,6 +71,6 @@ Eyeline.prototype.flushRest = function() {
|
|||
$(this.selector).each((i, elem) => this.trigger("saw", { detail: $(elem) }));
|
||||
};
|
||||
|
||||
RSVP.EventTarget.mixin(Eyeline.prototype);
|
||||
EventTarget.mixin(Eyeline.prototype);
|
||||
|
||||
export default Eyeline;
|
||||
|
|
|
@ -12,6 +12,7 @@ import { findAll } from "discourse/models/login-method";
|
|||
import { getOwner } from "discourse-common/lib/get-owner";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import Composer from "discourse/models/composer";
|
||||
import { EventTarget } from "rsvp";
|
||||
|
||||
function unlessReadOnly(method, message) {
|
||||
return function() {
|
||||
|
@ -288,5 +289,5 @@ const ApplicationRoute = DiscourseRoute.extend(OpenComposer, {
|
|||
}
|
||||
});
|
||||
|
||||
RSVP.EventTarget.mixin(ApplicationRoute);
|
||||
EventTarget.mixin(ApplicationRoute);
|
||||
export default ApplicationRoute;
|
||||
|
|
|
@ -6,6 +6,7 @@ import { later } from "@ember/runloop";
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import { ID_CONSTRAINT } from "discourse/models/topic";
|
||||
import { EventTarget } from "rsvp";
|
||||
|
||||
let isTransitioning = false,
|
||||
scheduledReplace = null,
|
||||
|
@ -313,5 +314,5 @@ const TopicRoute = DiscourseRoute.extend({
|
|||
}
|
||||
});
|
||||
|
||||
RSVP.EventTarget.mixin(TopicRoute);
|
||||
EventTarget.mixin(TopicRoute);
|
||||
export default TopicRoute;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
"chrome-launcher": "^0.12.0",
|
||||
"chrome-remote-interface": "^0.25",
|
||||
"eslint": "^4.19",
|
||||
"eslint-config-discourse": "1.0.6",
|
||||
"eslint-config-discourse": "1.0.7",
|
||||
"install-peerdeps": "^1.10.2",
|
||||
"lodash-cli": "https://github.com/lodash-archive/lodash-cli.git",
|
||||
"pretender": "^1.6",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import Post from "discourse/models/post";
|
||||
import createStore from "helpers/create-store";
|
||||
import User from "discourse/models/user";
|
||||
import { Promise } from "rsvp";
|
||||
|
||||
QUnit.module("model:post-stream");
|
||||
|
||||
|
@ -208,7 +209,7 @@ QUnit.test("removePosts", assert => {
|
|||
QUnit.test("cancelFilter", assert => {
|
||||
const postStream = buildStream(1235);
|
||||
|
||||
sandbox.stub(postStream, "refresh").returns(new Ember.RSVP.resolve());
|
||||
sandbox.stub(postStream, "refresh").returns(Promise.resolve());
|
||||
|
||||
postStream.set("summary", true);
|
||||
postStream.cancelFilter();
|
||||
|
@ -246,7 +247,7 @@ QUnit.test("findPostIdForPostNumber", assert => {
|
|||
|
||||
QUnit.test("toggleParticipant", assert => {
|
||||
const postStream = buildStream(1236);
|
||||
sandbox.stub(postStream, "refresh").returns(new Ember.RSVP.resolve());
|
||||
sandbox.stub(postStream, "refresh").returns(Promise.resolve());
|
||||
|
||||
assert.equal(
|
||||
postStream.get("userFilters.length"),
|
||||
|
@ -269,7 +270,7 @@ QUnit.test("toggleParticipant", assert => {
|
|||
|
||||
QUnit.test("streamFilters", assert => {
|
||||
const postStream = buildStream(1237);
|
||||
sandbox.stub(postStream, "refresh").returns(new Ember.RSVP.resolve());
|
||||
sandbox.stub(postStream, "refresh").returns(Promise.resolve());
|
||||
|
||||
assert.deepEqual(
|
||||
postStream.get("streamFilters"),
|
||||
|
|
|
@ -886,10 +886,10 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
|||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||
|
||||
eslint-config-discourse@1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-1.0.6.tgz#cfd23c7d7b92ca9c416cbc30272be197a823cbe3"
|
||||
integrity sha512-JOTncJzusPnYC97rXRQLewk5CxToL31spw7dzDbVk9XkZpnmRenbWmRawW2OEkbbXow3AdcKj/ousmo9PttwbA==
|
||||
eslint-config-discourse@1.0.7:
|
||||
version "1.0.7"
|
||||
resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-1.0.7.tgz#6e4a67fee63b7eb0f97c14fbf67d6fc5f84896bb"
|
||||
integrity sha512-KPP/sfGWAfn7Wnx/lP9x6eMCmC2ag42NK5Dgj5EsOypQGe1Ct4KA2z0fEGuIqGxDoh5xEZB2Nf6qD/lv0gRg7w==
|
||||
|
||||
eslint-scope@3.7.1:
|
||||
version "3.7.1"
|
||||
|
|
Loading…
Reference in New Issue