diff options
-rw-r--r-- | .eslintrc.yaml | 2 | ||||
-rw-r--r-- | package-lock.json | 10 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | web_src/js/features/admin/common.js | 4 | ||||
-rw-r--r-- | web_src/js/features/admin/users.js | 8 | ||||
-rw-r--r-- | web_src/js/features/citation.js | 2 | ||||
-rw-r--r-- | web_src/js/features/common-global.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-common.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-issue.js | 4 | ||||
-rw-r--r-- | web_src/js/features/repo-legacy.js | 2 | ||||
-rw-r--r-- | web_src/js/features/repo-projects.js | 4 | ||||
-rw-r--r-- | web_src/js/features/user-auth.js | 2 |
12 files changed, 28 insertions, 15 deletions
diff --git a/.eslintrc.yaml b/.eslintrc.yaml index bb7e7c09a8..a3a89e76d4 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -12,6 +12,7 @@ plugins: - eslint-plugin-unicorn - eslint-plugin-import - eslint-plugin-jquery + - eslint-plugin-no-jquery - eslint-plugin-sonarjs - eslint-plugin-custom-elements @@ -192,6 +193,7 @@ rules: jquery/no-val: [0] jquery/no-when: [2] jquery/no-wrap: [2] + no-jquery/no-event-shorthand: [2] key-spacing: [2] keyword-spacing: [2] line-comment-position: [0] diff --git a/package-lock.json b/package-lock.json index 3e8e35615f..9a2f5dc578 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,6 +64,7 @@ "eslint-plugin-custom-elements": "0.0.8", "eslint-plugin-import": "2.27.5", "eslint-plugin-jquery": "1.5.1", + "eslint-plugin-no-jquery": "2.7.0", "eslint-plugin-sonarjs": "0.19.0", "eslint-plugin-unicorn": "46.0.0", "eslint-plugin-vue": "9.11.0", @@ -4550,6 +4551,15 @@ "eslint": ">=5.4.0" } }, + "node_modules/eslint-plugin-no-jquery": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-jquery/-/eslint-plugin-no-jquery-2.7.0.tgz", + "integrity": "sha512-Aeg7dA6GTH1AcWLlBtWNzOU9efK5KpNi7b0EhBO0o0M+awyzguUUo8gF6hXGjQ9n5h8/uRtYv9zOqQkeC5CG0w==", + "dev": true, + "peerDependencies": { + "eslint": ">=2.3.0" + } + }, "node_modules/eslint-plugin-sonarjs": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.19.0.tgz", diff --git a/package.json b/package.json index cca95a1646..ae3b7446fe 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "eslint-plugin-custom-elements": "0.0.8", "eslint-plugin-import": "2.27.5", "eslint-plugin-jquery": "1.5.1", + "eslint-plugin-no-jquery": "2.7.0", "eslint-plugin-sonarjs": "0.19.0", "eslint-plugin-unicorn": "46.0.0", "eslint-plugin-vue": "9.11.0", diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index 8f895152c7..84fd35e081 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -21,7 +21,7 @@ export function initAdminCommon() { $('#login_name').removeAttr('required'); hideElem($('.non-local')); showElem($('.local')); - $('#user_name').focus(); + $('#user_name').trigger('focus'); if ($(this).data('password') === 'required') { $('#password').attr('required', 'required'); @@ -33,7 +33,7 @@ export function initAdminCommon() { $('#login_name').attr('required', 'required'); showElem($('.non-local')); hideElem($('.local')); - $('#login_name').focus(); + $('#login_name').trigger('focus'); $('#password').removeAttr('required'); } diff --git a/web_src/js/features/admin/users.js b/web_src/js/features/admin/users.js index 2221fc4929..c8edaab549 100644 --- a/web_src/js/features/admin/users.js +++ b/web_src/js/features/admin/users.js @@ -16,19 +16,19 @@ export function initAdminUserListSearchForm() { } } - $form.find(`input[type=radio]`).click(() => { - $form.submit(); + $form.find(`input[type=radio]`).on('click', () => { + $form.trigger('submit'); return false; }); - $form.find('.j-reset-status-filter').click(() => { + $form.find('.j-reset-status-filter').on('click', () => { $form.find(`input[type=radio]`).each((_, e) => { const $e = $(e); if ($e.attr('name').startsWith('status_filter[')) { $e.prop('checked', false); } }); - $form.submit(); + $form.trigger('submit'); return false; }); } diff --git a/web_src/js/features/citation.js b/web_src/js/features/citation.js index c40b1adddd..65666864f6 100644 --- a/web_src/js/features/citation.js +++ b/web_src/js/features/citation.js @@ -51,7 +51,7 @@ export function initCitationFileCopyContent() { }); $inputContent.on('click', () => { - $inputContent.select(); + $inputContent.trigger('select'); }); $('#cite-repo-button').on('click', () => { diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 0d80dc2091..16aedc6433 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -68,7 +68,7 @@ export function initGlobalButtonClickOnEnter() { export function initGlobalCommon() { // Undo Safari emoji glitch fix at high enough zoom levels if (navigator.userAgent.match('Safari')) { - $(window).resize(() => { + $(window).on('resize', () => { const px = mqBinarySearch('width', 0, 4096, 1, 'px'); const em = mqBinarySearch('width', 0, 1024, 0.01, 'em'); if (em * 16 * 1.25 - px <= -1) { diff --git a/web_src/js/features/repo-common.js b/web_src/js/features/repo-common.js index 1a32d7cb64..d99a1a8da0 100644 --- a/web_src/js/features/repo-common.js +++ b/web_src/js/features/repo-common.js @@ -69,7 +69,7 @@ export function initRepoCloneLink() { }); $inputLink.on('focus', () => { - $inputLink.select(); + $inputLink.trigger('select'); }); } diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index a6105f7b24..63fae3a37c 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -313,7 +313,7 @@ export function initRepoIssueWipTitle() { e.preventDefault(); const $issueTitle = $('#issue_title'); - $issueTitle.focus(); + $issueTitle.trigger('focus'); const value = $issueTitle.val().trim().toUpperCase(); const wipPrefixes = $('.title_wip_desc').data('wip-prefixes'); @@ -573,7 +573,7 @@ export function initRepoIssueTitleEdit() { toggleElem($('#pull-desc-edit')); toggleElem($('.in-edit')); $('#issue-title-wrapper').toggleClass('edit-active'); - $editInput.focus(); + $editInput.trigger('focus'); return false; }; diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 8ac8cd15c1..851a9b855e 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -57,7 +57,7 @@ export function initRepoCommentForm() { const $selectBranch = $('.ui.select-branch'); const $branchMenu = $selectBranch.find('.reference-list-menu'); const $isNewIssue = $branchMenu.hasClass('new-issue'); - $branchMenu.find('.item:not(.no-select)').click(function () { + $branchMenu.find('.item:not(.no-select)').on('click', function () { const selectedValue = $(this).data('id'); const editMode = $('#editing_mode').val(); $($(this).data('id-selector')).val(selectedValue); diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index a2679130d7..953671b41d 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -153,7 +153,7 @@ export function initRepoProject() { }); $('.delete-project-board').each(function () { - $(this).click(function (e) { + $(this).on('click', function (e) { e.preventDefault(); $.ajax({ @@ -169,7 +169,7 @@ export function initRepoProject() { }); }); - $('#new_board_submit').click(function (e) { + $('#new_board_submit').on('click', function (e) { e.preventDefault(); const boardTitle = $('#new_board'); diff --git a/web_src/js/features/user-auth.js b/web_src/js/features/user-auth.js index 34e773fe7d..60ea14dfaa 100644 --- a/web_src/js/features/user-auth.js +++ b/web_src/js/features/user-auth.js @@ -5,7 +5,7 @@ export function initUserAuthOauth2() { const $oauth2LoginNav = $('#oauth2-login-navigator'); if ($oauth2LoginNav.length === 0) return; - $oauth2LoginNav.find('.oauth-login-image').click(() => { + $oauth2LoginNav.find('.oauth-login-image').on('click', () => { const oauthLoader = $('#oauth2-login-loader'); const oauthNav = $('#oauth2-login-navigator'); |