From a52b83333efa85f55abd76ad47a6ed8bc4a4b01d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 2 Dec 2024 16:31:21 +0000 Subject: [PATCH] DEV: Correctly lint bundled plugins admin directory (#29999) --- package.json | 4 ++-- .../javascripts/admin/components/automation-field.gjs | 2 +- .../admin/components/fields/da-choices-field.gjs | 2 +- .../admin/components/fields/da-key-value-field.gjs | 6 ++---- .../javascripts/admin/components/fields/da-period-field.gjs | 2 +- .../javascripts/admin/components/fields/da-pms-field.gjs | 2 +- .../javascripts/admin/components/fields/da-user-field.gjs | 2 +- .../controllers/admin-plugins-discourse-automation-edit.js | 2 +- .../controllers/admin-plugins-discourse-automation-index.js | 2 +- .../admin/components/admin-chat-incoming-webhooks-list.gjs | 2 +- .../admin/components/chat-admin-plugin-actions.gjs | 6 ++---- .../admin/components/chat-incoming-webhook-edit-form.gjs | 2 +- ...n-plugins-show-discourse-chat-incoming-webhooks-index.js | 2 +- 13 files changed, 16 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 42840a00cad..014629e3694 100644 --- a/package.json +++ b/package.json @@ -47,8 +47,8 @@ "lint:js:fix": "eslint --fix ./app/assets/javascripts $(script/list_bundled_plugins) --no-error-on-unmatched-pattern", "lint:hbs": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' $(script/list_bundled_plugins '/assets/javascripts/**/*.{gjs,hbs}') --no-error-on-unmatched-pattern", "lint:hbs:fix": "ember-template-lint 'app/assets/javascripts/**/*.{gjs,hbs}' $(script/list_bundled_plugins '/assets/javascripts/**/*.{gjs,hbs}') --no-error-on-unmatched-pattern --fix", - "lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/assets/javascripts/**/*.{js,gjs,hbs}')", - "lint:prettier:fix": "pnpm prettier -w 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/assets/javascripts/**/*.{js,gjs,hbs}')", + "lint:prettier": "pnpm pprettier --list-different 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets}/javascripts/**/*.{js,gjs,hbs}')", + "lint:prettier:fix": "pnpm prettier -w 'app/assets/stylesheets/**/*.scss' 'app/assets/javascripts/**/*.{js,gjs,hbs}' $(script/list_bundled_plugins '/assets/stylesheets/**/*.scss') $(script/list_bundled_plugins '/{assets,admin/assets}/javascripts/**/*.{js,gjs,hbs}')", "lttf:ignore": "lint-to-the-future ignore", "lttf:output": "lint-to-the-future output -o ./lint-progress/", "lint-progress": "pnpm lttf:output && npx html-pages ./lint-progress --no-cache", diff --git a/plugins/automation/admin/assets/javascripts/admin/components/automation-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/automation-field.gjs index 6558863b9d6..eb8a5a669da 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/automation-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/automation-field.gjs @@ -1,5 +1,5 @@ import Component from "@glimmer/component"; -import I18n, { i18n } from 'discourse-i18n'; +import I18n, { i18n } from "discourse-i18n"; import DaBooleanField from "./fields/da-boolean-field"; import DaCategoriesField from "./fields/da-categories-field"; import DaCategoryField from "./fields/da-category-field"; diff --git a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-choices-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-choices-field.gjs index 301ec742db2..e7c226c4ff8 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-choices-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-choices-field.gjs @@ -1,5 +1,5 @@ import { hash } from "@ember/helper"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import ComboBox from "select-kit/components/combo-box"; import BaseField from "./da-base-field"; import DAFieldDescription from "./da-field-description"; diff --git a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-key-value-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-key-value-field.gjs index fd57e291a37..d8ec0a1cae1 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-key-value-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-key-value-field.gjs @@ -3,7 +3,7 @@ import { hash } from "@ember/helper"; import { action } from "@ember/object"; import DButton from "discourse/components/d-button"; import ModalJsonSchemaEditor from "discourse/components/modal/json-schema-editor"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import BaseField from "./da-base-field"; import DAFieldDescription from "./da-field-description"; import DAFieldLabel from "./da-field-label"; @@ -74,9 +74,7 @@ export default class KeyValueField extends BaseField { get showJsonModalLabel() { if (this.keyCount === 0) { - return i18n( - "discourse_automation.fields.key_value.label_without_count" - ); + return i18n("discourse_automation.fields.key_value.label_without_count"); } else { return i18n("discourse_automation.fields.key_value.label_with_count", { count: this.keyCount, diff --git a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-period-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-period-field.gjs index 379a8dbcd87..16fcf8bf4ab 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-period-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-period-field.gjs @@ -5,7 +5,7 @@ import { on } from "@ember/modifier"; import { action } from "@ember/object"; import { next } from "@ember/runloop"; import { TrackedObject } from "@ember-compat/tracked-built-ins"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import ComboBox from "select-kit/components/combo-box"; import BaseField from "./da-base-field"; import DAFieldDescription from "./da-field-description"; diff --git a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-pms-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-pms-field.gjs index 4d0cf6a864b..1be326c6c21 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-pms-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-pms-field.gjs @@ -7,7 +7,7 @@ import { service } from "@ember/service"; import { TrackedArray, TrackedObject } from "@ember-compat/tracked-built-ins"; import DButton from "discourse/components/d-button"; import DEditor from "discourse/components/d-editor"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import PlaceholdersList from "../placeholders-list"; import BaseField from "./da-base-field"; import DAFieldLabel from "./da-field-label"; diff --git a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-user-field.gjs b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-user-field.gjs index d78200532bd..b19b2b3cf2a 100644 --- a/plugins/automation/admin/assets/javascripts/admin/components/fields/da-user-field.gjs +++ b/plugins/automation/admin/assets/javascripts/admin/components/fields/da-user-field.gjs @@ -1,6 +1,6 @@ import { fn, hash } from "@ember/helper"; import { action } from "@ember/object"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import UserChooser from "select-kit/components/user-chooser"; import BaseField from "./da-base-field"; import DAFieldDescription from "./da-field-description"; diff --git a/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-edit.js b/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-edit.js index b857c39855d..1a436631c3b 100644 --- a/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-edit.js +++ b/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-edit.js @@ -5,7 +5,7 @@ import { schedule } from "@ember/runloop"; import { service } from "@ember/service"; import { ajax } from "discourse/lib/ajax"; import { extractError } from "discourse/lib/ajax-error"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; export default class AutomationEdit extends Controller { @service dialog; diff --git a/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-index.js b/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-index.js index 95bc5b03edb..511711b74f5 100644 --- a/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-index.js +++ b/plugins/automation/admin/assets/javascripts/admin/controllers/admin-plugins-discourse-automation-index.js @@ -3,7 +3,7 @@ import { action } from "@ember/object"; import { service } from "@ember/service"; import { popupAjaxError } from "discourse/lib/ajax-error"; import escape from "discourse-common/lib/escape"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; export default class AutomationIndex extends Controller { @service dialog; diff --git a/plugins/chat/admin/assets/javascripts/admin/components/admin-chat-incoming-webhooks-list.gjs b/plugins/chat/admin/assets/javascripts/admin/components/admin-chat-incoming-webhooks-list.gjs index f39f9f3ba99..08b04133d91 100644 --- a/plugins/chat/admin/assets/javascripts/admin/components/admin-chat-incoming-webhooks-list.gjs +++ b/plugins/chat/admin/assets/javascripts/admin/components/admin-chat-incoming-webhooks-list.gjs @@ -8,7 +8,7 @@ import DButton from "discourse/components/d-button"; import replaceEmoji from "discourse/helpers/replace-emoji"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import ChannelTitle from "discourse/plugins/chat/discourse/components/channel-title"; export default class AdminChatIncomingWebhooksList extends Component { diff --git a/plugins/chat/admin/assets/javascripts/admin/components/chat-admin-plugin-actions.gjs b/plugins/chat/admin/assets/javascripts/admin/components/chat-admin-plugin-actions.gjs index 1fc5c3e26cb..73309e11a57 100644 --- a/plugins/chat/admin/assets/javascripts/admin/components/chat-admin-plugin-actions.gjs +++ b/plugins/chat/admin/assets/javascripts/admin/components/chat-admin-plugin-actions.gjs @@ -2,7 +2,7 @@ import Component from "@glimmer/component"; import { action } from "@ember/object"; import { service } from "@ember/service"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; export default class ChatAdminPluginActions extends Component { @service dialog; @@ -20,9 +20,7 @@ export default class ChatAdminPluginActions extends Component { async exportMessages() { try { await this.chatAdminApi.exportMessages(); - this.dialog.alert( - i18n("chat.admin.export_messages.export_has_started") - ); + this.dialog.alert(i18n("chat.admin.export_messages.export_has_started")); } catch (error) { popupAjaxError(error); } diff --git a/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs b/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs index ae27d364938..58ffc4e8c96 100644 --- a/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs +++ b/plugins/chat/admin/assets/javascripts/admin/components/chat-incoming-webhook-edit-form.gjs @@ -10,7 +10,7 @@ import Form from "discourse/components/form"; import replaceEmoji from "discourse/helpers/replace-emoji"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import ChatChannelChooser from "discourse/plugins/chat/discourse/components/chat-channel-chooser"; export default class ChatIncomingWebhookEditForm extends Component { diff --git a/plugins/chat/admin/assets/javascripts/discourse/routes/admin-plugins-show-discourse-chat-incoming-webhooks-index.js b/plugins/chat/admin/assets/javascripts/discourse/routes/admin-plugins-show-discourse-chat-incoming-webhooks-index.js index 466fc59c7f4..2433dc6bca1 100644 --- a/plugins/chat/admin/assets/javascripts/discourse/routes/admin-plugins-show-discourse-chat-incoming-webhooks-index.js +++ b/plugins/chat/admin/assets/javascripts/discourse/routes/admin-plugins-show-discourse-chat-incoming-webhooks-index.js @@ -3,7 +3,7 @@ import { service } from "@ember/service"; import { ajax } from "discourse/lib/ajax"; import { popupAjaxError } from "discourse/lib/ajax-error"; import DiscourseRoute from "discourse/routes/discourse"; -import { i18n } from 'discourse-i18n'; +import { i18n } from "discourse-i18n"; import ChatChannel from "discourse/plugins/chat/discourse/models/chat-channel"; export default class DiscourseChatIncomingWebhooksIndex extends DiscourseRoute {