Skip to content

Commit 19b017f

Browse files
authored
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
1 parent 7b04c97 commit 19b017f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+76
-18
lines changed

.eslintrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ env:
2323

2424
globals:
2525
__webpack_public_path__: true
26-
CodeMirror: false
27-
Dropzone: false
28-
SimpleMDE: false
2926

3027
settings:
3128
html/html-extensions: [".tmpl"]
@@ -34,7 +31,6 @@ overrides:
3431
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
3532
env:
3633
browser: true
37-
jquery: true
3834
node: false
3935
- files: ["templates/**/*.tmpl"]
4036
rules:

web_src/js/components/ContextPopup.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</template>
2525

2626
<script>
27+
import $ from 'jquery';
2728
import {SvgIcon} from '../svg.js';
2829
2930
const {appSubUrl, i18n} = window.config;

web_src/js/components/DashboardRepoList.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Vue from 'vue';
2+
import $ from 'jquery';
23
import {initVueSvg, vueDelimiters} from './VueComponentLoader.js';
34

45
const {appSubUrl, assetUrlPrefix, pageData} = window.config;

web_src/js/components/RepoBranchTagDropdown.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Vue from 'vue';
2+
import $ from 'jquery';
23
import {vueDelimiters} from './VueComponentLoader.js';
34

