Browse Source

ref(js): Remove jQuery from the SPA completely (#28001)

Evan Purkhiser 3 years ago
parent
commit
d1cd612db8
5 changed files with 1 additions and 20 deletions
  1. 0 2
      .github/dependabot.yml
  2. 0 1
      package.json
  3. 0 6
      static/app/bootstrap/exportGlobals.tsx
  4. 1 6
      webpack.config.ts
  5. 0 5
      yarn.lock

+ 0 - 2
.github/dependabot.yml

@@ -54,7 +54,6 @@ updates:
       - dependency-name: "@sentry/release-parser"
       - dependency-name: "@size-limit/preset-small-lib"
       - dependency-name: "@types/echarts"
-      - dependency-name: "@types/jquery"
       - dependency-name: "@types/marked"
       - dependency-name: "@types/react-router"
       - dependency-name: "@types/react-select"
@@ -77,7 +76,6 @@ updates:
       - dependency-name: "jest"
       - dependency-name: "jest-circus"
       - dependency-name: "jest-junit"
-      - dependency-name: "jquery"
       - dependency-name: "less"
       - dependency-name: "marked"
       - dependency-name: "mini-css-extract-plugin"

+ 0 - 1
package.json

@@ -84,7 +84,6 @@
     "intersection-observer": "^0.12.0",
     "ios-device-list": "^1.1.35",
     "jed": "^1.1.0",
-    "jquery": "2.2.2",
     "js-cookie": "2.2.1",
     "less": "^3.12.2",
     "less-loader": "^10.0.1",

+ 0 - 6
static/app/bootstrap/exportGlobals.tsx

@@ -2,7 +2,6 @@ import * as React from 'react';
 import ReactDOM from 'react-dom';
 import * as ReactRouter from 'react-router';
 import * as Sentry from '@sentry/react';
-import jQuery from 'jquery';
 import moment from 'moment';
 import PropTypes from 'prop-types';
 import Reflux from 'reflux';
@@ -23,11 +22,6 @@ const globals = {
     render: ReactDOM.render,
   },
 
-  // jQuery is still exported to the window as some bootsrap functionality
-  // and legacy plugins like youtrack make use of it.
-  $: jQuery,
-  jQuery,
-
   // django templates make use of these globals
   SentryApp: {},
 };

+ 1 - 6
webpack.config.ts

@@ -295,7 +295,6 @@ let appConfig: Configuration = {
     ],
     noParse: [
       // don't parse known, pre-built javascript files (improves webpack perf)
-      /dist\/jquery\.js/,
       /jed\/jed\.js/,
       /marked\/lib\/marked\.js/,
       /terser\/dist\/bundle\.min\.js/,
@@ -310,13 +309,9 @@ let appConfig: Configuration = {
     }),
 
     /**
-     * jQuery must be provided in the global scope specifically and only for
-     * bootstrap, as it will not import jQuery itself.
-     *
-     * We discourage the use of global jQuery through eslint rules
+     * TODO(epurkhiser): Figure out if we still need these
      */
     new webpack.ProvidePlugin({
-      jQuery: 'jquery',
       process: 'process/browser',
       Buffer: ['buffer', 'Buffer'],
     }),

+ 0 - 5
yarn.lock

@@ -9715,11 +9715,6 @@ jest@27.0.6:
     import-local "^3.0.2"
     jest-cli "^27.0.6"
 
-jquery@2.2.2:
-  version "2.2.2"
-  resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.2.tgz#3e302dc61eb329a21e9efac937d731f061134c59"
-  integrity sha1-PjAtxh6zKaIenvrJN9cx8GETTFk=
-
 js-cookie@2.2.1:
   version "2.2.1"
   resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"