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

View File

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