Skip to content

Commit

Permalink
DEV: update eslint and prettier config from upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
renato committed Oct 28, 2023
1 parent 7e0c349 commit 677769a
Show file tree
Hide file tree
Showing 54 changed files with 787 additions and 650 deletions.
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint");
1 change: 0 additions & 1 deletion .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
5 changes: 1 addition & 4 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};
module.exports = require("@discourse/lint-configs/template-lint");
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DiscoursePostEventAdapter from "./discourse-post-event-adapter";
import { underscore } from "@ember/string";
import DiscoursePostEventAdapter from "./discourse-post-event-adapter";

export default DiscoursePostEventAdapter.extend({
pathFor(store, type, findArgs) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import DiscoursePostEventAdapter from "./discourse-post-event-adapter";
import { underscore } from "@ember/string";
import { Result } from "discourse/adapters/rest";
import { ajax } from "discourse/lib/ajax";
import DiscoursePostEventAdapter from "./discourse-post-event-adapter";

export default DiscoursePostEventAdapter.extend({
// TODO: destroy/update/create should be improved in core to allow for nested models
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/components/csv-uploader.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Component from "@ember/component";
import I18n from "I18n";
import UppyUploadMixin from "discourse/mixins/uppy-upload";
import { inject as service } from "@ember/service";
import UppyUploadMixin from "discourse/mixins/uppy-upload";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";

export default Component.extend(UppyUploadMixin, {
type: "csv",
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/components/region-input.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { computed } from "@ember/object";
import { HOLIDAY_REGIONS } from "../lib/regions";
import I18n from "I18n";
import ComboBoxComponent from "select-kit/components/combo-box";
import { HOLIDAY_REGIONS } from "../lib/regions";

export default ComboBoxComponent.extend({
pluginApiIdentifiers: ["timezone-input"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Promise } from "rsvp";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";
import { formatEventName } from "../helpers/format-event-name";
import loadScript from "discourse/lib/load-script";
import Component from "@ember/component";
import { schedule } from "@ember/runloop";
import { Promise } from "rsvp";
import loadScript from "discourse/lib/load-script";
import getURL from "discourse-common/lib/get-url";
import { formatEventName } from "../helpers/format-event-name";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";

export default Component.extend({
tagName: "",
Expand Down
10 changes: 5 additions & 5 deletions assets/javascripts/discourse/components/upcoming-events-list.gjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import DButton from "discourse/components/d-button";
import Component from "@glimmer/component";
import { ajax } from "discourse/lib/ajax";
import I18n from "discourse-i18n";
import { tracked } from "@glimmer/tracking";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";
import { inject as service } from "@ember/service";
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
import DButton from "discourse/components/d-button";
import { ajax } from "discourse/lib/ajax";
import I18n from "discourse-i18n";
import or from "truth-helpers/helpers/or";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";

export const DEFAULT_MONTH_FORMAT = "MMMM YYYY";
export const DEFAULT_DATE_FORMAT = "dddd, MMM D";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import I18n from "I18n";
import { cookAsync } from "discourse/lib/text";
import Group from "discourse/models/group";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Controller from "@ember/controller";
import { action, computed, set } from "@ember/object";
import { equal, gte } from "@ember/object/computed";
import { extractError } from "discourse/lib/ajax-error";
import { inject as service } from "@ember/service";
import { extractError } from "discourse/lib/ajax-error";
import { cookAsync } from "discourse/lib/text";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Group from "discourse/models/group";
import I18n from "I18n";
import { buildParams, replaceRaw } from "../lib/raw-event-helper";

const DEFAULT_REMINDER = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Controller from "@ember/controller";
import EmberObject, { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { isPresent } from "@ember/utils";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import EmberObject, { action } from "@ember/object";
import { observes } from "discourse-common/utils/decorators";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Controller from "@ember/controller";
import Group from "discourse/models/group";
import { observes } from "discourse-common/utils/decorators";
import I18n from "I18n";
import { inject as service } from "@ember/service";

export default Controller.extend(ModalFunctionality, {
dialog: service(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { extractError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { extractError } from "discourse/lib/ajax-error";
import ModalFunctionality from "discourse/mixins/modal-functionality";

export default Controller.extend(ModalFunctionality, {
invitedNames: null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ModalFunctionality from "discourse/mixins/modal-functionality";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import discourseDebounce from "discourse-common/lib/debounce";

export default Controller.extend(ModalFunctionality, {
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/helpers/format-future-date.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import guessDateFormat from "../lib/guess-best-date-format";
import { htmlHelper } from "discourse-common/lib/helpers";
import guessDateFormat from "../lib/guess-best-date-format";

export default htmlHelper((date) => {
date = moment.utc(date).tz(moment.tz.guess());
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/helpers/render-invitee.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { htmlSafe } from "@ember/template";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { userPath } from "discourse/lib/url";
import { htmlHelper } from "discourse-common/lib/helpers";
import { htmlSafe } from "@ember/template";
import { formatUsername } from "discourse/lib/utilities";
import { htmlHelper } from "discourse-common/lib/helpers";

export default htmlHelper((invitee) => {
const path = userPath(invitee.user.username);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import eventRelativeDate from "../lib/event-relative-date";
import eventLocalDate from "../lib/event-local-date";
import eventRelativeDate from "../lib/event-relative-date";

function initializeDecorateTopicTitle(api) {
api.decorateTopicTitle((topic, node, topicTitleType) => {
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/initializers/disable-sort.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import discourseComputed from "discourse-common/utils/decorators";
import { withPluginApi } from "discourse/lib/plugin-api";
import discourseComputed from "discourse-common/utils/decorators";

export default {
name: "disable-sort",
Expand Down
18 changes: 9 additions & 9 deletions assets/javascripts/discourse/initializers/discourse-calendar.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { Promise } from "rsvp";
import { isPresent } from "@ember/utils";
import DiscourseURL from "discourse/lib/url";
import { cookAsync } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
import { createPopper } from "@popperjs/core";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import loadScript from "discourse/lib/load-script";
import { withPluginApi } from "discourse/lib/plugin-api";
import { ajax } from "discourse/lib/ajax";
import { cookAsync } from "discourse/lib/text";
import DiscourseURL from "discourse/lib/url";
import { escapeExpression } from "discourse/lib/utilities";
import Category from "discourse/models/category";
import getURL from "discourse-common/lib/get-url";
import { iconHTML } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { formatEventName } from "../helpers/format-event-name";
import { colorToHex, contrastColor, stringToColor } from "../lib/colors";
import { createPopper } from "@popperjs/core";
import { isNotFullDayEvent } from "../lib/guess-best-date-format";
import { formatEventName } from "../helpers/format-event-name";
import getURL from "discourse-common/lib/get-url";
import { iconHTML } from "discourse-common/lib/icon-library";

function loadFullCalendar() {
return loadScript(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import WidgetGlue from "discourse/widgets/glue";
import { getRegister } from "discourse-common/lib/get-owner";
import { withPluginApi } from "discourse/lib/plugin-api";

export default {
name: "discourse-group-timezones",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import I18n from "I18n";
import guessDateFormat from "../lib/guess-best-date-format";
import { schedule } from "@ember/runloop";
import { applyLocalDates } from "discourse/lib/local-dates";
import { withPluginApi } from "discourse/lib/plugin-api";
import { cookAsync } from "discourse/lib/text";
import WidgetGlue from "discourse/widgets/glue";
import { getRegister } from "discourse-common/lib/get-owner";
import { withPluginApi } from "discourse/lib/plugin-api";
import { schedule } from "@ember/runloop";
import { applyLocalDates } from "discourse/lib/local-dates";
import I18n from "I18n";
import guessDateFormat from "../lib/guess-best-date-format";

function _decorateEvent(api, cooked, post) {
_attachWidget(api, cooked, post);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isTesting } from "discourse-common/config/environment";
import { cancel } from "@ember/runloop";
import eventRelativeDate from "../lib/event-relative-date";
import { isTesting } from "discourse-common/config/environment";
import discourseLater from "discourse-common/lib/later";
import eventRelativeDate from "../lib/event-relative-date";

function computeRelativeEventDates() {
document
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import RestModel from "discourse/models/rest";
import { ajax } from "discourse/lib/ajax";
import RestModel from "discourse/models/rest";

const ATTRIBUTES = {
id: null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DiscourseURL from "discourse/lib/url";
import Route from "@ember/routing/route";
import { on } from "@ember/object/evented";
import Route from "@ember/routing/route";
import DiscourseURL from "discourse/lib/url";

export default Route.extend({
enforcePostEventEnabled: on("activate", function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import I18n from "I18n";
import { createWidget } from "discourse/widgets/widget";
import { throttle } from "@ember/runloop";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";

export default createWidget("discourse-group-timezones-filter", {
tagName: "input.group-timezones-filter",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import I18n from "I18n";
import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";

export default createWidget("discourse-group-timezones-header", {
tagName: "div.group-timezones-header",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { h } from "virtual-dom";
import { formatUsername } from "discourse/lib/utilities";
import { avatarImg } from "discourse/widgets/post";
import { createWidget } from "discourse/widgets/widget";
import { formatUsername } from "discourse/lib/utilities";

export default createWidget("discourse-group-timezones-member", {
tagName: "li.group-timezones-member",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createWidget } from "discourse/widgets/widget";
import { throttle } from "@ember/runloop";
import { createWidget } from "discourse/widgets/widget";

export default createWidget("discourse-group-timezones-slider", {
tagName: "input.group-timezones-slider",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import I18n from "I18n";
import RawHtml from "discourse/widgets/raw-html";
import { iconNode } from "discourse-common/lib/icon-library";
import { h } from "virtual-dom";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";

export default createWidget("discourse-post-event-dates", {
tagName: "section.event-dates",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { h } from "virtual-dom";
import { formatUsername } from "discourse/lib/utilities";
import { avatarImg } from "discourse/widgets/post";
import { createWidget } from "discourse/widgets/widget";
import { formatUsername } from "discourse/lib/utilities";

export default createWidget("discourse-post-event-creator", {
tagName: "span.event-creator",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import I18n from "I18n";
import { isPresent } from "@ember/utils";
import { h } from "virtual-dom";
import { formatUsername } from "discourse/lib/utilities";
import { avatarImg } from "discourse/widgets/post";
import { createWidget } from "discourse/widgets/widget";
import { formatUsername } from "discourse/lib/utilities";
import I18n from "I18n";

export default createWidget("discourse-post-event-invitee", {
tagName: "li.event-invitee",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createWidget } from "discourse/widgets/widget";
import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";

export default createWidget("discourse-post-event-status", {
tagName: "div.event-status",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { iconNode } from "discourse-common/lib/icon-library";
import { h } from "virtual-dom";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";

function prefixProtocol(url) {
return url.indexOf("://") === -1 && url.indexOf("mailto:") === -1
Expand Down
14 changes: 7 additions & 7 deletions assets/javascripts/discourse/widgets/discourse-post-event.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import I18n from "I18n";
import { cookAsync, emojiUnescape } from "discourse/lib/text";
import { exportEntity } from "discourse/lib/export-csv";
import cleanTitle from "../lib/clean-title";
import { dasherize } from "@ember/string";
import EmberObject from "@ember/object";
import { dasherize } from "@ember/string";
import { routeAction } from "discourse/helpers/route-action";
import { exportEntity } from "discourse/lib/export-csv";
import showModal from "discourse/lib/show-modal";
import { cookAsync, emojiUnescape } from "discourse/lib/text";
import { escapeExpression } from "discourse/lib/utilities";
import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";
import { routeAction } from "discourse/helpers/route-action";
import I18n from "I18n";
import cleanTitle from "../lib/clean-title";
import { buildParams, replaceRaw } from "../lib/raw-event-helper";
import { escapeExpression } from "discourse/lib/utilities";

export default createWidget("discourse-post-event", {
tagName: "div.discourse-post-event-widget",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import I18n from "I18n";
import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { escapeExpression, formatUsername } from "discourse/lib/utilities";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { createWidgetFrom } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";

// TODO(osama): delete the strings marked with TODO in translation files when
// this file is removed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import I18n from "I18n";
import { createWidgetFrom } from "discourse/widgets/widget";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { escapeExpression, formatUsername } from "discourse/lib/utilities";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { createWidgetFrom } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";

// TODO: delete the strings marked with TODO in translation files when
// this file is removed
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/widgets/more-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import I18n from "I18n";
import { createWidget } from "discourse/widgets/widget";
import hbs from "discourse/widgets/hbs-compiler";
import { createWidget } from "discourse/widgets/widget";
import I18n from "I18n";

export default createWidget("more-dropdown", {
tagName: "div.more-dropdown",
Expand Down
Loading

0 comments on commit 677769a

Please sign in to comment.