DEV: Remove `jQuery` global usage where possible (#14905)

DEV: Remove jQuery global usage where possible (#14905)

diff --git a/.eslintrc b/.eslintrc
index 8706c9f..62dbb92 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -5,6 +5,7 @@
     "eol-last": 2
   },
   "globals": {
+    "jQuery": "off",
     "moduleFor": "off",
     "moduleForComponent": "off",
     "testStart": "off",
diff --git a/app/assets/javascripts/discourse/app/helpers/raw.js b/app/assets/javascripts/discourse/app/helpers/raw.js
index c9dd07f..0ad2d6e 100644
--- a/app/assets/javascripts/discourse/app/helpers/raw.js
+++ b/app/assets/javascripts/discourse/app/helpers/raw.js
@@ -18,7 +18,7 @@ function lookupView(templateName) {
 }
 
 function renderRaw(ctx, template, templateName, params) {
-  params = jQuery.extend({}, params);
+  params = Object.assign({}, params);
   params.parent = params.parent || ctx;
 
   let context = helperContext();
@@ -30,7 +30,7 @@ function renderRaw(ctx, template, templateName, params) {
     }
 
     if (!params.view) {
-      params = jQuery.extend({}, params, context);
+      params = Object.assign({}, params, context);
     }
   }
 
diff --git a/app/assets/javascripts/discourse/app/lib/formatter.js b/app/assets/javascripts/discourse/app/lib/formatter.js
index f2ad737..90ddf88 100644
--- a/app/assets/javascripts/discourse/app/lib/formatter.js
+++ b/app/assets/javascripts/discourse/app/lib/formatter.js
@@ -50,6 +50,7 @@ export function longDateNoYear(dt) {
 }
 
 export function updateRelativeAge(elems) {
+  // eslint-disable-next-line no-undef
   if (elems instanceof jQuery) {
     elems = elems.toArray();
     deprecated("updateRelativeAge now expects a DOM NodeList", {
diff --git a/app/assets/javascripts/discourse/app/lib/highlight-syntax.js b/app/assets/javascripts/discourse/app/lib/highlight-syntax.js
index 3a1a5d9..62e2a05 100644
--- a/app/assets/javascripts/discourse/app/lib/highlight-syntax.js
+++ b/app/assets/javascripts/discourse/app/lib/highlight-syntax.js
@@ -14,6 +14,7 @@ export default function highlightSyntax(elem, siteSettings, session) {
     : "pre code[class]";
   const path = session.highlightJsPath;
 
+  // eslint-disable-next-line no-undef
   if (elem instanceof jQuery) {
     deprecated(
       "highlightSyntax now takes a DOM node instead of a jQuery object.",
diff --git a/app/assets/javascripts/discourse/app/lib/link-hashtags.js b/app/assets/javascripts/discourse/app/lib/link-hashtags.js
index 5a647d8..7d1fa26 100644
--- a/app/assets/javascripts/discourse/app/lib/link-hashtags.js
+++ b/app/assets/javascripts/discourse/app/lib/link-hashtags.js
@@ -8,6 +8,7 @@ const tagHashtags = {};
 const checkedHashtags = new Set();
 
 export function linkSeenHashtags(elem) {
+  // eslint-disable-next-line no-undef
   if (elem instanceof jQuery) {
     elem = elem[0];
 
diff --git a/app/assets/javascripts/discourse/app/lib/link-mentions.js b/app/assets/javascripts/discourse/app/lib/link-mentions.js
index ab9aca4..8abfc47 100644
--- a/app/assets/javascripts/discourse/app/lib/link-mentions.js
+++ b/app/assets/javascripts/discourse/app/lib/link-mentions.js
@@ -67,6 +67,7 @@ function updateFound(mentions, usernames) {
 }
 
 export function linkSeenMentions(elem, siteSettings) {
+  // eslint-disable-next-line no-undef
   if (elem instanceof jQuery) {
     elem = elem[0];
 
diff --git a/app/assets/javascripts/discourse/app/lib/plugin-connectors.js b/app/assets/javascripts/discourse/app/lib/plugin-connectors.js
index 71d922e..83232ff 100644
--- a/app/assets/javascripts/discourse/app/lib/plugin-connectors.js
+++ b/app/assets/javascripts/discourse/app/lib/plugin-connectors.js
@@ -53,7 +53,7 @@ function findClass(outletName, uniqueName) {
   let foundClass = _extraConnectorClasses[id] || _classPaths[id];
 
   return foundClass
-    ? jQuery.extend({}, DefaultConnectorClass, foundClass)
+    ? Object.assign({}, DefaultConnectorClass, foundClass)
     : DefaultConnectorClass;
 }
 
diff --git a/app/assets/javascripts/discourse/app/lib/timeframes-builder.js b/app/assets/javascripts/discourse/app/lib/timeframes-builder.js
index 6fd5138..cdfd0a3 100644
--- a/app/assets/javascripts/discourse/app/lib/timeframes-builder.js
+++ b/app/assets/javascripts/discourse/app/lib/timeframes-builder.js
@@ -6,7 +6,7 @@ const TIMEFRAME_BASE = {
 };
 
 function buildTimeframe(opts) {
-  return jQuery.extend({}, TIMEFRAME_BASE, opts);
+  return Object.assign({}, TIMEFRAME_BASE, opts);
 }
 
 const TIMEFRAMES = [
diff --git a/app/assets/javascripts/discourse/app/widgets/button.js b/app/assets/javascripts/discourse/app/widgets/button.js
index 29f071f..242736a 100644
--- a/app/assets/javascripts/discourse/app/widgets/button.js
+++ b/app/assets/javascripts/discourse/app/widgets/button.js
@@ -131,7 +131,7 @@ export default createWidget("button", ButtonClass);
 
 createWidget(
   "flat-button",
-  jQuery.extend(ButtonClass, {
+  Object.assign(ButtonClass, {
     tagName: "button.widget-button.btn-flat",
   })
 );
diff --git a/app/assets/javascripts/discourse/app/widgets/header.js b/app/assets/javascripts/discourse/app/widgets/header.js
index 8adbe4d..68aab4d 100644
--- a/app/assets/javascripts/discourse/app/widgets/header.js
+++ b/app/assets/javascripts/discourse/app/widgets/header.js
@@ -146,7 +146,7 @@ createWidget("header-notifications", {
 
 createWidget(
   "user-dropdown",
-  jQuery.extend(
+  Object.assign(
     {
       tagName: "li.header-dropdown-toggle.current-user",
 
@@ -176,7 +176,7 @@ createWidget(
 
 createWidget(
   "header-dropdown",
-  jQuery.extend(
+  Object.assign(
     {
       tagName: "li.header-dropdown-toggle",
 
diff --git a/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js b/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
index 7564ce2..6f3c271 100644
--- a/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
+++ b/app/assets/javascripts/discourse/app/widgets/post-admin-menu.js
@@ -4,7 +4,7 @@ import { h } from "virtual-dom";
 
 createWidget(
   "post-admin-menu-button",
-  jQuery.extend(ButtonClass, { tagName: "li.btn" })
+  Object.assign(ButtonClass, { tagName: "li.btn" })
 );
 
 createWidget("post-admin-menu-button", {
diff --git a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
index e283466..4fb02be 100644
--- a/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
+++ b/app/assets/javascripts/discourse/tests/helpers/select-kit-helper.js
@@ -65,6 +65,7 @@ async function keyboardHelper(value, target, selector) {
 
   if (value === "selectAll") {
     // special casing the only one not working with triggerEvent
+    // eslint-disable-next-line no-undef
     const event = jQuery.Event("keydown");
     event.key = "A";
     event.keyCode = 65;
diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.js
index de260e3..32d909e 100644
--- a/app/assets/javascripts/discourse/tests/setup-tests.js
+++ b/app/assets/javascripts/discourse/tests/setup-tests.js
@@ -379,6 +379,7 @@ function setupTestsCommon(application, container, config) {
   }
 
   // forces 0 as duration for all jquery animations
+  // eslint-disable-next-line no-undef
   jQuery.fx.off = true;
 
   setupToolbar();
diff --git a/app/assets/javascripts/wizard/components/wizard-step.js b/app/assets/javascripts/wizard/components/wizard-step.js
index 1d66e86..48e3f75 100644
--- a/app/assets/javascripts/wizard/components/wizard-step.js
+++ b/app/assets/javascripts/wizard/components/wizard-step.js
@@ -5,6 +5,7 @@ import getUrl from "discourse-common/lib/get-url";
 import { htmlSafe } from "@ember/template";
 import { schedule } from "@ember/runloop";
 
+// eslint-disable-next-line no-undef
 jQuery.fn.wiggle = function (times, duration) {
   if (times > 0) {
     this.animate(

GitHub sha: 9ca93f57cce1f9a9a7e482fd1c15b5e9af288fab

This commit appears in #14905 which was approved by eviltrout. It was merged by CvX.