DEV: Enable ember/no-classic-classes eslint rule (#28610)

This commit is contained in:
David Taylor 2024-11-06 13:31:01 +00:00 committed by GitHub
parent 1ba6f6f1ae
commit 0237ef80bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View File

@ -1 +1,5 @@
module.exports = require("@discourse/lint-configs/eslint"); const config = require("@discourse/lint-configs/eslint");
config.rules["ember/no-classic-classes"] = "error";
module.exports = config;

View File

@ -31,6 +31,7 @@ module("Unit | Utility | computed", function (hooks) {
test("setting", function (assert) { test("setting", function (assert) {
const siteSettings = getOwner(this).lookup("service:site-settings"); const siteSettings = getOwner(this).lookup("service:site-settings");
// eslint-disable-next-line ember/no-classic-classes
let t = EmberObject.extend({ let t = EmberObject.extend({
siteSettings, siteSettings,
vehicle: setting("vehicle"), vehicle: setting("vehicle"),
@ -50,6 +51,7 @@ module("Unit | Utility | computed", function (hooks) {
}); });
test("propertyEqual", function (assert) { test("propertyEqual", function (assert) {
// eslint-disable-next-line ember/no-classic-classes
let t = EmberObject.extend({ let t = EmberObject.extend({
same: propertyEqual("cookies", "biscuits"), same: propertyEqual("cookies", "biscuits"),
}).create({ }).create({
@ -63,6 +65,7 @@ module("Unit | Utility | computed", function (hooks) {
}); });
test("propertyNotEqual", function (assert) { test("propertyNotEqual", function (assert) {
// eslint-disable-next-line ember/no-classic-classes
let t = EmberObject.extend({ let t = EmberObject.extend({
diff: propertyNotEqual("cookies", "biscuits"), diff: propertyNotEqual("cookies", "biscuits"),
}).create({ }).create({
@ -76,6 +79,7 @@ module("Unit | Utility | computed", function (hooks) {
}); });
test("fmt", function (assert) { test("fmt", function (assert) {
// eslint-disable-next-line ember/no-classic-classes
let t = EmberObject.extend({ let t = EmberObject.extend({
exclaimyUsername: fmt("username", "!!! %@ !!!"), exclaimyUsername: fmt("username", "!!! %@ !!!"),
multiple: fmt("username", "mood", "%@ is %@"), multiple: fmt("username", "mood", "%@ is %@"),
@ -110,6 +114,7 @@ module("Unit | Utility | computed", function (hooks) {
}); });
test("i18n", function (assert) { test("i18n", function (assert) {
// eslint-disable-next-line ember/no-classic-classes
let t = EmberObject.extend({ let t = EmberObject.extend({
exclaimyUsername: i18n("username", "!!! %@ !!!"), exclaimyUsername: i18n("username", "!!! %@ !!!"),
multiple: i18n("username", "mood", "%@ is %@"), multiple: i18n("username", "mood", "%@ is %@"),
@ -146,6 +151,7 @@ module("Unit | Utility | computed", function (hooks) {
test("url", function (assert) { test("url", function (assert) {
let t, testClass; let t, testClass;
// eslint-disable-next-line ember/no-classic-classes
testClass = EmberObject.extend({ testClass = EmberObject.extend({
userUrl: url("username", "/u/%@"), userUrl: url("username", "/u/%@"),
}); });
@ -168,6 +174,7 @@ module("Unit | Utility | computed", function (hooks) {
test("htmlSafe", function (assert) { test("htmlSafe", function (assert) {
const cookies = "<p>cookies and <b>biscuits</b></p>"; const cookies = "<p>cookies and <b>biscuits</b></p>";
// eslint-disable-next-line ember/no-classic-classes
const t = EmberObject.extend({ const t = EmberObject.extend({
desc: htmlSafe("cookies"), desc: htmlSafe("cookies"),
}).create({ cookies }); }).create({ cookies });

View File

@ -1,5 +1,3 @@
// eslint-disable ember/no-classic-classes
import Component from "@ember/component"; import Component from "@ember/component";
import EmberObject from "@ember/object"; import EmberObject from "@ember/object";
import { clearRender, render, settled } from "@ember/test-helpers"; import { clearRender, render, settled } from "@ember/test-helpers";
@ -16,6 +14,7 @@ import discourseComputed, {
on, on,
} from "discourse-common/utils/decorators"; } from "discourse-common/utils/decorators";
// eslint-disable-next-line ember/no-classic-classes
const fooComponent = Component.extend({ const fooComponent = Component.extend({
classNames: ["foo-component"], classNames: ["foo-component"],
@ -39,6 +38,7 @@ const fooComponent = Component.extend({
}, },
}); });
// eslint-disable-next-line ember/no-classic-classes
const EmberObjectComponent = Component.extend({ const EmberObjectComponent = Component.extend({
name: "", name: "",
layout: hbs`<span class="ember-object-component">{{this.text}}</span>`, layout: hbs`<span class="ember-object-component">{{this.text}}</span>`,
@ -59,6 +59,7 @@ class NativeComponent extends Component {
} }
} }
// eslint-disable-next-line ember/no-classic-classes
const TestStub = EmberObject.extend({ const TestStub = EmberObject.extend({
counter: 0, counter: 0,
otherCounter: 0, otherCounter: 0,
@ -228,6 +229,7 @@ module("Unit | Utils | decorators", function (hooks) {
}; };
}); });
// eslint-disable-next-line ember/no-classic-classes
const ExtendWithObserver = EmberObject.extend({ const ExtendWithObserver = EmberObject.extend({
counter: 0, counter: 0,
@observes("value") @observes("value")
@ -267,6 +269,7 @@ module("Unit | Utils | decorators", function (hooks) {
}; };
}); });
// eslint-disable-next-line ember/no-classic-classes
const ExtendWithOn = EmberObject.extend({ const ExtendWithOn = EmberObject.extend({
counter: 0, counter: 0,
@on("init") @on("init")