mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-27 23:25:22 +00:00
[PORT] Enable no-jquery/no-class-state
(gitea#31639)
Just 4 validations and I specifically tested this by selecting/unselecting issue labels. Co-authored-by: Giteabot <teabot@gitea.io> --- Clean port. Fixed two additional warnings (cherry picked from commit 3a7454df7a518f810fbeb34b9d784e7c29d173ff)
This commit is contained in:
parent
04cd89709c
commit
98349a1889
|
@ -354,7 +354,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]
|
||||
|
|
|
@ -64,7 +64,7 @@ export function initRepoCommentForm() {
|
|||
function initBranchSelector() {
|
||||
const $selectBranch = $('.ui.select-branch');
|
||||
const $branchMenu = $selectBranch.find('.reference-list-menu');
|
||||
const $isNewIssue = $branchMenu.hasClass('new-issue');
|
||||
const $isNewIssue = $branchMenu[0]?.classList.contains('new-issue');
|
||||
$branchMenu.find('.item:not(.no-select)').on('click', async function () {
|
||||
const selectedValue = $(this).data('id');
|
||||
const editMode = $('#editing_mode').val();
|
||||
|
@ -132,7 +132,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;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ 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) {
|
||||
|
@ -155,7 +155,7 @@ export function initRepoCommentForm() {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ($(this).hasClass('checked')) {
|
||||
if (this.classList.contains('checked')) {
|
||||
$(this).removeClass('checked');
|
||||
$(this).find('.octicon-check').addClass('tw-invisible');
|
||||
if (hasUpdateAction) {
|
||||
|
@ -194,7 +194,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 {
|
||||
|
@ -605,7 +605,7 @@ function initRepoIssueCommentEdit() {
|
|||
const quote = $(`#${target}`).text().replace(/\n/g, '\n> ');
|
||||
const content = `> ${quote}\n\n`;
|
||||
let editor;
|
||||
if ($(this).hasClass('quote-reply-diff')) {
|
||||
if (this.classList.contains('quote-reply-diff')) {
|
||||
const $replyBtn = $(this).closest('.comment-code-cloud').find('button.comment-form-reply');
|
||||
editor = await handleReply($replyBtn);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue