mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
DEV: Ember linting - disallow Ember.* variable usage (#8782)
This commit is contained in:

committed by
GitHub

parent
88779d849f
commit
499b57a9ed
@ -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" }
|
||||
|
@ -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);
|
||||
},
|
||||
|
@ -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];
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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");
|
||||
|
@ -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");
|
||||
});
|
||||
};
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user