Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce eslint-plugin-no-jquery/no-event-shorthand #24198

Merged
merged 6 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/admin/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
}
Expand Down
8 changes: 4 additions & 4 deletions web_src/js/features/admin/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
2 changes: 1 addition & 1 deletion web_src/js/features/citation.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function initCitationFileCopyContent() {
});

$inputContent.on('click', () => {
$inputContent.select();
$inputContent.trigger('select');
});

$('#cite-repo-button').on('click', () => {
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/common-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/repo-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function initRepoCloneLink() {
});

$inputLink.on('focus', () => {
$inputLink.select();
$inputLink.trigger('select');
});
}

Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/repo-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
};

Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/repo-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/repo-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export function initRepoProject() {
});

$('.delete-project-board').each(function () {
$(this).click(function (e) {
$(this).on('click', function (e) {
e.preventDefault();

$.ajax({
Expand All @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion web_src/js/features/user-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down