Skip to content

Commit 3a7454d

Browse files
silverwindGiteaBot
andauthored
Enable no-jquery/no-class-state (#31639)
Just 4 validations and I specifically tested this by selecting/unselecting issue labels. Co-authored-by: Giteabot <teabot@gitea.io>
1 parent e8d4b7a commit 3a7454d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.eslintrc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ rules:
512512
no-jquery/no-box-model: [2]
513513
no-jquery/no-browser: [2]
514514
no-jquery/no-camel-case: [2]
515-
no-jquery/no-class-state: [0]
515+
no-jquery/no-class-state: [2]
516516
no-jquery/no-class: [0]
517517
no-jquery/no-clone: [2]
518518
no-jquery/no-closest: [0]

web_src/js/features/repo-legacy.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function initRepoCommentForm() {
125125

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

@@ -140,15 +140,15 @@ export function initRepoCommentForm() {
140140
if (this.getAttribute('data-scope') !== scope) {
141141
return true;
142142
}
143-
if (this !== clickedItem && !$(this).hasClass('checked')) {
143+
if (this !== clickedItem && !this.classList.contains('checked')) {
144144
return true;
145145
}
146146
} else if (this !== clickedItem) {
147147
// Toggle for other labels
148148
return true;
149149
}
150150

151-
if ($(this).hasClass('checked')) {
151+
if (this.classList.contains('checked')) {
152152
$(this).removeClass('checked');
153153
$(this).find('.octicon-check').addClass('tw-invisible');
154154
if (hasUpdateAction) {
@@ -187,7 +187,7 @@ export function initRepoCommentForm() {
187187

188188
const listIds = [];
189189
$(this).parent().find('.item').each(function () {
190-
if ($(this).hasClass('checked')) {
190+
if (this.classList.contains('checked')) {
191191
listIds.push($(this).data('id'));
192192
$($(this).data('id-selector')).removeClass('tw-hidden');
193193
} else {

0 commit comments

Comments
 (0)