[build] upgrade eslint to 9.37.0 (#88)

Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Reviewed-on: https://codeberg.org/superseriousbusiness/masto-fe-standalone/pulls/88
Co-authored-by: Zoë Bijl <moiety@noreply.codeberg.org>
Co-committed-by: Zoë Bijl <moiety@noreply.codeberg.org>
This commit is contained in:
Zoë Bijl
2025-10-12 13:42:02 +02:00
committed by tobi
parent 75d7a62693
commit 1ff70886a1
975 changed files with 22196 additions and 21964 deletions
@@ -1,26 +1,26 @@
import { Record as ImmutableRecord, Stack } from 'immutable';
import { Record as ImmutableRecord, Stack } from "immutable";
import type { Reducer } from '@reduxjs/toolkit';
import { type Reducer } from "@reduxjs/toolkit";
import { COMPOSE_UPLOAD_CHANGE_SUCCESS } from '../actions/compose';
import type { ModalType } from '../actions/modal';
import { openModal, closeModal } from '../actions/modal';
import { TIMELINE_DELETE } from '../actions/timelines';
import { COMPOSE_UPLOAD_CHANGE_SUCCESS } from "../actions/compose";
import { type ModalType } from "../actions/modal";
import { openModal, closeModal } from "../actions/modal";
import { TIMELINE_DELETE } from "../actions/timelines";
export type ModalProps = Record<string, unknown>;
interface Modal {
modalType: ModalType;
modalProps: ModalProps;
modalType: ModalType,
modalProps: ModalProps,
}
const Modal = ImmutableRecord<Modal>({
modalType: 'ACTIONS',
modalType: "ACTIONS",
modalProps: ImmutableRecord({})(),
});
interface ModalState {
ignoreFocus: boolean;
stack: Stack<ImmutableRecord<Modal>>;
ignoreFocus: boolean,
stack: Stack<ImmutableRecord<Modal>>,
}
const initialState = ImmutableRecord<ModalState>({
@@ -30,8 +30,8 @@ const initialState = ImmutableRecord<ModalState>({
type State = typeof initialState;
interface PopModalOption {
modalType: ModalType | undefined;
ignoreFocus: boolean;
modalType: ModalType | undefined,
ignoreFocus: boolean,
}
const popModal = (
state: State,
@@ -39,11 +39,11 @@ const popModal = (
): State => {
if (
modalType === undefined ||
modalType === state.get('stack').get(0)?.get('modalType')
modalType === state.get("stack").get(0)?.get("modalType")
) {
return state
.set('ignoreFocus', !!ignoreFocus)
.update('stack', (stack) => stack.shift());
.set("ignoreFocus", ignoreFocus)
.update("stack", (stack) => stack.shift());
} else {
return state;
}
@@ -55,29 +55,31 @@ const pushModal = (
modalProps: ModalProps,
): State => {
return state.withMutations((record) => {
record.set('ignoreFocus', false);
record.update('stack', (stack) =>
record.set("ignoreFocus", false);
record.update("stack", (stack) =>
stack.unshift(Modal({ modalType, modalProps })),
);
});
};
export const modalReducer: Reducer<State> = (state = initialState, action) => {
if (openModal.match(action))
if (openModal.match(action)) {
return pushModal(
state,
action.payload.modalType,
action.payload.modalProps,
);
else if (closeModal.match(action)) return popModal(state, action.payload);
// TODO: type those actions
else if (action.type === COMPOSE_UPLOAD_CHANGE_SUCCESS)
return popModal(state, { modalType: 'FOCAL_POINT', ignoreFocus: false });
else if (action.type === TIMELINE_DELETE)
return state.update('stack', (stack) =>
} else if (closeModal.match(action)) {
return popModal(state, action.payload);
} else if (action.type === COMPOSE_UPLOAD_CHANGE_SUCCESS) {
return popModal(state, { modalType: "FOCAL_POINT", ignoreFocus: false });
} else if (action.type === TIMELINE_DELETE) {
return state.update("stack", (stack) =>
stack.filterNot(
(modal) => modal.get('modalProps').statusId === action.id,
(modal) => modal.get("modalProps").statusId === action.id,
),
);
else return state;
} else {
return state;
}
};