DEV: Avoid using globals (#14909)

DEV: Avoid using globals (#14909)

diff --git a/.eslintrc b/.eslintrc
index 62dbb92..511724f 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -5,15 +5,41 @@
     "eol-last": 2
   },
   "globals": {
+    "_": "off",
+    "acceptance": "off",
+    "asyncRender": "off",
+    "bootbox": "off",
+    "click": "off",
+    "count": "off",
+    "currentPath": "off",
+    "currentRouteName": "off",
+    "currentURL": "off",
+    "currentUser": "off",
+    "Discourse": "off",
+    "exists": "off",
+    "fillIn": "off",
+    "find": "off",
+    "getSettledState": "off",
+    "hasModule": "off",
+    "invisible": "off",
     "jQuery": "off",
+    "keyboardHelper": "off",
+    "keyEvent": "off",
     "moduleFor": "off",
     "moduleForComponent": "off",
-    "testStart": "off",
-    "testDone": "off",
+    "pauseTest": "off",
+    "Pretender": "off",
+    "query": "off",
+    "queryAll": "off",
+    "QUnit": "off",
+    "sandbox": "off",
     "sinon": "off",
-    "currentURL": "off",
-    "invisible": "off",
+    "test": "off",
+    "testDone": "off",
+    "testStart": "off",
+    "triggerEvent": "off",
     "visible": "off",
-    "count": "off"
+    "visit": "off",
+    "waitUntil": "off"
   }
 }
diff --git a/app/assets/javascripts/admin/addon/routes/admin-customize-themes-show.js b/app/assets/javascripts/admin/addon/routes/admin-customize-themes-show.js
index 58760b4..6c23a36 100644
--- a/app/assets/javascripts/admin/addon/routes/admin-customize-themes-show.js
+++ b/app/assets/javascripts/admin/addon/routes/admin-customize-themes-show.js
@@ -2,6 +2,7 @@ import { COMPONENTS, THEMES } from "admin/models/theme";
 import I18n from "I18n";
 import Route from "@ember/routing/route";
 import { scrollTop } from "discourse/mixins/scroll-top";
