A platform for community discussion. Free, open, simple.
DEV: Update JS class sorting to match new lint rule
David Taylor6cac35ca295c
diff --git a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.jsindex 29d95f2c0ff..55077f17ea2 100644--- a/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js+++ b/app/assets/javascripts/admin/addon/controllers/admin-badges/show.js@@ -17,8 +17,8 @@ const ICON = "icon";export default class AdminBadgesShowController extends Controller.extend(bufferedProperty("model")) {- @controller adminBadges;@service router;+ @controller adminBadges;@tracked saving = false;@tracked savingStatus = "";diff --git a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.jsindex f67009bd701..3bcbd787a61 100644--- a/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js+++ b/app/assets/javascripts/discourse/app/components/sidebar/more-section-links.js@@ -7,9 +7,10 @@ import { bind } from "discourse-common/utils/decorators";import Component from "@glimmer/component";export default class SidebarMoreSectionLinks extends Component {+ @service router;+@tracked shouldDisplaySectionLinks = false;@tracked activeSectionLink;- @service router;#allLinks = [...this.args.sectionLinks, ...this.args.secondarySectionLinks];diff --git a/app/assets/javascripts/discourse/app/lib/sticky-avatars.js b/app/assets/javascripts/discourse/app/lib/sticky-avatars.jsindex 035035498c9..d69f23b3e06 100644--- a/app/assets/javascripts/discourse/app/lib/sticky-avatars.js+++ b/app/assets/javascripts/discourse/app/lib/sticky-avatars.js@@ -5,16 +5,16 @@ import { headerOffset } from "discourse/lib/offset-calculator";import { schedule } from "@ember/runloop";export default class StickyAvatars {+ static init(container) {+ return new this(container).init();+ }+stickyClass = "sticky-avatar";topicPostSelector = "#topic .post-stream .topic-post";intersectionObserver = null;direction = "⬇️";prevOffset = -1;- static init(container) {- return new this(container).init();- }-constructor(container) {this.container = container;}diff --git a/app/assets/javascripts/discourse/app/lib/to-markdown.js b/app/assets/javascripts/discourse/app/lib/to-markdown.jsindex e6309b9d3e3..ccf6e30920c 100644--- a/app/assets/javascripts/discourse/app/lib/to-markdown.js+++ b/app/assets/javascripts/discourse/app/lib/to-markdown.js@@ -82,50 +82,6 @@ export class Tag {return klass;}- constructor(prefix = "", suffix = "", inline = false) {- this.prefix = prefix;- this.suffix = suffix;- this.inline = inline;- }-- decorate(text) {- for (const callback of tagDecorateCallbacks) {- const result = callback.call(this, text);-- if (typeof result !== "undefined") {- text = result;- }- }-- if (this.prefix || this.suffix) {- text = [this.prefix, text, this.suffix].join("");- }-- if (this.inline) {- const { prev, next } = this.element;-- if (prev && prev.name !== "#text") {- text = " " + text;- }-- if (next && next.name !== "#text") {- text = text + " ";- }- }-- return text;- }-- toMarkdown() {- const text = this.element.innerMarkdown();-- if (text?.trim()) {- return this.decorate(text);- }-- return text;- }-static blocks() {return ["address",@@ -643,6 +599,50 @@ export class Tag {}};}++ constructor(prefix = "", suffix = "", inline = false) {+ this.prefix = prefix;+ this.suffix = suffix;+ this.inline = inline;+ }++ decorate(text) {+ for (const callback of tagDecorateCallbacks) {+ const result = callback.call(this, text);++ if (typeof result !== "undefined") {+ text = result;+ }+ }++ if (this.prefix || this.suffix) {+ text = [this.prefix, text, this.suffix].join("");+ }++ if (this.inline) {+ const { prev, next } = this.element;++ if (prev && prev.name !== "#text") {+ text = " " + text;+ }++ if (next && next.name !== "#text") {+ text = text + " ";+ }+ }++ return text;+ }++ toMarkdown() {+ const text = this.element.innerMarkdown();++ if (text?.trim()) {+ return this.decorate(text);+ }++ return text;+ }}let tagsMap;@@ -684,6 +684,34 @@ function tagByName(name) {}class Element {+ static toMarkdown(element, parent, prev, next, metadata) {+ return new Element(element, parent, prev, next, metadata).toMarkdown();+ }++ static parseChildren(parent) {+ return Element.parse(parent.children, parent);+ }++ static parse(elements, parent = null) {+ if (elements) {+ let result = [];+ let metadata = {};++ for (let i = 0; i < elements.length; i++) {+ const prev = i === 0 ? null : elements[i - 1];+ const next = i === elements.length ? null : elements[i + 1];++ result.push(+ Element.toMarkdown(elements[i], parent, prev, next, metadata)+ );+ }++ return result.join("");+ }++ return "";+ }+constructor(element, parent, previous, next, metadata) {this.name = element.name;this.data = element.data;@@ -762,34 +790,6 @@ class Element {filterParentNames(names) {return this.parentNames.filter((p) => names.includes(p));}-- static toMarkdown(element, parent, prev, next, metadata) {- return new Element(element, parent, prev, next, metadata).toMarkdown();- }-- static parseChildren(parent) {- return Element.parse(parent.children, parent);- }-- static parse(elements, parent = null) {- if (elements) {- let result = [];- let metadata = {};-- for (let i = 0; i < elements.length; i++) {- const prev = i === 0 ? null : elements[i - 1];- const next = i === elements.length ? null : elements[i + 1];-- result.push(- Element.toMarkdown(elements[i], parent, prev, next, metadata)- );- }-- return result.join("");- }-- return "";- }}function trimUnwanted(html) {diff --git a/app/assets/javascripts/discourse/app/routes/groups-index.js b/app/assets/javascripts/discourse/app/routes/groups-index.jsindex a054f348c7f..efacd7d613e 100644--- a/app/assets/javascripts/discourse/app/routes/groups-index.js+++ b/app/assets/javascripts/discourse/app/routes/groups-index.js@@ -2,10 +2,6 @@ import DiscourseRoute from "discourse/routes/discourse";import I18n from "I18n";export default class GroupsIndexRoute extends DiscourseRoute {- titleToken() {- return I18n.t("groups.index.title");- }-queryParams = {order: { refreshModel: true, replace: true },asc: { refreshModel: true, replace: true },@@ -14,6 +10,10 @@ export default class GroupsIndexRoute extends DiscourseRoute {username: { refreshModel: true },};+ titleToken() {+ return I18n.t("groups.index.title");+ }+model(params) {return params;}diff --git a/app/assets/javascripts/discourse/testem.js b/app/assets/javascripts/discourse/testem.jsindex 67261a0fb6d..8da35eb44e9 100644--- a/app/assets/javascripts/discourse/testem.js+++ b/app/assets/javascripts/discourse/testem.js@@ -2,12 +2,12 @@ const TapReporter = require("testem/lib/reporters/tap_reporter");const { shouldLoadPluginTestJs } = require("discourse/lib/plugin-js");class Reporter {+ failReports = [];+constructor() {this._tapReporter = new TapReporter(...arguments);}- failReports = [];-reportMetadata(tag, metadata) {if (tag === "summary-line") {process.stdout.write(`\n${metadata.message}\n`);diff --git a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.jsindex bdc5581a529..edbe15d97a4 100644--- a/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js+++ b/app/assets/javascripts/discourse/tests/integration/components/widgets/render-glimmer-test.js@@ -42,6 +42,7 @@ class DemoWidget extends Widget {class DemoComponent extends ClassicComponent {static eventLog = [];classNames = ["demo-component"];+ layout = hbs`<DButton class="component-action-button" @label="component_action" @action={{@action}} />`;init() {DemoComponent.eventLog.push("init");@@ -63,8 +64,6 @@ class DemoComponent extends ClassicComponent {willDestroy() {DemoComponent.eventLog.push("willDestroy");}-- layout = hbs`<DButton class="component-action-button" @label="component_action" @action={{@action}} />`;}module("Integration | Component | Widget | render-glimmer", function (hooks) {diff --git a/plugins/discourse-local-dates/assets/javascripts/lib/date-with-zone-helper.js b/plugins/discourse-local-dates/assets/javascripts/lib/date-with-zone-helper.jsindex fa67be60685..aa4c893675f 100644--- a/plugins/discourse-local-dates/assets/javascripts/lib/date-with-zone-helper.js+++ b/plugins/discourse-local-dates/assets/javascripts/lib/date-with-zone-helper.js@@ -14,6 +14,19 @@ import { getProperties } from "@ember/object";duration between two dates, eg for duration: "1.weeks", "2.months"...*/export default class DateWithZoneHelper {+ static fromDatetime(datetime, timezone, localTimezone) {+ return new DateWithZoneHelper({+ year: datetime.year(),+ month: datetime.month(),+ day: datetime.date(),+ hour: datetime.hour(),+ minute: datetime.minute(),+ second: datetime.second(),+ timezone,+ localTimezone,+ });+ }+constructor(params = {}) {this.timezone = params.timezone || "UTC";this.localTimezone = params.localTimezone || moment.tz.guess();@@ -77,19 +90,6 @@ export default class DateWithZoneHelper {return this.datetime.tz(this.localTimezone).toISOString(true);}- static fromDatetime(datetime, timezone, localTimezone) {- return new DateWithZoneHelper({- year: datetime.year(),- month: datetime.month(),- day: datetime.date(),- hour: datetime.hour(),- minute: datetime.minute(),- second: datetime.second(),- timezone,- localTimezone,- });- }-_fromDatetime(datetime, timezone, localTimezone) {return DateWithZoneHelper.fromDatetime(datetime, timezone, localTimezone);}