45
export function initRepoBranchTagDropdown(selector) {

web_src/js/features/admin-common.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {csrfToken} = window.config;
24

35
export function initAdminCommon() {

web_src/js/features/admin-emails.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initAdminEmails() {
24
function linkEmailAction(e) {
35
const $this = $(this);

web_src/js/features/admin-users.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initAdminUserListSearchForm() {
24
const searchForm = window.config.pageData.adminUserListSearchForm;
35
if (!searchForm) return;

web_src/js/features/clipboard.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {copy_success, copy_error} = window.config.i18n;
24

35
function onSuccess(btn) {

web_src/js/features/common-global.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import $ from 'jquery';
2+
import 'jquery.are-you-sure';
13
import {mqBinarySearch} from '../utils.js';
24
import createDropzone from './dropzone.js';
35
import {initCompColorPicker} from './comp/ColorPicker.js';
46

5-
import 'jquery.are-you-sure';
6-
77
const {csrfToken} = window.config;
88

99
export function initGlobalFormDirtyLeaveConfirm() {

web_src/js/features/common-issue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {updateIssuesMeta} from './repo-issue.js';
23

34
export function initCommonIssue() {

web_src/js/features/common-organization.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {initCompLabelEdit} from './comp/LabelEdit.js';
23

34
export function initCommonOrganization() {

web_src/js/features/comp/ColorPicker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import createColorPicker from '../colorpicker.js';
23

34
export function initCompColorPicker() {

web_src/js/features/comp/EasyMDE.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import attachTribute from '../tribute.js';
23

34
const {appSubUrl} = window.config;
@@ -54,7 +55,7 @@ export async function importEasyMDE() {
5455
* @returns {null|EasyMDE}
5556
*/
5657
export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
57-
if (textarea instanceof jQuery) {
58+
if (textarea instanceof $) {
5859
textarea = textarea[0];
5960
}
6061
if (!textarea) {
@@ -151,7 +152,7 @@ export function attachEasyMDEToElements(easyMDE) {
151152
* @returns {null|EasyMDE}
152153
*/
153154
export function getAttachedEasyMDE(el) {
154-
if (el instanceof jQuery) {
155+
if (el instanceof $) {
155156
el = el[0];
156157
}
157158
if (!el) {

web_src/js/features/comp/ImagePaste.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
const {csrfToken} = window.config;
23

34
async function uploadFile(file, uploadUrl) {

web_src/js/features/comp/LabelEdit.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {initCompColorPicker} from './ColorPicker.js';
23

34
export function initCompLabelEdit(selector) {

web_src/js/features/comp/MarkupContentPreview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {initMarkupContent} from '../../markup/content.js';
23

34
const {csrfToken} = window.config;

web_src/js/features/comp/ReactionSelector.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
const {csrfToken} = window.config;
23

34
export function initCompReactionSelector(parent) {

web_src/js/features/comp/SearchUserBox.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {htmlEscape} from 'escape-goat';
23

34
const {appSubUrl} = window.config;

web_src/js/features/comp/WebHookEditor.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
const {csrfToken} = window.config;
23

34
export function initCompWebHookEditor() {

web_src/js/features/contextpopup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import $ from 'jquery';
12
import Vue from 'vue';
2-
33
import ContextPopup from '../components/ContextPopup.vue';
44
import {parseIssueHref} from '../utils.js';
55

web_src/js/features/heatmap.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Vue from 'vue';
2-
32
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
43

54
export default function initHeatmap() {

web_src/js/features/imagediff.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
function getDefaultSvgBoundsIfUndefined(svgXml, src) {
24
const DefaultSize = 300;
35
const MaxSize = 99999;

web_src/js/features/install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initInstall() {
24
if ($('.page-content.install').length === 0) {
35
return;

web_src/js/features/notification.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const {appSubUrl, csrfToken, notificationSettings} = window.config;
1+
import $ from 'jquery';
22

3+
const {appSubUrl, csrfToken, notificationSettings} = window.config;
34
let notificationSequenceNumber = 0;
45

56
export function initNotificationsTable() {

web_src/js/features/org-team.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {appSubUrl} = window.config;
24

35
export function initOrgTeamSettings() {

web_src/js/features/repo-branch.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initRepoBranchButton() {
24
$('.show-create-branch-modal.button').on('click', function () {
35
$('#create-branch-form')[0].action = $('#create-branch-form').data('base-action') + $(this).data('branch-from-urlcomponent');

web_src/js/features/repo-code.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {svg} from '../svg.js';
23

34
function changeHash(hash) {

web_src/js/features/repo-commit.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {csrfToken} = window.config;
24

35
export function initRepoEllipsisButton() {

web_src/js/features/repo-common.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {csrfToken} = window.config;
24

35
function getArchive($target, url, first) {

web_src/js/features/repo-diff.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import $ from 'jquery';
12
import {initCompReactionSelector} from './comp/ReactionSelector.js';
23
import {initRepoIssueContentHistory} from './repo-issue-content.js';
34
import {validateTextareaNonEmpty} from './comp/EasyMDE.js';
5+
46
const {csrfToken} = window.config;
57

68
export function initRepoDiffReviewButton() {

web_src/js/features/repo-editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import $ from 'jquery';
12
import {htmlEscape} from 'escape-goat';
23
import {initMarkupContent} from '../markup/content.js';
34
import {createCodeEditor} from './codeeditor.js';
45

56
const {csrfToken} = window.config;
6-
77
let previewFileModes;
88

99
function initEditPreviewTab($form) {

web_src/js/features/repo-graph.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export default function initRepoGraphGit() {
24
const graphContainer = document.getElementById('git-graph-container');
35
if (!graphContainer) return;

web_src/js/features/repo-home.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {stripTags} from '../utils.js';
23

34
const {appSubUrl, csrfToken} = window.config;

web_src/js/features/repo-issue-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import $ from 'jquery';
12
import {svg} from '../svg.js';
23

34
const {appSubUrl, csrfToken} = window.config;
4-
55
let i18nTextEdited;
66
let i18nTextOptions;
77
let i18nTextDeleteFromHistory;

web_src/js/features/repo-issue.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {htmlEscape} from 'escape-goat';
23
import attachTribute from './tribute.js';
34
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';

web_src/js/features/repo-legacy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
23
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
34
import {initCompImagePaste, initEasyMDEImagePaste} from './comp/ImagePaste.js';

web_src/js/features/repo-migrate.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {appSubUrl, csrfToken} = window.config;
24

35
export function initRepoMigrationStatusChecker() {

web_src/js/features/repo-migration.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const $service = $('#service_type');
24
const $user = $('#auth_username');
35
const $pass = $('#auth_password');

web_src/js/features/repo-projects.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
const {csrfToken} = window.config;
24

35
function moveIssue({item, from, to, oldIndex}) {

web_src/js/features/repo-release.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import attachTribute from './tribute.js';
23
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
34
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';

web_src/js/features/repo-settings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {createMonaco} from './codeeditor.js';
23
import {initRepoCommonFilterSearchDropdown} from './repo-common.js';
34

web_src/js/features/repo-template.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {htmlEscape} from 'escape-goat';
23

34
const {appSubUrl} = window.config;

web_src/js/features/repo-unicode-escape.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initUnicodeEscapeButton() {
24
$(document).on('click', 'a.escape-button', (e) => {
35
e.preventDefault();

web_src/js/features/repo-wiki.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import $ from 'jquery';
12
import {initMarkupContent} from '../markup/content.js';
23
import {attachEasyMDEToElements, importEasyMDE, validateTextareaNonEmpty} from './comp/EasyMDE.js';
34
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';

web_src/js/features/sshkey-helper.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initSshKeyFormParser() {
24
// Parse SSH Key
35
$('#ssh-key-content').on('change paste keyup', function () {

web_src/js/features/stopwatch.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import $ from 'jquery';
12
import prettyMilliseconds from 'pretty-ms';
2-
const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.config;
33

4+
const {appSubUrl, csrfToken, notificationSettings, enableTimeTracking} = window.config;
45
let updateTimeInterval = null; // holds setInterval id when active
56

67
export function initStopwatch() {

web_src/js/features/user-auth-webauthn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import $ from 'jquery';
12
import {encode, decode} from 'uint8-to-base64';
23

34
const {appSubUrl, csrfToken} = window.config;
45

5-
66
export function initUserAuthWebAuthn() {
77
if ($('.user.signin.webauthn-prompt').length === 0) {
88
return;

web_src/js/features/user-auth.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initUserAuthOauth2() {
24
const $oauth2LoginNav = $('#oauth2-login-navigator');
35
if ($oauth2LoginNav.length === 0) return;

web_src/js/features/user-settings.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import $ from 'jquery';
2+
13
export function initUserSettings() {
24
if ($('.user.settings.profile').length > 0) {
35
$('#username').on('keyup', function () {

web_src/js/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import './publicpath.js';
22

3+
import $ from 'jquery';
34
import {initVueEnv} from './components/VueComponentLoader.js';
45
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
56
import {initDashboardRepoList} from './components/DashboardRepoList.js';

web_src/js/markup/tasklist.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
import $ from 'jquery';
2+
3+
const preventListener = (e) => e.preventDefault();
4+
15
/**
26
* Attaches `input` handlers to markdown rendered tasklist checkboxes in comments.
37
*
48
* When a checkbox value changes, the corresponding [ ] or [x] in the markdown string
59
* is set accordingly and sent to the server. On success it updates the raw-content on
610
* error it resets the checkbox to its original value.
711
*/
8-
9-
const preventListener = (e) => e.preventDefault();
10-
1112
export function initMarkupTasklist() {
1213
for (const el of document.querySelectorAll(`.markup[data-can-edit=true]`) || []) {
1314
const container = el.parentNode;

0 commit comments

Comments
 (0)