+import bootbox from "bootbox";
 
 export function showUnassignedComponentWarning(theme, callback) {
   bootbox.confirm(
diff --git a/app/assets/javascripts/discourse/app/components/pick-files-button.js b/app/assets/javascripts/discourse/app/components/pick-files-button.js
index a451c67..9ab6465 100644
--- a/app/assets/javascripts/discourse/app/components/pick-files-button.js
+++ b/app/assets/javascripts/discourse/app/components/pick-files-button.js
@@ -1,8 +1,9 @@
 import Component from "@ember/component";
 import { action } from "@ember/object";
 import { empty } from "@ember/object/computed";
-import { bind, default as computed } from "discourse-common/utils/decorators";
+import computed, { bind } from "discourse-common/utils/decorators";
 import I18n from "I18n";
+import bootbox from "bootbox";
 
 export default Component.extend({
   classNames: ["pick-files-button"],
diff --git a/app/assets/javascripts/discourse/app/controllers/grant-admin-second-factor.js b/app/assets/javascripts/discourse/app/controllers/grant-admin-second-factor.js
index 2debd00..62c000b 100644
--- a/app/assets/javascripts/discourse/app/controllers/grant-admin-second-factor.js
+++ b/app/assets/javascripts/discourse/app/controllers/grant-admin-second-factor.js
@@ -5,6 +5,7 @@ import { getWebauthnCredential } from "discourse/lib/webauthn";
 import ModalFunctionality from "discourse/mixins/modal-functionality";
 import { SECOND_FACTOR_METHODS } from "discourse/models/user";
 import I18n from "I18n";
+import bootbox from "bootbox";
 
 export default Controller.extend(ModalFunctionality, {
   showSecondFactor: false,
diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
index 1ae7bd2..c7a95a6 100644
--- a/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
+++ b/app/assets/javascripts/discourse/app/mixins/composer-upload-uppy.js
@@ -18,6 +18,7 @@ import {
   validateUploadedFile,
 } from "discourse/lib/uploads";
 import { cacheShortUploadUrl } from "pretty-text/upload-short-url";
+import bootbox from "bootbox";
 
 // Note: This mixin is used _in addition_ to the ComposerUpload mixin
 // on the composer-editor component. It overrides some, but not all,
diff --git a/app/assets/javascripts/discourse/app/mixins/composer-upload.js b/app/assets/javascripts/discourse/app/mixins/composer-upload.js
index 24fae9e..cee453f 100644
--- a/app/assets/javascripts/discourse/app/mixins/composer-upload.js
+++ b/app/assets/javascripts/discourse/app/mixins/composer-upload.js
@@ -13,6 +13,7 @@ import {
   validateUploadedFiles,
 } from "discourse/lib/uploads";
 import { cacheShortUploadUrl } from "pretty-text/upload-short-url";
+import bootbox from "bootbox";
 
 export default Mixin.create({
   _xhr: null,
diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
index 941fe78..3fe51ea 100644
--- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
+++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
@@ -16,6 +16,7 @@ import UppyChecksum from "discourse/lib/uppy-checksum-plugin";
 import UppyS3Multipart from "discourse/mixins/uppy-s3-multipart";
 import { on } from "discourse-common/utils/decorators";
 import { warn } from "@ember/debug";
+import bootbox from "bootbox";
 
 export const HUGE_FILE_THRESHOLD_BYTES = 104_857_600; // 100MB
 
diff --git a/app/assets/javascripts/discourse/app/models/site.js b/app/assets/javascripts/discourse/app/models/site.js
index 9fc38c9..9b92108 100644
--- a/app/assets/javascripts/discourse/app/models/site.js
+++ b/app/assets/javascripts/discourse/app/models/site.js
@@ -224,6 +224,7 @@ Site.reopenClass(Singleton, {
 
 if (typeof Discourse !== "undefined") {
   let warned = false;
+  // eslint-disable-next-line no-undef
   Object.defineProperty(Discourse, "Site", {
     get() {
       if (!warned) {
diff --git a/app/assets/javascripts/discourse/app/models/user.js b/app/assets/javascripts/discourse/app/models/user.js
index 400d9f3..b9b92bc 100644
--- a/app/assets/javascripts/discourse/app/models/user.js
+++ b/app/assets/javascripts/discourse/app/models/user.js
@@ -1125,6 +1125,7 @@ User.reopenClass(Singleton, {
 
 if (typeof Discourse !== "undefined") {
   let warned = false;
+  // eslint-disable-next-line no-undef
   Object.defineProperty(Discourse, "User", {
     get() {
       if (!warned) {
diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
index 31c9944..644ee8f 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js
@@ -2,6 +2,7 @@ import {
   acceptance,
   count,
   exists,
+  query,
   queryAll,
 } from "discourse/tests/helpers/qunit-helpers";
 import { click, fillIn, visit } from "@ember/test-helpers";
@@ -91,16 +92,16 @@ acceptance("Admin - Watched Words", function (needs) {
     await visit("/admin/customize/watched_words/action/replace");
     await click(".watched-word-test");
     await fillIn(".modal-body textarea", "Hi there!");
-    assert.strictEqual(find(".modal-body li .match").text(), "Hi");
-    assert.strictEqual(find(".modal-body li .replacement").text(), "hello");
+    assert.strictEqual(query(".modal-body li .match").innerText, "Hi");
+    assert.strictEqual(query(".modal-body li .replacement").innerText, "hello");
   });
 
   test("test modal - tag", async function (assert) {
     await visit("/admin/customize/watched_words/action/tag");
     await click(".watched-word-test");
     await fillIn(".modal-body textarea", "Hello world!");
-    assert.strictEqual(find(".modal-body li .match").text(), "Hello");
-    assert.strictEqual(find(".modal-body li .tag").text(), "greeting");
+    assert.strictEqual(query(".modal-body li .match").innerText, "Hello");
+    assert.strictEqual(query(".modal-body li .tag").innerText, "greeting");
   });
 });
 
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js

[... diff too long, it was truncated ...]

GitHub sha: bdd2c888b0f4d2f6ae0d10cdb66b949bed013683

This commit appears in #14909 which was approved by davidtaylorhq. It was merged by CvX.