mirror of
https://github.com/shadps4-emu/shadPS4-launcher.git
synced 2026-01-31 00:55:20 +01:00
lint: fix linting issues after biome upgrade
This commit is contained in:
2
.github/workflows/deploy.yaml
vendored
2
.github/workflows/deploy.yaml
vendored
@@ -34,6 +34,8 @@ jobs:
|
||||
|
||||
- name: Setup Biome
|
||||
uses: biomejs/setup-biome@v2
|
||||
with:
|
||||
version: "2.3.8"
|
||||
|
||||
- name: Run Biome
|
||||
run: biome ci .
|
||||
|
||||
4
.github/workflows/linting.yaml
vendored
4
.github/workflows/linting.yaml
vendored
@@ -14,9 +14,11 @@ jobs:
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Biome
|
||||
uses: biomejs/setup-biome@v2
|
||||
with:
|
||||
version: latest
|
||||
version: "2.3.8"
|
||||
|
||||
- name: Run Biome
|
||||
run: biome ci .
|
||||
|
||||
95
biome.jsonc
95
biome.jsonc
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"$schema": "https://next.biomejs.dev/schemas/2.0.0-beta/schema.json",
|
||||
"$schema": "https://next.biomejs.dev/schemas/2.3.8/schema.json",
|
||||
"vcs": {
|
||||
"enabled": true,
|
||||
"clientKind": "git",
|
||||
"useIgnoreFile": true,
|
||||
"useIgnoreFile": true
|
||||
},
|
||||
"files": {
|
||||
"ignoreUnknown": false,
|
||||
"includes": ["**/*", "!dist/**", "!src-tauri"],
|
||||
"includes": ["**/*", "!dist", "!src-tauri"]
|
||||
},
|
||||
"assist": {
|
||||
"enabled": true,
|
||||
"actions": {
|
||||
"recommended": true,
|
||||
"source": {
|
||||
"useSortedAttributes": "on",
|
||||
},
|
||||
},
|
||||
"useSortedAttributes": "on"
|
||||
}
|
||||
}
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true,
|
||||
"indentStyle": "space",
|
||||
"indentWidth": 4,
|
||||
"lineEnding": "lf",
|
||||
"lineEnding": "lf"
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
@@ -34,43 +34,42 @@
|
||||
"useArrowFunction": "off",
|
||||
"useLiteralKeys": "error",
|
||||
"useOptionalChain": "error",
|
||||
"noArguments": "warn"
|
||||
},
|
||||
"correctness": {
|
||||
"noConstAssign": "error",
|
||||
"noGlobalObjectCalls": "off",
|
||||
"noInvalidBuiltinInstantiation": "off",
|
||||
"noInvalidConstructorSuper": "off",
|
||||
"noNewSymbol": "off",
|
||||
"noSetterReturn": "off",
|
||||
"noUndeclaredVariables": "off",
|
||||
"noUnreachable": "off",
|
||||
"noUnreachableSuper": "off",
|
||||
"noGlobalObjectCalls": "error",
|
||||
"noInvalidBuiltinInstantiation": "error",
|
||||
"noInvalidConstructorSuper": "error",
|
||||
"noSetterReturn": "error",
|
||||
"noUndeclaredVariables": "error",
|
||||
"noUnreachable": "warn",
|
||||
"noUnreachableSuper": "error",
|
||||
"noUnusedVariables": "error",
|
||||
"noUnusedImports": "error",
|
||||
"useArrayLiterals": "off",
|
||||
"useExhaustiveDependencies": "warn",
|
||||
"useHookAtTopLevel": "error",
|
||||
"useExhaustiveDependencies": "error",
|
||||
"useHookAtTopLevel": "error"
|
||||
},
|
||||
"style": {
|
||||
"noArguments": "error",
|
||||
"noInferrableTypes": "error",
|
||||
"noNamespace": "error",
|
||||
"useAsConstAssertion": "error",
|
||||
"useBlockStatements": "warn",
|
||||
"useBlockStatements": "error",
|
||||
"useConsistentArrayType": "error",
|
||||
"useConst": "error",
|
||||
"useForOf": "error",
|
||||
"useImportType": "error",
|
||||
"useShorthandFunctionType": "error",
|
||||
"useThrowOnlyError": "error",
|
||||
"useArrayLiterals": "warn",
|
||||
"useFilenamingConvention": {
|
||||
"level": "error",
|
||||
"options": {
|
||||
"strictCase": true,
|
||||
"requireAscii": true,
|
||||
"filenameCases": ["kebab-case"],
|
||||
},
|
||||
},
|
||||
"filenameCases": ["kebab-case"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"suspicious": {
|
||||
"noClassAssign": "off",
|
||||
@@ -89,28 +88,32 @@
|
||||
"noUnsafeNegation": "off",
|
||||
"useAwait": "error",
|
||||
"useGetterReturn": "off",
|
||||
"useNamespaceKeyword": "error",
|
||||
"useNamespaceKeyword": "error"
|
||||
},
|
||||
"nursery": {
|
||||
"useSortedClasses": "warn",
|
||||
"useSortedClasses": "error"
|
||||
},
|
||||
"a11y": {
|
||||
"useKeyWithClickEvents": "off",
|
||||
},
|
||||
},
|
||||
"useSemanticElements": "off"
|
||||
}
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"formatter": {
|
||||
"quoteStyle": "double",
|
||||
"semicolons": "always",
|
||||
"trailingCommas": "all",
|
||||
"trailingCommas": "all"
|
||||
},
|
||||
"globals": [],
|
||||
"globals": []
|
||||
},
|
||||
"json": {
|
||||
"formatter": {
|
||||
"trailingCommas": "all",
|
||||
"css": {
|
||||
"parser": {
|
||||
"tailwindDirectives": true
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
@@ -124,12 +127,12 @@
|
||||
"strictCase": true,
|
||||
"requireAscii": true,
|
||||
"match": "use.*",
|
||||
"filenameCases": ["camelCase"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"filenameCases": ["camelCase"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"includes": ["src/lib/hooks/**/*.tsx"],
|
||||
@@ -139,12 +142,12 @@
|
||||
"useFilenamingConvention": {
|
||||
"level": "error",
|
||||
"options": {
|
||||
"match": "Hook_Should_Use_Ts_Extension!",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
"match": "Hook_Should_Use_Ts_Extension!"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
20
bun.lock
20
bun.lock
@@ -62,7 +62,7 @@
|
||||
"tailwind-merge": "^3.3.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.0.0-beta.1",
|
||||
"@biomejs/biome": "2.3.8",
|
||||
"@tauri-apps/cli": "^2.5.0",
|
||||
"@types/clone-deep": "^4.0.4",
|
||||
"@types/node": "^22.15.24",
|
||||
@@ -144,23 +144,23 @@
|
||||
|
||||
"@babel/types": ["@babel/types@7.27.1", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-+EzkxvLNfiUeKMgy/3luqfsCWFRXLb7U6wNQTk60tovuckwB15B191tJWvpp4HjiQWdJkCxO3Wbvc6jlk3Xb2Q=="],
|
||||
|
||||
"@biomejs/biome": ["@biomejs/biome@2.0.0-beta.1", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.0.0-beta.1", "@biomejs/cli-darwin-x64": "2.0.0-beta.1", "@biomejs/cli-linux-arm64": "2.0.0-beta.1", "@biomejs/cli-linux-arm64-musl": "2.0.0-beta.1", "@biomejs/cli-linux-x64": "2.0.0-beta.1", "@biomejs/cli-linux-x64-musl": "2.0.0-beta.1", "@biomejs/cli-win32-arm64": "2.0.0-beta.1", "@biomejs/cli-win32-x64": "2.0.0-beta.1" }, "bin": { "biome": "bin/biome" } }, "sha512-MqRoy9CbTkrS45zW+S4u8p4kQUIFx0mGUWi789W1R3b1kXYIudEqsTKgXKtTGsI0kWOlvnjuKqwTrabjaGchhQ=="],
|
||||
"@biomejs/biome": ["@biomejs/biome@2.3.8", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.3.8", "@biomejs/cli-darwin-x64": "2.3.8", "@biomejs/cli-linux-arm64": "2.3.8", "@biomejs/cli-linux-arm64-musl": "2.3.8", "@biomejs/cli-linux-x64": "2.3.8", "@biomejs/cli-linux-x64-musl": "2.3.8", "@biomejs/cli-win32-arm64": "2.3.8", "@biomejs/cli-win32-x64": "2.3.8" }, "bin": { "biome": "bin/biome" } }, "sha512-Qjsgoe6FEBxWAUzwFGFrB+1+M8y/y5kwmg5CHac+GSVOdmOIqsAiXM5QMVGZJ1eCUCLlPZtq4aFAQ0eawEUuUA=="],
|
||||
|
||||
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.0.0-beta.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-RaGmpNLl5NFooXaoCwvgvcuU6Am/rMZ3R48pQeCVxjrCcz1BIlKLTai5UosiedazW7JbXAvgXdSNizYG7ITlAQ=="],
|
||||
"@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.3.8", "", { "os": "darwin", "cpu": "arm64" }, "sha512-HM4Zg9CGQ3txTPflxD19n8MFPrmUAjaC7PQdLkugeeC0cQ+PiVrd7i09gaBS/11QKsTDBJhVg85CEIK9f50Qww=="],
|
||||
|
||||
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.0.0-beta.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-sTzSshkne7HKZFNfiIhmAji7gjtCBXvkTujZELCZWIZC7oj1Tjw/gvAzbdFj2UyHd5/i90pND4ybFOLQZm9gpg=="],
|
||||
"@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.3.8", "", { "os": "darwin", "cpu": "x64" }, "sha512-lUDQ03D7y/qEao7RgdjWVGCu+BLYadhKTm40HkpJIi6kn8LSv5PAwRlew/DmwP4YZ9ke9XXoTIQDO1vAnbRZlA=="],
|
||||
|
||||
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.0.0-beta.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-bxce2O4nooBmp20Ey0+IFIZyy/b0RVnciIQk9euCfAi9evq7SvFtMBYo3YUZej0KIvrau5H7tJk5OqmRJk2l+g=="],
|
||||
"@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.3.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-Uo1OJnIkJgSgF+USx970fsM/drtPcQ39I+JO+Fjsaa9ZdCN1oysQmy6oAGbyESlouz+rzEckLTF6DS7cWse95g=="],
|
||||
|
||||
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.0.0-beta.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-0MPUKzz9uBBxAYSJ+OlFi4+yGwiRcZeFqq39H0MxXCQ9MMpKJFH2Ek72fw8sXwG7Prn7EsW/3u1b7najyn1XGQ=="],
|
||||
"@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.3.8", "", { "os": "linux", "cpu": "arm64" }, "sha512-PShR4mM0sjksUMyxbyPNMxoKFPVF48fU8Qe8Sfx6w6F42verbwRLbz+QiKNiDPRJwUoMG1nPM50OBL3aOnTevA=="],
|
||||
|
||||
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.0.0-beta.1", "", { "os": "linux", "cpu": "x64" }, "sha512-6P/AtJv4hOH8mu8ez0c4UInUpiet9NEoF25+O7OPyb4w6ZHJMp2qzvayJS7TKrTQzE5KUvSiNsACGRz34DzUkg=="],
|
||||
"@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.3.8", "", { "os": "linux", "cpu": "x64" }, "sha512-QDPMD5bQz6qOVb3kiBui0zKZXASLo0NIQ9JVJio5RveBEFgDgsvJFUvZIbMbUZT3T00M/1wdzwWXk4GIh0KaAw=="],
|
||||
|
||||
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.0.0-beta.1", "", { "os": "linux", "cpu": "x64" }, "sha512-dFvisnP1hFpVILNw0PZfs8piBwe8+aykO04Tb/4AJDVVzKkGgJfwSefwo4jqzO/Wk/Zruvhcp1nKbjgRXM+vDg=="],
|
||||
"@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.3.8", "", { "os": "linux", "cpu": "x64" }, "sha512-YGLkqU91r1276uwSjiUD/xaVikdxgV1QpsicT0bIA1TaieM6E5ibMZeSyjQ/izBn4tKQthUSsVZacmoJfa3pDA=="],
|
||||
|
||||
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.0.0-beta.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-0C9YSqWHf2cJGnjKDbLi49xv6H9IfqbDsFav7X557PqwY64O6IKWqcmZzi/PkDFHjQM9opU6uhKapeGKGDxziQ=="],
|
||||
"@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.3.8", "", { "os": "win32", "cpu": "arm64" }, "sha512-H4IoCHvL1fXKDrTALeTKMiE7GGWFAraDwBYFquE/L/5r1927Te0mYIGseXi4F+lrrwhSWbSGt5qPFswNoBaCxg=="],
|
||||
|
||||
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.0.0-beta.1", "", { "os": "win32", "cpu": "x64" }, "sha512-o8W6+DX0YRjt1kS8Y3ismq6EkjwiVDv7X0TEpfnFywoVG8HoJ7G7/m9r8LM1yE46WI3maPH2A0MoVpQ1ZNG++A=="],
|
||||
"@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.3.8", "", { "os": "win32", "cpu": "x64" }, "sha512-RguzimPoZWtBapfKhKjcWXBVI91tiSprqdBYu7tWhgN8pKRZhw24rFeNZTNf6UiBfjCYCi9eFQs/JzJZIhuK4w=="],
|
||||
|
||||
"@emotion/is-prop-valid": ["@emotion/is-prop-valid@1.3.1", "", { "dependencies": { "@emotion/memoize": "^0.9.0" } }, "sha512-/ACwoqx7XQi9knQs/G0qKvv5teDMhD7bXYns9N/wM8ah8iNb8jZ2uNO0YOgiq2o2poIvVtJS2YALasQuMSQ7Kw=="],
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"tailwind-merge": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.0.0-beta.1",
|
||||
"@biomejs/biome": "2.3.8",
|
||||
"@tauri-apps/cli": "^2.5.0",
|
||||
"@types/clone-deep": "^4.0.4",
|
||||
"@types/node": "^22.15.24",
|
||||
|
||||
@@ -143,7 +143,7 @@ export function GameBox({ game }: { game: GameEntry; isFirst?: boolean }) {
|
||||
pushModal(<GameDetailsModal gameData={r.game} />);
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
toast.error("Unknown error: " + stringifyError(e));
|
||||
toast.error(`Unknown error: ${stringifyError(e)}`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -204,6 +204,8 @@ export function GameBox({ game }: { game: GameEntry; isFirst?: boolean }) {
|
||||
onBlur={onBlur}
|
||||
onClick={onClick}
|
||||
onDoubleClick={openGame}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
{isPending && (
|
||||
<div className="center absolute inset-0 bg-black/60">
|
||||
|
||||
@@ -42,6 +42,8 @@ function NoGameFound() {
|
||||
<div
|
||||
className="flex h-[150px] w-[300px] cursor-pointer flex-col items-center justify-center rounded-md border border-dashed text-sm"
|
||||
onClick={() => void openGameFolder()}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
<span>No game found :(</span>
|
||||
<span>Click here to open game folder</span>
|
||||
@@ -149,6 +151,7 @@ function Grid({ search }: { search: string }) {
|
||||
{Array(itemPerRow - entries.length)
|
||||
.fill(0)
|
||||
.map((_, i) => (
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: This is a skeleton element, order doesn't matter
|
||||
<EmptyGameBox key={i} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -85,7 +85,7 @@ export function LoadingOverlay() {
|
||||
const value = useAtomValue(atomDownloadingOverlay);
|
||||
|
||||
if (!value) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
const props: LoadingProps = {};
|
||||
|
||||
@@ -333,22 +333,20 @@ export function LogList({ runningGame, levelFilter, classFilter }: Props) {
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex-1 overflow-y-auto rounded-md border contain-strict">
|
||||
<DataEditor
|
||||
columns={columns}
|
||||
drawHeader={() => false}
|
||||
getCellContent={getCellContent}
|
||||
getCellsForSelection={getCellForSelection}
|
||||
headerHeight={8}
|
||||
onColumnResize={onColumnResize}
|
||||
onVisibleRegionChanged={onVisibleRegionChanged}
|
||||
ref={dataGridRef}
|
||||
rows={rowCount}
|
||||
theme={isDark ? darkTheme : theme}
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
<div className="flex-1 overflow-y-auto rounded-md border contain-strict">
|
||||
<DataEditor
|
||||
columns={columns}
|
||||
drawHeader={() => false}
|
||||
getCellContent={getCellContent}
|
||||
getCellsForSelection={getCellForSelection}
|
||||
headerHeight={8}
|
||||
onColumnResize={onColumnResize}
|
||||
onVisibleRegionChanged={onVisibleRegionChanged}
|
||||
ref={dataGridRef}
|
||||
rows={rowCount}
|
||||
theme={isDark ? darkTheme : theme}
|
||||
width="100%"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export function ModalOverlay() {
|
||||
const { modalStack } = useNavigator();
|
||||
|
||||
if (modalStack.length === 0) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
const modal = modalStack[modalStack.length - 1];
|
||||
|
||||
@@ -138,13 +138,11 @@ export function FolderConfigModal() {
|
||||
const { popModal } = useNavigator();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog onOpenChange={() => popModal()} open>
|
||||
<DialogTitle className="hidden">Configuration</DialogTitle>
|
||||
<DialogContent aria-describedby={undefined}>
|
||||
<PathConfig />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
<Dialog onOpenChange={() => popModal()} open>
|
||||
<DialogTitle className="hidden">Configuration</DialogTitle>
|
||||
<DialogContent aria-describedby={undefined}>
|
||||
<PathConfig />
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ export function RunningGameModal({
|
||||
toast.success("Log saved");
|
||||
} catch (e: unknown) {
|
||||
console.error("Error saving log", e);
|
||||
toast.error("Error saving log: " + stringifyError(e));
|
||||
toast.error(`Error saving log: ${stringifyError(e)}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ function AddCustom({ reset }: { reset: Callback }) {
|
||||
path: binaryPath,
|
||||
name,
|
||||
repo: "Local",
|
||||
date: new Date().getTime(),
|
||||
date: Date.now(),
|
||||
};
|
||||
setInstalledVersions((prev) => [...prev, data]);
|
||||
reset();
|
||||
@@ -374,7 +374,7 @@ function RepoEdit() {
|
||||
name = name.slice(dotCom + 5);
|
||||
setNewRepo(name);
|
||||
}
|
||||
return /^[\w\-]+\/[\w\-]+$/.test(name) ? name : null;
|
||||
return /^[\w-]+\/[\w-]+$/.test(name) ? name : null;
|
||||
};
|
||||
|
||||
const addRepo = () => {
|
||||
|
||||
@@ -80,7 +80,7 @@ export function PatchPanel({ gameData }: { gameData: GameEntry }) {
|
||||
setPatchLines(file.getPatchLines());
|
||||
} catch (e) {
|
||||
console.error("Failed to parse patch file", e);
|
||||
toast.error("Failed to parse patch file. " + stringifyError(e));
|
||||
toast.error(`Failed to parse patch file. ${stringifyError(e)}`);
|
||||
setPatchFile(null);
|
||||
setPatchLines([]);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export function PatchPanel({ gameData }: { gameData: GameEntry }) {
|
||||
})
|
||||
.catch((e) => {
|
||||
console.error("Failed to save patch file", e);
|
||||
toast.error("Failed to save patch file. " + e.message);
|
||||
toast.error(`Failed to save patch file. ${e.message}`);
|
||||
});
|
||||
}, [patchFile]);
|
||||
|
||||
|
||||
@@ -31,6 +31,8 @@ function SingleGameIcon({
|
||||
onClick={() =>
|
||||
pushModal(<RunningGameModal runningGame={runningGame} />)
|
||||
}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
{...props}
|
||||
>
|
||||
<div className="absolute top-0 right-0 size-2">
|
||||
|
||||
@@ -38,7 +38,7 @@ export function Navigable({
|
||||
const navField = useGamepadNavField();
|
||||
|
||||
useImperativeHandle(parentRef, () => {
|
||||
return ref.current!;
|
||||
return ref.current as HTMLElement;
|
||||
}, []);
|
||||
|
||||
const onSelect = useCallback(
|
||||
@@ -47,7 +47,9 @@ export function Navigable({
|
||||
if (!e.isPreventingDefault) {
|
||||
document
|
||||
.querySelectorAll("*[data-gamepad-focus]")
|
||||
.forEach((el) => el.removeAttribute("data-gamepad-focus"));
|
||||
.forEach((el) => {
|
||||
el.removeAttribute("data-gamepad-focus");
|
||||
});
|
||||
const el = ref.current;
|
||||
if (el) {
|
||||
el.setAttribute("data-gamepad-focus", "true");
|
||||
@@ -102,10 +104,8 @@ export function Navigable({
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Slot ref={ref} tabIndex={tabIndex ?? 0} {...props}>
|
||||
{children}
|
||||
</Slot>
|
||||
</>
|
||||
<Slot ref={ref} tabIndex={tabIndex ?? 0} {...props}>
|
||||
{children}
|
||||
</Slot>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export function UpdateIcon() {
|
||||
const availableUpdate = useAtomValue(atomAvailableUpdate);
|
||||
|
||||
if (!availableUpdate) {
|
||||
return <></>;
|
||||
return null;
|
||||
}
|
||||
|
||||
return createPortal(
|
||||
@@ -19,6 +19,8 @@ export function UpdateIcon() {
|
||||
<div
|
||||
className="animate-bounce cursor-pointer rounded-full bg-green-100 p-4"
|
||||
onClick={installUpdate}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
>
|
||||
<DownloadIcon className="h-5 w-5 text-green-700" />
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,6 @@ function TomlInput({
|
||||
value={value}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "number":
|
||||
return (
|
||||
<Input
|
||||
@@ -54,7 +53,6 @@ function TomlInput({
|
||||
value={String(value)}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "boolean":
|
||||
return (
|
||||
<Select
|
||||
@@ -76,7 +74,6 @@ function TomlInput({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
);
|
||||
break;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -42,7 +42,7 @@ export async function installUpdate() {
|
||||
});
|
||||
|
||||
let progress = 0;
|
||||
let totalSize: number | undefined = undefined;
|
||||
let totalSize: number | undefined;
|
||||
await update.downloadAndInstall((ev) => {
|
||||
switch (ev.event) {
|
||||
case "Started":
|
||||
@@ -80,6 +80,6 @@ export async function installUpdate() {
|
||||
await relaunch();
|
||||
} catch (e: unknown) {
|
||||
console.error("download update error", e);
|
||||
toast.error("Error downloading update: " + stringifyError(e));
|
||||
toast.error(`Error downloading update: ${stringifyError(e)}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ export function downloadCheats(repo: CheatRepository, store: JotaiStore) {
|
||||
.map((line) => {
|
||||
const [key] = line.trim().split("=", 1);
|
||||
if (!key) {
|
||||
return errAsync("invalid key line: " + line);
|
||||
return errAsync(`invalid key line: ${line}`);
|
||||
}
|
||||
return fetchSafe(createUrl(key))
|
||||
.map((e) => e.arrayBuffer())
|
||||
|
||||
@@ -49,7 +49,7 @@ export function handleGameProcess(
|
||||
})
|
||||
.catch((e: unknown) => {
|
||||
console.error("Unknown restart error", e);
|
||||
toast.error("Unknown restart error: " + stringifyError(e));
|
||||
toast.error(`Unknown restart error: ${stringifyError(e)}`);
|
||||
store.set(state.atomRunning, -1);
|
||||
store.set(state.atomError, stringifyError(e));
|
||||
})
|
||||
|
||||
@@ -376,7 +376,9 @@ export function GamepadNavField({
|
||||
);
|
||||
document
|
||||
.querySelectorAll("*[data-gamepad-focus]")
|
||||
.forEach((el) => el.removeAttribute("data-gamepad-focus"));
|
||||
.forEach((el) => {
|
||||
el.removeAttribute("data-gamepad-focus");
|
||||
});
|
||||
}
|
||||
};
|
||||
window.addEventListener("mousedown", c);
|
||||
|
||||
@@ -9,7 +9,6 @@ export function useDebounceAction<T extends () => void>(
|
||||
action();
|
||||
});
|
||||
|
||||
// biome-ignore lint/correctness/useExhaustiveDependencies: useEffectEvent is untracked
|
||||
return useCallback(() => {
|
||||
clearTimeout(lastTimeout.current);
|
||||
lastTimeout.current = setTimeout(() => {
|
||||
|
||||
@@ -18,7 +18,7 @@ function forwardConsole(
|
||||
const original = console[fnName];
|
||||
// biome-ignore lint/suspicious/noExplicitAny: This is the original signature
|
||||
console[fnName] = function (...data: any[]) {
|
||||
let callFrame: ErrorStackParser.StackFrame | undefined = undefined;
|
||||
let callFrame: ErrorStackParser.StackFrame | undefined;
|
||||
try {
|
||||
callFrame = ErrorStackParser.parse(new Error())?.[1];
|
||||
} catch (_e) {
|
||||
@@ -78,6 +78,8 @@ function forwardConsole(
|
||||
}
|
||||
case "undefined":
|
||||
return "undefined";
|
||||
default:
|
||||
throw new Error("UNREACHABLE");
|
||||
}
|
||||
})
|
||||
.join(" "),
|
||||
|
||||
@@ -2,7 +2,7 @@ import { type Atom, atom } from "jotai";
|
||||
import { loadable } from "jotai/utils";
|
||||
|
||||
export function atomKeepLast<T>(src: Atom<T>): Atom<T> {
|
||||
let prevData: T | undefined = undefined;
|
||||
let prevData: T | undefined;
|
||||
const srcLoadable = loadable(src);
|
||||
return atom((get) => {
|
||||
const value = get(srcLoadable);
|
||||
|
||||
@@ -36,7 +36,7 @@ async function loadGameData(path: string): Promise<GameEntry> {
|
||||
return {
|
||||
id: -1,
|
||||
path: path,
|
||||
cusa: ("N/A - " + base) as CUSA,
|
||||
cusa: `N/A - ${base}` as CUSA,
|
||||
title: base,
|
||||
version: "N/A",
|
||||
fw_version: "N/A",
|
||||
@@ -111,10 +111,7 @@ async function registerGamePath(workPath: string) {
|
||||
gameRegisterQueueIsUse = false;
|
||||
}
|
||||
|
||||
async function unregisterGamePathPrefix(
|
||||
pathPrefix: string,
|
||||
knownPaths: Set<string>,
|
||||
) {
|
||||
function unregisterGamePathPrefix(pathPrefix: string, knownPaths: Set<string>) {
|
||||
defaultStore.set(atomGameLibrary, (prev) =>
|
||||
prev.filter((e) => {
|
||||
const toRemove = e.path.startsWith(pathPrefix);
|
||||
@@ -169,10 +166,7 @@ async function scanDirectory(
|
||||
}
|
||||
|
||||
tempKnownPaths.forEach((path) => {
|
||||
unregisterGamePathPrefix(
|
||||
path,
|
||||
knownPaths,
|
||||
);
|
||||
unregisterGamePathPrefix(path, knownPaths);
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
console.error(`Error discovering game at "${path}"`, e);
|
||||
@@ -280,7 +274,7 @@ async function scanDirectory(
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
console.error("error watching path", stringifyError(e));
|
||||
toast.error("Error watching games path: " + stringifyError(e));
|
||||
toast.error(`Error watching games path: ${stringifyError(e)}`);
|
||||
}
|
||||
})();
|
||||
cancel = () => {
|
||||
|
||||
@@ -108,7 +108,7 @@ export const atomAvailableVersions = atomWithQuery((get) => ({
|
||||
}),
|
||||
(err) =>
|
||||
new Error(
|
||||
"GitHub API Error: " + stringifyError(err),
|
||||
`GitHub API Error: ${stringifyError(err)}`,
|
||||
),
|
||||
),
|
||||
10000,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import path from "path";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
Reference in New Issue
Block a user