CODEBASE: Fix lint errors 2 (#1756)

This commit is contained in:
catloversg
2024-11-07 14:09:11 +07:00
committed by GitHub
parent e3c10e9f0f
commit 36c143b687
48 changed files with 267 additions and 146 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ export const A = (props: React.PropsWithChildren<{ href?: string }>): React.Reac
cursor: "pointer",
}}
>
<CorruptableText content={props.children + ""} spoiler={true} />
<CorruptableText content={String(props.children)} spoiler={true} />
</span>
);
return (
+1 -1
View File
@@ -38,7 +38,7 @@ type RowName = SkillRowName | "HP" | "Money";
const OverviewEventEmitter = new EventEmitter();
// These values aren't displayed, they're just used for comparison to check if state has changed
const valUpdaters: Record<RowName, () => any> = {
const valUpdaters: Record<RowName, () => unknown> = {
HP: () => Player.hp.current + "|" + Player.hp.max, // This isn't displayed, it's just compared for updates.
Money: () => Player.money,
Hack: () => Player.skills.hacking,
+5 -3
View File
@@ -26,9 +26,11 @@ export function CinematicLine(props: IProps): React.ReactElement {
return;
}
let cancel = false;
(async () => {
await sleep(10).then(() => !cancel && advance());
})();
sleep(10)
.then(() => !cancel && advance())
.catch((error) => {
console.error(error);
});
return () => {
cancel = true;
};
+5 -1
View File
@@ -399,7 +399,11 @@ export const ImportSave = (props: { saveData: SaveData; automatic: boolean }): J
<ConfirmationModal
open={isImportModalOpen}
onClose={closeImportModal}
onConfirm={handleImport}
onConfirm={() => {
handleImport().catch((error) => {
console.error(error);
});
}}
confirmationText={
<>
Importing new save game data will <strong>completely wipe</strong> the current game data!
+10 -1
View File
@@ -298,7 +298,16 @@ function LogWindow({ hidden, script, onClose }: LogWindowProps): React.ReactElem
return !(bounds.right < 0 || bounds.bottom < 0 || bounds.left > innerWidth || bounds.top > outerWidth);
};
const onDrag = (e: DraggableEvent): void | false => {
/**
* The returned type of onDrag is a bit weird here. The Draggable component expects an onDrag that returns "void | false".
* In that component's internal code, it checks for the explicit "false" value. If onDrag returns false, the component
* cancels the dragging.
*
* That's why they use "void | false" as the returned type. However, in TypeScript, "void" is not supposed to be used
* like that. ESLint will complain "void is not valid as a constituent in a union type". Please check its documentation
* for the reason. In order to solve this problem, I changed the returned type to "undefined | false".
*/
const onDrag = (e: DraggableEvent): undefined | false => {
e.preventDefault();
// bound to body
if (
+1 -1
View File
@@ -98,7 +98,7 @@ export function RecoveryRoot({ softReset, errorData, resetError }: IProps): Reac
{sourceError && (
<Box>
<Typography variant="h6" color={Settings.theme.error}>
Error: {sourceError.toString()}
Error: {String(sourceError)}
</Typography>
<br />
</Box>
+1 -1
View File
@@ -14,7 +14,7 @@ interface IProps {
const useStyles = makeStyles()({
snackbar: {
// Log popup z-index increments, so let's add a padding to be well above them.
zIndex: `${logBoxBaseZIndex + 1000} !important` as any,
zIndex: `${logBoxBaseZIndex + 1000} !important`,
"& .MuiAlert-icon": {
alignSelf: "center",