Skip to content

Commit

Permalink
Enable no-jquery/no-class-state (#31639)
Browse files Browse the repository at this point in the history
Just 4 validations and I specifically tested this by
selecting/unselecting issue labels.

Co-authored-by: Giteabot <teabot@gitea.io>
  • Loading branch information
silverwind and GiteaBot authored Jul 16, 2024
1 parent e8d4b7a commit 3a7454d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ rules:
no-jquery/no-box-model: [2]
no-jquery/no-browser: [2]
no-jquery/no-camel-case: [2]
no-jquery/no-class-state: [0]
no-jquery/no-class-state: [2]
no-jquery/no-class: [0]
no-jquery/no-clone: [2]
no-jquery/no-closest: [0]
Expand Down
8 changes: 4 additions & 4 deletions web_src/js/features/repo-legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function initRepoCommentForm() {

$listMenu.find('.item:not(.no-select)').on('click', function (e) {
e.preventDefault();
if ($(this).hasClass('ban-change')) {
if (this.classList.contains('ban-change')) {
return false;
}

Expand All @@ -140,15 +140,15 @@ export function initRepoCommentForm() {
if (this.getAttribute('data-scope') !== scope) {
return true;
}
if (this !== clickedItem && !$(this).hasClass('checked')) {
if (this !== clickedItem && !this.classList.contains('checked')) {
return true;
}
} else if (this !== clickedItem) {
// Toggle for other labels
return true;
}

if ($(this).hasClass('checked')) {
if (this.classList.contains('checked')) {
$(this).removeClass('checked');
$(this).find('.octicon-check').addClass('tw-invisible');
if (hasUpdateAction) {
Expand Down Expand Up @@ -187,7 +187,7 @@ export function initRepoCommentForm() {

const listIds = [];
$(this).parent().find('.item').each(function () {
if ($(this).hasClass('checked')) {
if (this.classList.contains('checked')) {
listIds.push($(this).data('id'));
$($(this).data('id-selector')).removeClass('tw-hidden');
} else {
Expand Down

0 comments on commit 3a7454d

Please sign in to comment.