mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-22 01:44:24 +01: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-box-model: [2]
|
||||||
no-jquery/no-browser: [2]
|
no-jquery/no-browser: [2]
|
||||||
no-jquery/no-camel-case: [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-class: [0]
|
||||||
no-jquery/no-clone: [2]
|
no-jquery/no-clone: [2]
|
||||||
no-jquery/no-closest: [0]
|
no-jquery/no-closest: [0]
|
||||||
|
|
|
@ -64,7 +64,7 @@ export function initRepoCommentForm() {
|
||||||
function initBranchSelector() {
|
function initBranchSelector() {
|
||||||
const $selectBranch = $('.ui.select-branch');
|
const $selectBranch = $('.ui.select-branch');
|
||||||
const $branchMenu = $selectBranch.find('.reference-list-menu');
|
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 () {
|
$branchMenu.find('.item:not(.no-select)').on('click', async function () {
|
||||||
const selectedValue = $(this).data('id');
|
const selectedValue = $(this).data('id');
|
||||||
const editMode = $('#editing_mode').val();
|
const editMode = $('#editing_mode').val();
|
||||||
|
@ -132,7 +132,7 @@ export function initRepoCommentForm() {
|
||||||
|
|
||||||
$listMenu.find('.item:not(.no-select)').on('click', function (e) {
|
$listMenu.find('.item:not(.no-select)').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if ($(this).hasClass('ban-change')) {
|
if (this.classList.contains('ban-change')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ export function initRepoCommentForm() {
|
||||||
if (this.getAttribute('data-scope') !== scope) {
|
if (this.getAttribute('data-scope') !== scope) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this !== clickedItem && !$(this).hasClass('checked')) {
|
if (this !== clickedItem && !this.classList.contains('checked')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (this !== clickedItem) {
|
} else if (this !== clickedItem) {
|
||||||
|
@ -155,7 +155,7 @@ export function initRepoCommentForm() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($(this).hasClass('checked')) {
|
if (this.classList.contains('checked')) {
|
||||||
$(this).removeClass('checked');
|
$(this).removeClass('checked');
|
||||||
$(this).find('.octicon-check').addClass('tw-invisible');
|
$(this).find('.octicon-check').addClass('tw-invisible');
|
||||||
if (hasUpdateAction) {
|
if (hasUpdateAction) {
|
||||||
|
@ -194,7 +194,7 @@ export function initRepoCommentForm() {
|
||||||
|
|
||||||
const listIds = [];
|
const listIds = [];
|
||||||
$(this).parent().find('.item').each(function () {
|
$(this).parent().find('.item').each(function () {
|
||||||
if ($(this).hasClass('checked')) {
|
if (this.classList.contains('checked')) {
|
||||||
listIds.push($(this).data('id'));
|
listIds.push($(this).data('id'));
|
||||||
$($(this).data('id-selector')).removeClass('tw-hidden');
|
$($(this).data('id-selector')).removeClass('tw-hidden');
|
||||||
} else {
|
} else {
|
||||||
|
@ -605,7 +605,7 @@ function initRepoIssueCommentEdit() {
|
||||||
const quote = $(`#${target}`).text().replace(/\n/g, '\n> ');
|
const quote = $(`#${target}`).text().replace(/\n/g, '\n> ');
|
||||||
const content = `> ${quote}\n\n`;
|
const content = `> ${quote}\n\n`;
|
||||||
let editor;
|
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');
|
const $replyBtn = $(this).closest('.comment-code-cloud').find('button.comment-form-reply');
|
||||||
editor = await handleReply($replyBtn);
|
editor = await handleReply($replyBtn);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue