0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-01 12:03:36 +01:00

address TS review

This commit is contained in:
m.huber 2024-11-11 17:28:06 +01:00
parent 3614fad595
commit f0658d3ec4

View file

@ -2,9 +2,7 @@ import {createSortable} from '../modules/sortable.ts';
import {POST} from '../modules/fetch.ts'; import {POST} from '../modules/fetch.ts';
export function initRepoBranchesSettings() { export function initRepoBranchesSettings() {
const protectedBranchesList = document.querySelector( const protectedBranchesList = document.querySelector('#protected-branches-list');
'#protected-branches-list',
);
if (!protectedBranchesList) return; if (!protectedBranchesList) return;
createSortable(protectedBranchesList, { createSortable(protectedBranchesList, {
@ -13,7 +11,7 @@ export function initRepoBranchesSettings() {
onEnd: async () => { // eslint-disable-line @typescript-eslint/no-misused-promises onEnd: async () => { // eslint-disable-line @typescript-eslint/no-misused-promises
const newOrder = Array.from(protectedBranchesList.children, (item) => { const newOrder = Array.from(protectedBranchesList.children, (item) => {
const id = item.getAttribute('data-id'); const id = item.getAttribute('data-id');
return id ? parseInt(id) : NaN; return parseInt(id);
}).filter((id) => !Number.isNaN(id)); }).filter((id) => !Number.isNaN(id));
try { try {