Use explicit jQuery import, remove unused eslint globals (#18435)

- Don't rely on globals (window.$) for jQuery import
- Remove eslint globals no longer in use
tokarchuk/v1.17
silverwind 3 years ago committed by GitHub
parent 7b04c97b7b
commit 19b017f398
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .eslintrc
  2. 1
      web_src/js/components/ContextPopup.vue
  3. 1
      web_src/js/components/DashboardRepoList.js
  4. 1
      web_src/js/components/RepoBranchTagDropdown.js
  5. 2
      web_src/js/features/admin-common.js
  6. 2
      web_src/js/features/admin-emails.js
  7. 2
      web_src/js/features/admin-users.js
  8. 2
      web_src/js/features/clipboard.js
  9. 4
      web_src/js/features/common-global.js
  10. 1
      web_src/js/features/common-issue.js
  11. 1
      web_src/js/features/common-organization.js
  12. 1
      web_src/js/features/comp/ColorPicker.js
  13. 5
      web_src/js/features/comp/EasyMDE.js
  14. 1
      web_src/js/features/comp/ImagePaste.js
  15. 1
      web_src/js/features/comp/LabelEdit.js
  16. 1
      web_src/js/features/comp/MarkupContentPreview.js
  17. 1
      web_src/js/features/comp/ReactionSelector.js
  18. 1
      web_src/js/features/comp/SearchUserBox.js
  19. 1
      web_src/js/features/comp/WebHookEditor.js
  20. 2
      web_src/js/features/contextpopup.js
  21. 1
      web_src/js/features/heatmap.js
  22. 2
      web_src/js/features/imagediff.js
  23. 2
      web_src/js/features/install.js
  24. 3
      web_src/js/features/notification.js
  25. 2
      web_src/js/features/org-team.js
  26. 2
      web_src/js/features/repo-branch.js
  27. 1
      web_src/js/features/repo-code.js
  28. 2
      web_src/js/features/repo-commit.js
  29. 2
      web_src/js/features/repo-common.js
  30. 2
      web_src/js/features/repo-diff.js
  31. 2
      web_src/js/features/repo-editor.js
  32. 2
      web_src/js/features/repo-graph.js
  33. 1
      web_src/js/features/repo-home.js
  34. 2
      web_src/js/features/repo-issue-content.js
  35. 1
      web_src/js/features/repo-issue.js
  36. 1
      web_src/js/features/repo-legacy.js
  37. 2
      web_src/js/features/repo-migrate.js
  38. 2
      web_src/js/features/repo-migration.js
  39. 2
      web_src/js/features/repo-projects.js
  40. 1
      web_src/js/features/repo-release.js
  41. 1
      web_src/js/features/repo-settings.js
  42. 1
      web_src/js/features/repo-template.js
  43. 2
      web_src/js/features/repo-unicode-escape.js
  44. 1
      web_src/js/features/repo-wiki.js
  45. 2
      web_src/js/features/sshkey-helper.js
  46. 3
      web_src/js/features/stopwatch.js
  47. 2
      web_src/js/features/user-auth-webauthn.js
  48. 2
      web_src/js/features/user-auth.js
  49. 2
      web_src/js/features/user-settings.js
  50. 1
      web_src/js/index.js
  51. 7
      web_src/js/markup/tasklist.js

@ -23,9 +23,6 @@ env:
globals: globals:
__webpack_public_path__: true __webpack_public_path__: true
CodeMirror: false
Dropzone: false
SimpleMDE: false
settings: settings:
html/html-extensions: [".tmpl"] html/html-extensions: [".tmpl"]
@ -34,7 +31,6 @@ overrides:
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"] - files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
env: env:
browser: true browser: true
jquery: true
node: false node: false
- files: ["templates/**/*.tmpl"] - files: ["templates/**/*.tmpl"]
rules: rules:

@ -24,6 +24,7 @@
</template> </template>
<script> <script>
import $ from 'jquery';
import {SvgIcon} from '../svg.js'; import {SvgIcon} from '../svg.js';
const {appSubUrl, i18n} = window.config; const {appSubUrl, i18n} = window.config;

@ -1,4 +1,5 @@
import Vue from 'vue'; import Vue from 'vue';
import $ from 'jquery';
import {initVueSvg, vueDelimiters} from './VueComponentLoader.js'; import {initVueSvg, vueDelimiters} from './VueComponentLoader.js';
const {appSubUrl, assetUrlPrefix, pageData} = window.config; const {appSubUrl, assetUrlPrefix, pageData} = window.config;

@ -1,4 +1,5 @@
import Vue from 'vue'; import Vue from 'vue';
import $ from 'jquery';
import {vueDelimiters} from './VueComponentLoader.js'; import {vueDelimiters} from './VueComponentLoader.js';
export function initRepoBranchTagDropdown(selector) { export function initRepoBranchTagDropdown(selector) {

@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initAdminCommon() { export function initAdminCommon() {

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initAdminEmails() { export function initAdminEmails() {
function linkEmailAction(e) { function linkEmailAction(e) {
const $this = $(this); const $this = $(this);

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initAdminUserListSearchForm() { export function initAdminUserListSearchForm() {
const searchForm = window.config.pageData.adminUserListSearchForm; const searchForm = window.config.pageData.adminUserListSearchForm;
if (!searchForm) return; if (!searchForm) return;

@ -1,3 +1,5 @@
import $ from 'jquery';
const {copy_success, copy_error} = window.config.i18n; const {copy_success, copy_error} = window.config.i18n;
function onSuccess(btn) { function onSuccess(btn) {

@ -1,9 +1,9 @@
import $ from 'jquery';
import 'jquery.are-you-sure';
import {mqBinarySearch} from '../utils.js'; import {mqBinarySearch} from '../utils.js';
import createDropzone from './dropzone.js'; import createDropzone from './dropzone.js';
import {initCompColorPicker} from './comp/ColorPicker.js'; import {initCompColorPicker} from './comp/ColorPicker.js';
import 'jquery.are-you-sure';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initGlobalFormDirtyLeaveConfirm() { export function initGlobalFormDirtyLeaveConfirm() {

@ -1,3 +1,4 @@
import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js'; import {updateIssuesMeta} from './repo-issue.js';
export function initCommonIssue() { export function initCommonIssue() {

@ -1,3 +1,4 @@
import $ from 'jquery';
import {initCompLabelEdit} from './comp/LabelEdit.js'; import {initCompLabelEdit} from './comp/LabelEdit.js';
export function initCommonOrganization() { export function initCommonOrganization() {

@ -1,3 +1,4 @@
import $ from 'jquery';
import createColorPicker from '../colorpicker.js'; import createColorPicker from '../colorpicker.js';
export function initCompColorPicker() { export function initCompColorPicker() {

@ -1,3 +1,4 @@
import $ from 'jquery';
import attachTribute from '../tribute.js'; import attachTribute from '../tribute.js';
const {appSubUrl} = window.config; const {appSubUrl} = window.config;
@ -54,7 +55,7 @@ export async function importEasyMDE() {
* @returns {null|EasyMDE} * @returns {null|EasyMDE}
*/ */
export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) { export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
if (textarea instanceof jQuery) { if (textarea instanceof $) {
textarea = textarea[0]; textarea = textarea[0];
} }
if (!textarea) { if (!textarea) {
@ -151,7 +152,7 @@ export function attachEasyMDEToElements(easyMDE) {
* @returns {null|EasyMDE} * @returns {null|EasyMDE}
*/ */
export function getAttachedEasyMDE(el) { export function getAttachedEasyMDE(el) {
if (el instanceof jQuery) { if (el instanceof $) {
el = el[0]; el = el[0];
} }
if (!el) { if (!el) {

@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
async function uploadFile(file, uploadUrl) { async function uploadFile(file, uploadUrl) {

@ -1,3 +1,4 @@
import $ from 'jquery';
import {initCompColorPicker} from './ColorPicker.js'; import {initCompColorPicker} from './ColorPicker.js';
export function initCompLabelEdit(selector) { export function initCompLabelEdit(selector) {

@ -1,3 +1,4 @@
import $ from 'jquery';
import {initMarkupContent} from '../../markup/content.js'; import {initMarkupContent} from '../../markup/content.js';
const {csrfToken} = window.config; const {csrfToken} = window.config;

@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initCompReactionSelector(parent) { export function initCompReactionSelector(parent) {

@ -1,3 +1,4 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
const {appSubUrl} = window.config; const {appSubUrl} = window.config;

@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initCompWebHookEditor() { export function initCompWebHookEditor() {

@ -1,5 +1,5 @@
import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import ContextPopup from '../components/ContextPopup.vue'; import ContextPopup from '../components/ContextPopup.vue';
import {parseIssueHref} from '../utils.js'; import {parseIssueHref} from '../utils.js';

@ -1,5 +1,4 @@
import Vue from 'vue'; import Vue from 'vue';
import ActivityHeatmap from '../components/ActivityHeatmap.vue'; import ActivityHeatmap from '../components/ActivityHeatmap.vue';
export default function initHeatmap() { export default function initHeatmap() {

@ -1,3 +1,5 @@
import $ from 'jquery';
function getDefaultSvgBoundsIfUndefined(svgXml, src) { function getDefaultSvgBoundsIfUndefined(svgXml, src) {
const DefaultSize = 300; const DefaultSize = 300;
const MaxSize = 99999; const MaxSize = 99999;

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initInstall() { export function initInstall() {
if ($('.page-content.install').length === 0) { if ($('.page-content.install').length === 0) {
return; return;

@ -1,5 +1,6 @@
const {appSubUrl, csrfToken, notificationSettings} = window.config; import $ from 'jquery';
const {appSubUrl, csrfToken, notificationSettings} = window.config;
let notificationSequenceNumber = 0; let notificationSequenceNumber = 0;
export function initNotificationsTable() { export function initNotificationsTable() {

@ -1,3 +1,5 @@
import $ from 'jquery';
const {appSubUrl} = window.config; const {appSubUrl} = window.config;
export function initOrgTeamSettings() { export function initOrgTeamSettings() {

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initRepoBranchButton() { export function initRepoBranchButton() {
$('.show-create-branch-modal.button').on('click', function () { $('.show-create-branch-modal.button').on('click', function () {
$('#create-branch-form')[0].action = $('#create-branch-form').data('base-action') + $(this).data('branch-from-urlcomponent'); $('#create-branch-form')[0].action = $('#create-branch-form').data('base-action') + $(this).data('branch-from-urlcomponent');

@ -1,3 +1,4 @@
import $ from 'jquery';
import {svg} from '../svg.js'; import {svg} from '../svg.js';
function changeHash(hash) { function changeHash(hash) {

@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initRepoEllipsisButton() { export function initRepoEllipsisButton() {

@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
function getArchive($target, url, first) { function getArchive($target, url, first) {

@ -1,6 +1,8 @@
import $ from 'jquery';
import {initCompReactionSelector} from './comp/ReactionSelector.js'; import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js'; import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {validateTextareaNonEmpty} from './comp/EasyMDE.js'; import {validateTextareaNonEmpty} from './comp/EasyMDE.js';
const {csrfToken} = window.config; const {csrfToken} = window.config;
export function initRepoDiffReviewButton() { export function initRepoDiffReviewButton() {

@ -1,9 +1,9 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
import {initMarkupContent} from '../markup/content.js'; import {initMarkupContent} from '../markup/content.js';
import {createCodeEditor} from './codeeditor.js'; import {createCodeEditor} from './codeeditor.js';
const {csrfToken} = window.config; const {csrfToken} = window.config;
let previewFileModes; let previewFileModes;
function initEditPreviewTab($form) { function initEditPreviewTab($form) {

@ -1,3 +1,5 @@
import $ from 'jquery';
export default function initRepoGraphGit() { export default function initRepoGraphGit() {
const graphContainer = document.getElementById('git-graph-container'); const graphContainer = document.getElementById('git-graph-container');
if (!graphContainer) return; if (!graphContainer) return;

@ -1,3 +1,4 @@
import $ from 'jquery';
import {stripTags} from '../utils.js'; import {stripTags} from '../utils.js';
const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;

@ -1,7 +1,7 @@
import $ from 'jquery';
import {svg} from '../svg.js'; import {svg} from '../svg.js';
const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;
let i18nTextEdited; let i18nTextEdited;
let i18nTextOptions; let i18nTextOptions;
let i18nTextDeleteFromHistory; let i18nTextDeleteFromHistory;

@ -1,3 +1,4 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
import attachTribute from './tribute.js'; import attachTribute from './tribute.js';
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js'; import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';

@ -1,3 +1,4 @@
import $ from 'jquery';
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js'; import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initCompImagePaste, initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {initCompImagePaste, initEasyMDEImagePaste} from './comp/ImagePaste.js';

@ -1,3 +1,5 @@
import $ from 'jquery';
const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;
export function initRepoMigrationStatusChecker() { export function initRepoMigrationStatusChecker() {

@ -1,3 +1,5 @@
import $ from 'jquery';
const $service = $('#service_type'); const $service = $('#service_type');
const $user = $('#auth_username'); const $user = $('#auth_username');
const $pass = $('#auth_password'); const $pass = $('#auth_password');

@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config; const {csrfToken} = window.config;
function moveIssue({item, from, to, oldIndex}) { function moveIssue({item, from, to, oldIndex}) {

@ -1,3 +1,4 @@
import $ from 'jquery';
import attachTribute from './tribute.js'; import attachTribute from './tribute.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js';

@ -1,3 +1,4 @@
import $ from 'jquery';
import {createMonaco} from './codeeditor.js'; import {createMonaco} from './codeeditor.js';
import {initRepoCommonFilterSearchDropdown} from './repo-common.js'; import {initRepoCommonFilterSearchDropdown} from './repo-common.js';

@ -1,3 +1,4 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat'; import {htmlEscape} from 'escape-goat';
const {appSubUrl} = window.config; const {appSubUrl} = window.config;

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initUnicodeEscapeButton() { export function initUnicodeEscapeButton() {
$(document).on('click', 'a.escape-button', (e) => { $(document).on('click', 'a.escape-button', (e) => {
e.preventDefault(); e.preventDefault();

@ -1,3 +1,4 @@
import $ from 'jquery';
import {initMarkupContent} from '../markup/content.js'; import {initMarkupContent} from '../markup/content.js';
import {attachEasyMDEToElements, importEasyMDE, validateTextareaNonEmpty} from './comp/EasyMDE.js'; import {attachEasyMDEToElements, importEasyMDE, validateTextareaNonEmpty} from './comp/EasyMDE.js';
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initSshKeyFormParser() { export function initSshKeyFormParser() {
// Parse SSH Key // Parse SSH Key
$('#ssh-key-content').on('change paste keyup', function () { $('#ssh-key-content').on('change paste keyup', function () {

@ -1,6 +1,7 @@
import $ from 'jquery';
import prettyMilliseconds from 'pretty-ms'; import prettyMilliseconds from 'pretty-ms';
const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.config;
const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.config;
let updateTimeInterval = null; // holds setInterval id when active let updateTimeInterval = null; // holds setInterval id when active
export function initStopwatch() { export function initStopwatch() {

@ -1,8 +1,8 @@
import $ from 'jquery';
import {encode, decode} from 'uint8-to-base64'; import {encode, decode} from 'uint8-to-base64';
const {appSubUrl, csrfToken} = window.config; const {appSubUrl, csrfToken} = window.config;
export function initUserAuthWebAuthn() { export function initUserAuthWebAuthn() {
if ($('.user.signin.webauthn-prompt').length === 0) { if ($('.user.signin.webauthn-prompt').length === 0) {
return; return;

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initUserAuthOauth2() { export function initUserAuthOauth2() {
const $oauth2LoginNav = $('#oauth2-login-navigator'); const $oauth2LoginNav = $('#oauth2-login-navigator');
if ($oauth2LoginNav.length === 0) return; if ($oauth2LoginNav.length === 0) return;

@ -1,3 +1,5 @@
import $ from 'jquery';
export function initUserSettings() { export function initUserSettings() {
if ($('.user.settings.profile').length > 0) { if ($('.user.settings.profile').length > 0) {
$('#username').on('keyup', function () { $('#username').on('keyup', function () {

@ -1,5 +1,6 @@
import './publicpath.js'; import './publicpath.js';
import $ from 'jquery';
import {initVueEnv} from './components/VueComponentLoader.js'; import {initVueEnv} from './components/VueComponentLoader.js';
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue'; import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
import {initDashboardRepoList} from './components/DashboardRepoList.js'; import {initDashboardRepoList} from './components/DashboardRepoList.js';

@ -1,3 +1,7 @@
import $ from 'jquery';
const preventListener = (e) => e.preventDefault();
/** /**
* Attaches `input` handlers to markdown rendered tasklist checkboxes in comments. * Attaches `input` handlers to markdown rendered tasklist checkboxes in comments.
* *
@ -5,9 +9,6 @@
* is set accordingly and sent to the server. On success it updates the raw-content on * is set accordingly and sent to the server. On success it updates the raw-content on
* error it resets the checkbox to its original value. * error it resets the checkbox to its original value.
*/ */
const preventListener = (e) => e.preventDefault();
export function initMarkupTasklist() { export function initMarkupTasklist() {
for (const el of document.querySelectorAll(`.markup[data-can-edit=true]`) || []) { for (const el of document.querySelectorAll(`.markup[data-can-edit=true]`) || []) {
const container = el.parentNode; const container = el.parentNode;

Loading…
Cancel
Save