diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js index d614209b61d..ac0068ff867 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js @@ -250,6 +250,7 @@ module("Integration | Component | d-button", function (hooks) { this.set("foo", null); this.set("legacyActionTriggered", () => this.set("foo", "bar")); + // eslint-disable-next-line ember/no-classic-classes this.classicComponent = ClassicComponent.extend({ actions: { myLegacyAction() { @@ -277,8 +278,9 @@ module("Integration | Component | d-button", function (hooks) { this.set("foo", null); this.set("legacyActionTriggered", () => this.set("foo", "bar")); - this.simpleWrapperComponent = ClassicComponent.extend(); + this.simpleWrapperComponent = class extends ClassicComponent {}; + // eslint-disable-next-line ember/no-classic-classes this.classicComponent = ClassicComponent.extend({ actions: { myLegacyAction() { diff --git a/app/assets/javascripts/discourse/tests/unit/lib/ember-action-modifer-test.js b/app/assets/javascripts/discourse/tests/unit/lib/ember-action-modifer-test.js index 824604aaca9..31baee23ef5 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/ember-action-modifer-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/ember-action-modifer-test.js @@ -76,15 +76,16 @@ module("Unit | Lib | ember-action-modifier", function (hooks) { }); module("used on a classic component", function (innerHooks) { - const ExampleClassicButton = ClassicComponent.extend({ - tagName: "", - onDoSomething: null, + class ExampleClassicButton extends ClassicComponent { + tagName = ""; + onDoSomething = null; doSomething() { this.onDoSomething?.("doSomething"); - }, - }); + } + } + // eslint-disable-next-line ember/no-classic-classes const ExampleClassicButtonWithActions = ClassicComponent.extend({ tagName: "", onDoSomething: null, diff --git a/app/assets/javascripts/discourse/tests/unit/lib/plugin-api-test.js b/app/assets/javascripts/discourse/tests/unit/lib/plugin-api-test.js index f1763ac0e24..7b708d2e321 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/plugin-api-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/plugin-api-test.js @@ -1,4 +1,4 @@ -import EmberObject from "@ember/object"; +import EmberObject, { computed } from "@ember/object"; import { getOwner } from "@ember/owner"; import { setupTest } from "ember-qunit"; import { module, test } from "qunit"; @@ -10,11 +10,11 @@ module("Unit | Utility | plugin-api", function (hooks) { setupTest(hooks); test("modifyClass works with classic Ember objects", function (assert) { + // eslint-disable-next-line ember/no-classic-classes const TestThingy = EmberObject.extend({ - @discourseComputed - prop() { + prop: computed(function () { return "hello"; - }, + }), }); getOwner(this).register("test-thingy:main", TestThingy); @@ -23,10 +23,9 @@ module("Unit | Utility | plugin-api", function (hooks) { api.modifyClass("test-thingy:main", { pluginId: "plugin-api-test", - @discourseComputed - prop() { + prop: computed(function () { return `${this._super(...arguments)} there`; - }, + }), }); }); @@ -90,11 +89,11 @@ module("Unit | Utility | plugin-api", function (hooks) { }); test("modifyClass works with getters", function (assert) { - let Base = EmberObject.extend({ + let Base = class extends EmberObject { get foo() { throw new Error("base getter called"); - }, - }); + } + }; getOwner(this).register("test-class:main", Base, { instantiate: false, diff --git a/app/assets/javascripts/discourse/tests/unit/mixins/singleton-test.js b/app/assets/javascripts/discourse/tests/unit/mixins/singleton-test.js index b1ea6606df7..b3a805685f8 100644 --- a/app/assets/javascripts/discourse/tests/unit/mixins/singleton-test.js +++ b/app/assets/javascripts/discourse/tests/unit/mixins/singleton-test.js @@ -7,7 +7,7 @@ module("Unit | Mixin | singleton", function (hooks) { setupTest(hooks); test("current", function (assert) { - let DummyModel = EmberObject.extend({}); + let DummyModel = class extends EmberObject {}; DummyModel.reopenClass(Singleton); let current = DummyModel.current(); @@ -25,7 +25,7 @@ module("Unit | Mixin | singleton", function (hooks) { }); test("currentProp reading", function (assert) { - let DummyModel = EmberObject.extend({}); + let DummyModel = class extends EmberObject {}; DummyModel.reopenClass(Singleton); let current = DummyModel.current(); @@ -42,7 +42,7 @@ module("Unit | Mixin | singleton", function (hooks) { }); test("currentProp writing", function (assert) { - let DummyModel = EmberObject.extend({}); + let DummyModel = class extends EmberObject {}; DummyModel.reopenClass(Singleton); assert.blank( @@ -73,7 +73,7 @@ module("Unit | Mixin | singleton", function (hooks) { }); test("createCurrent", function (assert) { - let Shoe = EmberObject.extend({}); + let Shoe = class extends EmberObject {}; Shoe.reopenClass(Singleton, { createCurrent: function () { return Shoe.create({ toes: 5 }); @@ -88,7 +88,7 @@ module("Unit | Mixin | singleton", function (hooks) { }); test("createCurrent that returns null", function (assert) { - let Missing = EmberObject.extend({}); + let Missing = class extends EmberObject {}; Missing.reopenClass(Singleton, { createCurrent: function () { return null; diff --git a/app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js b/app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js index eb8628ae01e..8d9d6c19565 100644 --- a/app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js +++ b/app/assets/javascripts/discourse/tests/unit/utils/decorators-test.js @@ -1,3 +1,5 @@ +// eslint-disable ember/no-classic-classes + import Component from "@ember/component"; import EmberObject from "@ember/object"; import { clearRender, render, settled } from "@ember/test-helpers"; diff --git a/app/assets/javascripts/discourse/tests/unit/utils/optional-service-test.js b/app/assets/javascripts/discourse/tests/unit/utils/optional-service-test.js index 4008c9e3ff2..981a214df14 100644 --- a/app/assets/javascripts/discourse/tests/unit/utils/optional-service-test.js +++ b/app/assets/javascripts/discourse/tests/unit/utils/optional-service-test.js @@ -14,6 +14,7 @@ class BarService extends Service { name = "bar"; } +// eslint-disable-next-line ember/no-classic-classes const EmberObjectComponent = Component.extend({ name: "", layout: hbs`{{this.foo.name}} {{this.baz.name}}`,