Skip to content

A platform for community discussion. Free, open, simple.

DEV: Introduce decorator-position lint rule (#22937)

David Taylorb7e642d99dfe
diff --git a/app/assets/javascripts/discourse/app/components/d-button.gjs b/app/assets/javascripts/discourse/app/components/d-button.gjs
index 207958d0fc4..a3480f85aef 100644
--- a/app/assets/javascripts/discourse/app/components/d-button.gjs
+++ b/app/assets/javascripts/discourse/app/components/d-button.gjs
@@ -75,14 +75,11 @@ export default class DButton extends GlimmerComponentWithDeprecatedParentView {
@service router;
- @notEmpty("args.icon")
- btnIcon;
+ @notEmpty("args.icon") btnIcon;
- @equal("args.display", "link")
- btnLink;
+ @equal("args.display", "link") btnLink;
- @empty("computedLabel")
- noText;
+ @empty("computedLabel") noText;
constructor() {
super(...arguments);
diff --git a/app/assets/javascripts/discourse/app/components/form-template-field/upload.js b/app/assets/javascripts/discourse/app/components/form-template-field/upload.js
index 91c609676ca..7b8f6e6c010 100644
--- a/app/assets/javascripts/discourse/app/components/form-template-field/upload.js
+++ b/app/assets/javascripts/discourse/app/components/form-template-field/upload.js
@@ -12,7 +12,8 @@ export default class FormTemplateFieldUpload extends Component.extend(
@tracked uploadComplete = false;
@tracked uploadedFiles = [];
@tracked disabled = this.uploading;
- @tracked fileUploadElementId = this.attributes?.label
+ @tracked
+ fileUploadElementId = this.attributes?.label
? `${dasherize(this.attributes.label)}-uploader`
: `${this.elementId}-uploader`;
@tracked fileInputSelector = `#${this.fileUploadElementId}`;
diff --git a/app/assets/javascripts/discourse/app/components/modal/bookmark.js b/app/assets/javascripts/discourse/app/components/modal/bookmark.js
index 62334a58dbe..cd3865e10ea 100644
--- a/app/assets/javascripts/discourse/app/components/modal/bookmark.js
+++ b/app/assets/javascripts/discourse/app/components/modal/bookmark.js
@@ -38,17 +38,13 @@ export default class BookmarkModal extends Component {
@tracked userTimezone = this.currentUser.user_option.timezone;
@tracked showOptions = this.args.model.bookmark.id ? true : false;
- @notEmpty("userTimezone")
- userHasTimezoneSet;
+ @notEmpty("userTimezone") userHasTimezoneSet;
- @notEmpty("bookmark.id")
- showDelete;
+ @notEmpty("bookmark.id") showDelete;
- @notEmpty("bookmark.id")
- editingExistingBookmark;
+ @notEmpty("bookmark.id") editingExistingBookmark;
- @and("bookmark.id", "bookmark.reminderAt")
- existingBookmarkHasReminder;
+ @and("bookmark.id", "bookmark.reminderAt") existingBookmarkHasReminder;
@tracked _closeWithoutSaving = false;
@tracked _savingBookmarkManually = false;
diff --git a/app/assets/javascripts/discourse/app/components/modal/second-factor-backup-edit.js b/app/assets/javascripts/discourse/app/components/modal/second-factor-backup-edit.js
index 203d293e4c8..427061a0e94 100644
--- a/app/assets/javascripts/discourse/app/components/modal/second-factor-backup-edit.js
+++ b/app/assets/javascripts/discourse/app/components/modal/second-factor-backup-edit.js
@@ -9,9 +9,10 @@ export default class SecondFactorBackupEdit extends Component {
@tracked loading = false;
@tracked errorMessage;
@tracked successMessage;
- @tracked backupEnabled =
- this.args.model.secondFactor.second_factor_backup_enabled;
- @tracked remainingCodes =
+ @tracked
+ backupEnabled = this.args.model.secondFactor.second_factor_backup_enabled;
+ @tracked
+ remainingCodes =
this.args.model.secondFactor.second_factor_remaining_backup_codes;
@tracked backupCodes;
@tracked secondFactorMethod = SECOND_FACTOR_METHODS.TOTP;
diff --git a/app/assets/javascripts/discourse/app/components/search-menu.js b/app/assets/javascripts/discourse/app/components/search-menu.js
index a1b5c62c726..046ccf28403 100644
--- a/app/assets/javascripts/discourse/app/components/search-menu.js
+++ b/app/assets/javascripts/discourse/app/components/search-menu.js
@@ -44,8 +44,8 @@ export default class SearchMenu extends Component {
@tracked loading = false;
@tracked results = {};
@tracked noResults = false;
- @tracked inPMInboxContext =
- this.search.searchContext?.type === "private_messages";
+ @tracked
+ inPMInboxContext = this.search.searchContext?.type === "private_messages";
@tracked typeFilter = DEFAULT_TYPE_FILTER;
@tracked suggestionKeyword = false;
@tracked suggestionResults = [];
diff --git a/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.js b/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.js
index a515bf6184a..562d055007a 100644
--- a/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.js
+++ b/app/assets/javascripts/discourse/app/components/sidebar/edit-navigation-menu/categories-modal.js
@@ -18,9 +18,8 @@ export default class extends Component {
@tracked onlySelected = false;
@tracked onlyUnselected = false;
- @tracked selectedSidebarCategoryIds = [
- ...this.currentUser.sidebar_category_ids,
- ];
+ @tracked
+ selectedSidebarCategoryIds = [...this.currentUser.sidebar_category_ids];
categoryGroupings = [];
diff --git a/package.json b/package.json
index 6a83a93e430..bc822d12d2e 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"diffhtml": "1.0.0-beta.20",
"ember-template-lint": "5.10.3",
"eslint": "^8.37.0",
- "eslint-config-discourse": "^3.5.0",
+ "eslint-config-discourse": "^3.6.0",
"eslint-plugin-ember": "11.8.0",
"eslint-plugin-sort-class-members": "1.18.0",
"jsdoc": "^4.0.0",
diff --git a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
index 010698b56b1..e9c8d2f593a 100644
--- a/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
+++ b/plugins/chat/assets/javascripts/discourse/initializers/chat-sidebar.js
@@ -111,7 +111,9 @@ export default {
const SidebarChatChannelsSection = class extends BaseCustomSidebarSection {
@service currentUser;
- @tracked currentUserCanJoinPublicChannels =
+
+ @tracked
+ currentUserCanJoinPublicChannels =
this.currentUser &&
(this.currentUser.staff ||
this.currentUser.has_joinable_public_channels);
@@ -344,8 +346,9 @@ export default {
@service site;
@service modal;
@service router;
- @tracked userCanDirectMessage =
- this.chatService.userCanDirectMessage;
+
+ @tracked
+ userCanDirectMessage = this.chatService.userCanDirectMessage;
constructor() {
super(...arguments);
diff --git a/yarn.lock b/yarn.lock
index e7f1c19acef..ad9c7b83277 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -32,7 +32,7 @@
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730"
integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==
-"@babel/core@^7.20.12":
+"@babel/core@^7.18.6", "@babel/core@^7.20.12":
version "7.22.9"
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.9.tgz#bd96492c68822198f33e8a256061da3cf391f58f"
integrity sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w==
@@ -147,6 +147,21 @@
"@babel/helper-split-export-declaration" "^7.22.5"
semver "^6.3.0"
+"@babel/helper-create-class-features-plugin@^7.22.6":
+ version "7.22.9"
+ resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.22.9.tgz#c36ea240bb3348f942f08b0fbe28d6d979fab236"
+ integrity sha512-Pwyi89uO4YrGKxL/eNJ8lfEH55DnRloGPOseaA8NFNL6jAUnn+KccaISiFazCj5IolPPDjGSdzQzXVzODVRqUQ==
+ dependencies:
+ "@babel/helper-annotate-as-pure" "^7.22.5"
+ "@babel/helper-environment-visitor" "^7.22.5"
+ "@babel/helper-function-name" "^7.22.5"
+ "@babel/helper-member-expression-to-functions" "^7.22.5"
+ "@babel/helper-optimise-call-expression" "^7.22.5"
+ "@babel/helper-replace-supers" "^7.22.9"
+ "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5"
+ "@babel/helper-split-export-declaration" "^7.22.6"
+ semver "^6.3.1"
+
"@babel/helper-environment-visitor@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98"
@@ -230,6 +245,15 @@
"@babel/traverse" "^7.22.5"
"@babel/types" "^7.22.5"
+"@babel/helper-replace-supers@^7.22.9":
+ version "7.22.9"
+ resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.22.9.tgz#cbdc27d6d8d18cd22c81ae4293765a5d9afd0779"
+ integrity sha512-LJIKvvpgPOPUThdYqcX6IXRuIcTkcAub0IaDRGCZH0p5GPUp7PhRU9QVgFcDDd51BaPkk77ZjqFwh6DZTAEmGg==
+ dependencies:
+ "@babel/helper-environment-visitor" "^7.22.5"
+ "@babel/helper-member-expression-to-functions" "^7.22.5"
+ "@babel/helper-optimise-call-expression" "^7.22.5"
+
"@babel/helper-simple-access@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz#4938357dc7d782b80ed6dbb03a0fba3d22b1d5de"
@@ -310,6 +334,17 @@
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae"
integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==
+"@babel/plugin-proposal-decorators@^7.18.6":
+ version "7.22.7"
+ resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.22.7.tgz#9b5b73c2e404f0869ef8a8a53765f8203c5467a7"
+ integrity sha512-omXqPF7Onq4Bb7wHxXjM3jSMSJvUUbvDvmmds7KI5n9Cq6Ln5I05I1W2nRlRof1rGdiUxJrxwe285WF96XlBXQ==
+ dependencies:
+ "@babel/helper-create-class-features-plugin" "^7.22.6"
+ "@babel/helper-plugin-utils" "^7.22.5"
+ "@babel/helper-replace-supers" "^7.22.5"
+ "@babel/helper-split-export-declaration" "^7.22.6"
+ "@babel/plugin-syntax-decorators" "^7.22.5"
+
"@babel/plugin-proposal-decorators@^7.22.5":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.22.5.tgz#dc8cdda048e5aea947efda920e030199806b868d"
@@ -1718,10 +1753,10 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
-eslint-config-discourse@^3.5.0:
- version "3.5.0"
- resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-3.5.0.tgz#528db8a5b64e5d0aa96d958a50f9d75456c91e4e"
- integrity sha512-IwxNmfyomRKrMCP3dsgxEepKYv/QW5tcLi/NRv7hl06uRK5o+a8QvrFjFiC+KfYcNRQhTQA4So+YwXSrVpCk0A==
+eslint-config-discourse@^3.6.0:
+ version "3.6.0"
+ resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-3.6.0.tgz#bceb472ca66fb969600587aa0722d428798e0d4f"
+ integrity sha512-w4q0D+FtLyYPIgu2ec0SIaY8vNKmj5dPV8AgWqmXLNX2rjFdWXcQQBZRsq4U+JJrOT7v4uNMz+B5mFRMGxOiQw==
dependencies:
"@babel/core" "^7.22.5"
"@babel/eslint-parser" "^7.22.5"
@@ -1730,6 +1765,7 @@ eslint-config-discourse@^3.5.0:
ember-template-lint "^5.10.3"
ember-template-lint-plugin-discourse "^3.0.0"
eslint "^8.43.0"
+ eslint-plugin-decorator-position "^5.0.2"
eslint-plugin-discourse-ember latest
eslint-plugin-ember "^11.8.0"
eslint-plugin-lodash "^7.1.0"
@@ -1742,6 +1778,17 @@ eslint-formatter-kakoune@^1.0.0:
resolved "https://registry.yarnpkg.com/eslint-formatter-kakoune/-/eslint-formatter-kakoune-1.0.0.tgz#a95cc4fe1fbc06b84e0f2397e83f5f0b68340125"
integrity sha512-Uk/TVLt6Nf6Xoz7C1iYuZjOSdJxe5aaauGRke8JhKeJwD66Y61/pY2FjtLP04Ooq9PwV34bzrkKkU2UZ5FtDRA==
+eslint-plugin-decorator-position@^5.0.2:
+ version "5.0.2"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-decorator-position/-/eslint-plugin-decorator-position-5.0.2.tgz#c96f46d8ef0f7dbd519ff91a67ccc4b6ba30693b"
+ integrity sha512-wFcRfrB9zljOP1n5udg16h6ITX1jG8cnUvuFVtIqVxw5O9BTOXFHB9hvsTaqpb8JFX2dq19fH3i/ipUeFSF87w==
+ dependencies:
+ "@babel/core" "^7.18.6"
+ "@babel/plugin-proposal-decorators" "^7.18.6"
+ "@ember-data/rfc395-data" "^0.0.4"
+ ember-rfc176-data "^0.3.17"
+ snake-case "^3.0.4"
+
eslint-plugin-discourse-ember@latest:
version "0.0.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-discourse-ember/-/eslint-plugin-discourse-ember-0.0.3.tgz#69e5876c2ece38ab3d6c4a05f0a20a7dc4c21e37"
@@ -3777,7 +3824,7 @@ slash@^4.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==
-snake-case@^3.0.3:
+snake-case@^3.0.3, snake-case@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c"
integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==