mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
lint: apply some unsafe fixes
This commit is contained in:
parent
97e02e44c1
commit
91c5b11847
31 changed files with 126 additions and 94 deletions
|
|
@ -150,7 +150,9 @@ function RepositoryTableBody({
|
|||
{TABLE_HEAD.map((head, index) => (
|
||||
<th
|
||||
key={index}
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
>
|
||||
<small className="font-normal leading-none">{tc(head)}</small>
|
||||
</th>
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ export function CreateProject({
|
|||
};
|
||||
|
||||
const checking =
|
||||
projectNameDebounced != projectName || projectNameCheckState === "checking";
|
||||
projectNameDebounced !== projectName ||
|
||||
projectNameCheckState === "checking";
|
||||
|
||||
let projectNameState: "Ok" | "warn" | "err";
|
||||
let projectNameCheck;
|
||||
|
|
@ -237,7 +238,7 @@ export function CreateProject({
|
|||
case "loadingInitialInformation":
|
||||
dialogBody = <RefreshCw className={"w-5 h-5 animate-spin"} />;
|
||||
break;
|
||||
case "enteringInformation":
|
||||
case "enteringInformation": {
|
||||
const renderUnityVersion = (unityVersion: string) => {
|
||||
if (unityVersion === latestUnityVersion) {
|
||||
return (
|
||||
|
|
@ -274,7 +275,7 @@ export function CreateProject({
|
|||
</SelectItem>
|
||||
<SelectItem
|
||||
value={"custom"}
|
||||
disabled={customTemplates.length == 0}
|
||||
disabled={customTemplates.length === 0}
|
||||
>
|
||||
{tc("projects:type:custom")}
|
||||
</SelectItem>
|
||||
|
|
@ -364,6 +365,7 @@ export function CreateProject({
|
|||
</>
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "creating":
|
||||
dialogBody = (
|
||||
<>
|
||||
|
|
@ -379,13 +381,13 @@ export function CreateProject({
|
|||
<DialogTitle>{tc("projects:create new project")}</DialogTitle>
|
||||
<DialogDescription>{dialogBody}</DialogDescription>
|
||||
<DialogFooter className={"gap-2"}>
|
||||
<Button onClick={close} disabled={state == "creating"}>
|
||||
<Button onClick={close} disabled={state === "creating"}>
|
||||
{tc("general:button:cancel")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={createProject}
|
||||
disabled={
|
||||
state == "creating" || checking || projectNameState == "err"
|
||||
state === "creating" || checking || projectNameState === "err"
|
||||
}
|
||||
>
|
||||
{tc("projects:button:create")}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ export function combinePackagesAndProjectDetails(
|
|||
packageRowInfo.isThereSource = knownPackages.has(pkg.name);
|
||||
|
||||
// if we have the latest version, check if it's upgradable
|
||||
if (packageRowInfo.latest.status != "none") {
|
||||
if (packageRowInfo.latest.status !== "none") {
|
||||
const compare = compareVersion(
|
||||
pkg.version,
|
||||
packageRowInfo.latest.pkg.version,
|
||||
|
|
@ -265,13 +265,13 @@ export function combinePackagesAndProjectDetails(
|
|||
packagesTable.get("com.vrchat.avatars")?.installed != null;
|
||||
const isWorldsSdkInstalled =
|
||||
packagesTable.get("com.vrchat.worlds")?.installed != null;
|
||||
if (isAvatarsSdkInstalled != isWorldsSdkInstalled) {
|
||||
if (isAvatarsSdkInstalled !== isWorldsSdkInstalled) {
|
||||
// if either avatars or worlds sdk is installed, remove the packages for the other SDK.
|
||||
|
||||
// collect dependant packages
|
||||
const dependantPackages = new Map<string, Set<string>>();
|
||||
for (const pkg of packagesTable.values()) {
|
||||
if (pkg.latest.status != "none") {
|
||||
if (pkg.latest.status !== "none") {
|
||||
for (const dependency of pkg.latest.pkg.vpm_dependencies) {
|
||||
if (!dependantPackages.has(dependency)) {
|
||||
dependantPackages.set(dependency, new Set());
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export function LaunchSettings({
|
|||
|
||||
if (
|
||||
customizeCommandline &&
|
||||
reorderableListContext.value.some((x) => x.length == 0)
|
||||
reorderableListContext.value.some((x) => x.length === 0)
|
||||
) {
|
||||
errorMessage = tc("projects:hint:some arguments are empty");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,13 +103,13 @@ function updateModeFromPackageModes(
|
|||
): BulkUpdateMode {
|
||||
const asSet = new Set(map);
|
||||
|
||||
if (asSet.size == 0) {
|
||||
if (asSet.size === 0) {
|
||||
return "any";
|
||||
}
|
||||
if (asSet.size == 1) {
|
||||
if (asSet.size === 1) {
|
||||
return [...asSet][0];
|
||||
}
|
||||
if (asSet.size == 2) {
|
||||
if (asSet.size === 2) {
|
||||
if (asSet.has("remove") && asSet.has("upgradeOrRemove")) {
|
||||
return "remove";
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ export const PackageListCard = memo(function PackageListCard({
|
|||
if (packageRow.latest.status === "upgradable") {
|
||||
if (envVersion == null)
|
||||
envVersion = packageRow.latest.pkg.env_version;
|
||||
else if (envVersion != packageRow.latest.pkg.env_version)
|
||||
else if (envVersion !== packageRow.latest.pkg.env_version)
|
||||
throw new Error("Inconsistent env_version");
|
||||
packages.push(packageRow.latest.pkg.index);
|
||||
hasUnityIncompatibleLatest ||=
|
||||
|
|
@ -247,7 +247,7 @@ export const PackageListCard = memo(function PackageListCard({
|
|||
|
||||
if (envVersion == null)
|
||||
envVersion = packageRow.latest.pkg.env_version;
|
||||
else if (envVersion != packageRow.latest.pkg.env_version)
|
||||
else if (envVersion !== packageRow.latest.pkg.env_version)
|
||||
throw new Error("Inconsistent env_version");
|
||||
|
||||
packages.push(packageRow.latest.pkg.index);
|
||||
|
|
@ -285,7 +285,7 @@ export const PackageListCard = memo(function PackageListCard({
|
|||
|
||||
if (envVersion == null)
|
||||
envVersion = packageRow.latest.pkg.env_version;
|
||||
else if (envVersion != packageRow.latest.pkg.env_version)
|
||||
else if (envVersion !== packageRow.latest.pkg.env_version)
|
||||
throw new Error("Inconsistent env_version");
|
||||
|
||||
packages.push(packageRow.latest.pkg.index);
|
||||
|
|
@ -321,7 +321,7 @@ export const PackageListCard = memo(function PackageListCard({
|
|||
const possibleUpdate: PackageBulkUpdateMode | "nothing" =
|
||||
bulkUpdateModeForPackage(row);
|
||||
|
||||
if (possibleUpdate == "nothing") return;
|
||||
if (possibleUpdate === "nothing") return;
|
||||
setBulkUpdatePackageIds((prev) => {
|
||||
if (prev.some(([id, _]) => id === row.id)) return prev;
|
||||
return [...prev, [row.id, possibleUpdate]];
|
||||
|
|
@ -371,18 +371,24 @@ export const PackageListCard = memo(function PackageListCard({
|
|||
<thead>
|
||||
<tr>
|
||||
<th
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground`}
|
||||
></th>
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground"
|
||||
}
|
||||
/>
|
||||
{TABLE_HEAD.map((head, index) => (
|
||||
<th
|
||||
key={index}
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
>
|
||||
<small className="font-normal leading-none">{tc(head)}</small>
|
||||
</th>
|
||||
))}
|
||||
<th
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
/>
|
||||
</tr>
|
||||
</thead>
|
||||
|
|
@ -559,13 +565,13 @@ function BulkUpdateCard({
|
|||
bulkInstallAll?: () => void;
|
||||
cancel?: () => void;
|
||||
}) {
|
||||
if (bulkUpdateMode == "any") return null;
|
||||
if (bulkUpdateMode === "any") return null;
|
||||
|
||||
const canInstall = bulkUpdateMode == "install";
|
||||
const canInstall = bulkUpdateMode === "install";
|
||||
const canUpgrade =
|
||||
bulkUpdateMode == "upgrade" || bulkUpdateMode == "upgradeOrRemove";
|
||||
bulkUpdateMode === "upgrade" || bulkUpdateMode === "upgradeOrRemove";
|
||||
const canRemove =
|
||||
bulkUpdateMode == "remove" || bulkUpdateMode == "upgradeOrRemove";
|
||||
bulkUpdateMode === "remove" || bulkUpdateMode === "upgradeOrRemove";
|
||||
|
||||
return (
|
||||
<Card
|
||||
|
|
@ -715,7 +721,7 @@ const PackageRow = memo(function PackageRow({
|
|||
[onInstallRequested, pkg],
|
||||
);
|
||||
const installLatest = () => {
|
||||
if (pkg.latest.status == "none") return;
|
||||
if (pkg.latest.status === "none") return;
|
||||
onInstallRequested(pkg.latest.pkg, pkg.latest.hasUnityIncompatibleLatest);
|
||||
};
|
||||
|
||||
|
|
@ -777,13 +783,13 @@ const PackageRow = memo(function PackageRow({
|
|||
/>
|
||||
</td>
|
||||
<td className={`${noGrowCellClass} max-w-32 overflow-hidden`}>
|
||||
{pkg.sources.size == 0 ? (
|
||||
{pkg.sources.size === 0 ? (
|
||||
pkg.isThereSource ? (
|
||||
<p>{tc("projects:manage:source not selected")}</p>
|
||||
) : (
|
||||
<p>{tc("projects:manage:none")}</p>
|
||||
)
|
||||
) : pkg.sources.size == 1 ? (
|
||||
) : pkg.sources.size === 1 ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger>
|
||||
<p className="overflow-hidden overflow-ellipsis">
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ function PageBody() {
|
|||
function checkIfMigrationTo2022Recommended(data: TauriProjectDetails) {
|
||||
if (data.unity == null) return false;
|
||||
// migrate if the project is using 2019 and has vrcsdk
|
||||
if (data.unity[0] != 2019) return false;
|
||||
if (data.unity[0] !== 2019) return false;
|
||||
return data.installed_packages.some(([id, _]) =>
|
||||
VRCSDK_PACKAGES.includes(id),
|
||||
);
|
||||
|
|
@ -226,18 +226,18 @@ function PageBody() {
|
|||
return false;
|
||||
|
||||
if (data.unity == null) return false;
|
||||
if (data.unity[0] != 2022) return false;
|
||||
if (data.unity[0] !== 2022) return false;
|
||||
// unity patch is 2022.
|
||||
return data.unity_str != unityData.recommended_version;
|
||||
return data.unity_str !== unityData.recommended_version;
|
||||
}
|
||||
|
||||
const isResolveRecommended = detailsResult?.data?.should_resolve;
|
||||
const isMigrationTo2022Recommended =
|
||||
detailsResult.status == "success" &&
|
||||
detailsResult.status === "success" &&
|
||||
checkIfMigrationTo2022Recommended(detailsResult.data);
|
||||
const is2022PatchMigrationRecommended =
|
||||
detailsResult.status == "success" &&
|
||||
unityVersionsResult.status == "success" &&
|
||||
detailsResult.status === "success" &&
|
||||
unityVersionsResult.status === "success" &&
|
||||
checkIf2022PatchMigrationRecommended(
|
||||
detailsResult.data,
|
||||
unityVersionsResult.data,
|
||||
|
|
@ -277,7 +277,7 @@ function PageBody() {
|
|||
},
|
||||
)}
|
||||
</p>
|
||||
<div className={"flex-grow-0 flex-shrink-0 w-2"}></div>
|
||||
<div className={"flex-grow-0 flex-shrink-0 w-2"} />
|
||||
<div className="flex-grow-0 flex-shrink-0 flex flex-row items-center">
|
||||
<p className="cursor-pointer py-1.5 font-bold flex-grow-0 flex-shrink-0">
|
||||
{tc("projects:manage:unity version")}
|
||||
|
|
@ -380,7 +380,7 @@ function UnityVersionSelector({
|
|||
onValueChange={onChange}
|
||||
>
|
||||
<SelectTrigger>
|
||||
{detailsResult.status == "success" ? (
|
||||
{detailsResult.status === "success" ? (
|
||||
detailsResult.data.unity_str ?? "unknown"
|
||||
) : (
|
||||
<span className={"text-primary"}>Loading...</span>
|
||||
|
|
@ -416,7 +416,7 @@ function SuggestResolveProjectCard({
|
|||
<p className="cursor-pointer py-1.5 font-bold flex-grow-0 flex-shrink overflow-hidden whitespace-normal text-sm">
|
||||
{tc("projects:manage:suggest resolve")}
|
||||
</p>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"}></div>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"} />
|
||||
<Button
|
||||
variant={"ghost-destructive"}
|
||||
onClick={onResolveRequested}
|
||||
|
|
@ -440,7 +440,7 @@ function SuggestMigrateTo2022Card({
|
|||
<p className="cursor-pointer py-1.5 font-bold flex-grow-0 flex-shrink overflow-hidden whitespace-normal text-sm">
|
||||
{tc("projects:manage:suggest unity migration")}
|
||||
</p>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"}></div>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"} />
|
||||
<Button
|
||||
variant={"ghost-destructive"}
|
||||
onClick={onMigrateRequested}
|
||||
|
|
@ -464,7 +464,7 @@ function Suggest2022PatchMigrationCard({
|
|||
<p className="cursor-pointer py-1.5 font-bold flex-grow-0 flex-shrink overflow-hidden whitespace-normal text-sm">
|
||||
{tc("projects:manage:suggest unity patch migration")}
|
||||
</p>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"}></div>
|
||||
<div className={"flex-grow flex-shrink-0 w-2"} />
|
||||
<Button
|
||||
variant={"ghost-destructive"}
|
||||
onClick={onMigrateRequested}
|
||||
|
|
@ -520,7 +520,7 @@ function ProjectViewHeader({
|
|||
{projectName}
|
||||
</p>
|
||||
|
||||
<div className="relative flex gap-2 w-max flex-grow"></div>
|
||||
<div className="relative flex gap-2 w-max flex-grow" />
|
||||
|
||||
<DropdownMenu>
|
||||
<div className={"flex divide-x"}>
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ function findRecommendedUnity(
|
|||
unityVersions: TauriUnityVersions,
|
||||
): FindUnityResult {
|
||||
const versions = unityVersions.unity_paths.filter(
|
||||
([_p, v, _]) => v == unityVersions.recommended_version,
|
||||
([_p, v, _]) => v === unityVersions.recommended_version,
|
||||
);
|
||||
|
||||
if (versions.length == 0) {
|
||||
if (versions.length === 0) {
|
||||
return {
|
||||
expectingVersion: unityVersions.recommended_version,
|
||||
installLink: unityVersions.install_recommended_version_link,
|
||||
|
|
@ -153,7 +153,7 @@ export function useUnityVersionChange({
|
|||
updateProjectPreUnityLaunch: async (project, data) => {
|
||||
if (
|
||||
data.isVRC &&
|
||||
data.kind == "upgradeMajor" &&
|
||||
data.kind === "upgradeMajor" &&
|
||||
data.targetUnityVersion.startsWith("2022.")
|
||||
) {
|
||||
await projectMigrateProjectTo2022(project);
|
||||
|
|
@ -313,10 +313,10 @@ function detectChangeUnityKind(
|
|||
|
||||
const kind: ChangeUnityData["kind"] =
|
||||
compareUnityVersionString(currentVersion, targetUnityVersion) >= 0
|
||||
? parsedCurrent.major == parsedTarget.major
|
||||
? parsedCurrent.major === parsedTarget.major
|
||||
? "downgradePatchOrMinor"
|
||||
: "downgradeMajor"
|
||||
: parsedCurrent.major == parsedTarget.major
|
||||
: parsedCurrent.major === parsedTarget.major
|
||||
? "upgradePatchOrMinor"
|
||||
: "upgradeMajor";
|
||||
|
||||
|
|
@ -343,9 +343,9 @@ function findUnityForUnityChange(
|
|||
data: ChangeUnityData,
|
||||
): FindUnityResult {
|
||||
const foundVersions = unityVersions.unity_paths.filter(
|
||||
([_p, v, _]) => v == data.targetUnityVersion,
|
||||
([_p, v, _]) => v === data.targetUnityVersion,
|
||||
);
|
||||
if (foundVersions.length == 0) throw new Error("unreachable");
|
||||
if (foundVersions.length === 0) throw new Error("unreachable");
|
||||
return {
|
||||
expectingVersion: data.targetUnityVersion,
|
||||
found: true,
|
||||
|
|
@ -457,12 +457,13 @@ function useMigrationInternal<Data>({
|
|||
case 1:
|
||||
void continueChangeUnityVersion(inPlace, unityFound[0][0], data);
|
||||
break;
|
||||
default:
|
||||
default: {
|
||||
const selected = await unitySelector.select(unityFound);
|
||||
if (selected == null) setInstallStatus({ state: "normal" });
|
||||
else
|
||||
void continueChangeUnityVersion(inPlace, selected.unityPath, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
|
@ -495,7 +496,7 @@ function useMigrationInternal<Data>({
|
|||
[migrateProjectPath, unityPath],
|
||||
(lineString) => {
|
||||
setInstallStatus((prev) => {
|
||||
if (prev.state != "finalizing") return prev;
|
||||
if (prev.state !== "finalizing") return prev;
|
||||
lineNumber++;
|
||||
const line: [number, string] = [lineNumber, lineString];
|
||||
if (prev.lines.length > 200) {
|
||||
|
|
@ -507,7 +508,7 @@ function useMigrationInternal<Data>({
|
|||
},
|
||||
);
|
||||
const finalizeResult = await promise;
|
||||
if (finalizeResult == "cancelled") {
|
||||
if (finalizeResult === "cancelled") {
|
||||
throw new Error("unexpectedly cancelled");
|
||||
}
|
||||
switch (finalizeResult.type) {
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ export function usePackageChangeDialog({
|
|||
let dialogForState: React.ReactNode = null;
|
||||
|
||||
switch (installStatus.status) {
|
||||
case "promptingChanges":
|
||||
case "promptingChanges": {
|
||||
const applyChanges = async ({
|
||||
changes,
|
||||
requested,
|
||||
|
|
@ -210,6 +210,7 @@ export function usePackageChangeDialog({
|
|||
/>
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -271,7 +272,7 @@ function ProjectChangesDialog({
|
|||
compareVersion(
|
||||
c.InstallNew.version,
|
||||
existingPackageMap.get(pkgId)!.version,
|
||||
) == 0,
|
||||
) === 0,
|
||||
);
|
||||
const installingNewPackages = installingPackages.filter(
|
||||
([pkgId, c]) =>
|
||||
|
|
@ -279,7 +280,7 @@ function ProjectChangesDialog({
|
|||
compareVersion(
|
||||
c.InstallNew.version,
|
||||
existingPackageMap.get(pkgId)!.version,
|
||||
) != 0,
|
||||
) !== 0,
|
||||
);
|
||||
|
||||
const removingRequestedPackages = removingPackages.filter(
|
||||
|
|
@ -302,7 +303,7 @@ function ProjectChangesDialog({
|
|||
if (url == null) return null;
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.protocol == "http:" || parsed.protocol == "https:") {
|
||||
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
||||
return (
|
||||
<Button
|
||||
className={"ml-1 px-2"}
|
||||
|
|
|
|||
|
|
@ -80,11 +80,11 @@ export default function Page() {
|
|||
setSearch={setSearch}
|
||||
/>
|
||||
|
||||
{result.status == "pending" ? (
|
||||
{result.status === "pending" ? (
|
||||
<Card className="w-full shadow-none overflow-hidden p-4">
|
||||
{tc("general:loading...")}
|
||||
</Card>
|
||||
) : result.status == "error" ? (
|
||||
) : result.status === "error" ? (
|
||||
<Card className="w-full shadow-none overflow-hidden p-4">
|
||||
{tc("projects:error:load error", { msg: result.error.message })}
|
||||
</Card>
|
||||
|
|
@ -224,8 +224,8 @@ function ProjectsTableCard({
|
|||
return searched;
|
||||
}, [projects, sorting, search]);
|
||||
|
||||
const thClass = `sticky top-0 z-10 border-b border-primary p-2.5`;
|
||||
const iconClass = `size-3 invisible project-table-header-chevron-up-down`;
|
||||
const thClass = "sticky top-0 z-10 border-b border-primary p-2.5";
|
||||
const iconClass = "size-3 invisible project-table-header-chevron-up-down";
|
||||
|
||||
const setSorting = async (simpleSorting: SimpleSorting) => {
|
||||
let newSorting: Sorting;
|
||||
|
|
@ -310,9 +310,7 @@ function ProjectsTableCard({
|
|||
</small>
|
||||
</button>
|
||||
</th>
|
||||
<th
|
||||
className={`${thClass} bg-secondary text-secondary-foreground`}
|
||||
></th>
|
||||
<th className={`${thClass} bg-secondary text-secondary-foreground`} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ export function ProjectRow({
|
|||
|
||||
const cellClass = "p-2.5";
|
||||
const noGrowCellClass = `${cellClass} w-1`;
|
||||
const typeIconClass = `w-5 h-5`;
|
||||
const typeIconClass = "w-5 h-5";
|
||||
|
||||
const projectTypeKind = ProjectDisplayType[project.project_type] ?? "unknown";
|
||||
const displayType = tc(`projects:type:${projectTypeKind}`);
|
||||
|
|
|
|||
|
|
@ -217,7 +217,9 @@ function RepositoryTableBody({
|
|||
{TABLE_HEAD.map((head, index) => (
|
||||
<th
|
||||
key={index}
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
>
|
||||
<small className="font-normal leading-none">{tc(head)}</small>
|
||||
</th>
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ export function useAddRepository({
|
|||
case "duplicated":
|
||||
dialogBody = <Duplicated cancel={cancel} />;
|
||||
break;
|
||||
case "confirming":
|
||||
case "confirming": {
|
||||
const doAddRepository = async () => {
|
||||
try {
|
||||
await environmentAddRepository(state.url, state.headers);
|
||||
|
|
@ -139,6 +139,7 @@ export function useAddRepository({
|
|||
/>
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertNever(state, "state");
|
||||
}
|
||||
|
|
@ -181,13 +182,13 @@ function EnteringRepositoryInfo({
|
|||
for (const { value, name } of reordableListContext.value) {
|
||||
const trimedName = name.trim();
|
||||
const trimedValue = value.trim();
|
||||
if (trimedName != "" || trimedValue != "") {
|
||||
if (trimedName !== "" || trimedValue !== "") {
|
||||
// header (field) name is token (RFC 9110 section 5.1)
|
||||
// https://www.rfc-editor.org/rfc/rfc9110.html#name-field-names
|
||||
// token is defined in 5.6.2
|
||||
// https://www.rfc-editor.org/rfc/rfc9110.html#name-tokens
|
||||
if (
|
||||
trimedName == "" ||
|
||||
trimedName === "" ||
|
||||
!trimedName.match(/[!#$%&'*+\-.^_`|~0-9a-zA-Z]/)
|
||||
) {
|
||||
foundHeaderNameError = true;
|
||||
|
|
@ -241,7 +242,7 @@ function EnteringRepositoryInfo({
|
|||
value={url}
|
||||
onChange={(e) => setUrl(e.target.value)}
|
||||
placeholder={"https://vpm.anatawa12.com/vpm.json"}
|
||||
></Input>
|
||||
/>
|
||||
<details>
|
||||
<summary className={"font-bold"}>
|
||||
{tc("vpm repositories:dialog:headers")}
|
||||
|
|
@ -257,7 +258,7 @@ function EnteringRepositoryInfo({
|
|||
<th className={"sticky top-0 z-10 bg-background"}>
|
||||
{tc("vpm repositories:dialog:header value")}
|
||||
</th>
|
||||
<th className={"sticky top-0 z-10 bg-background"}></th>
|
||||
<th className={"sticky top-0 z-10 bg-background"} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ export function useImportRepositories({
|
|||
cancel,
|
||||
});
|
||||
const result = await resultPromise;
|
||||
if (result == "cancelled") {
|
||||
if (result === "cancelled") {
|
||||
return;
|
||||
}
|
||||
setState({ type: "confirmingPackages", repositories: result });
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ export default function RenderPage({
|
|||
<br />
|
||||
Here are the licenses of the projects used in this project:
|
||||
</p>
|
||||
<ul></ul>
|
||||
<ul />
|
||||
</Card>
|
||||
|
||||
{licenses.map((license, idx) => (
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ function Settings({
|
|||
settings: TauriEnvironmentSettings;
|
||||
refetch: () => void;
|
||||
}) {
|
||||
const isMac = useGlobalInfo().osType == "Darwin";
|
||||
const isMac = useGlobalInfo().osType === "Darwin";
|
||||
|
||||
return (
|
||||
<ScrollPageContainer>
|
||||
|
|
@ -194,7 +194,9 @@ function UnityInstallationsCard({
|
|||
{UNITY_TABLE_HEAD.map((head, index) => (
|
||||
<th
|
||||
key={index}
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
>
|
||||
<small className="font-normal leading-none">{tc(head)}</small>
|
||||
</th>
|
||||
|
|
@ -405,7 +407,7 @@ function AlcomCard({
|
|||
<div>
|
||||
<label className={"flex items-center gap-2"}>
|
||||
<Checkbox
|
||||
checked={releaseChannel == "beta"}
|
||||
checked={releaseChannel === "beta"}
|
||||
onCheckedChange={(e) => changeReleaseChannel(e)}
|
||||
/>
|
||||
{tc("settings:receive beta updates")}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,9 @@ function UnityTableBody() {
|
|||
{UNITY_TABLE_HEAD.map((head, index) => (
|
||||
<th
|
||||
key={index}
|
||||
className={`sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5`}
|
||||
className={
|
||||
"sticky top-0 z-10 border-b border-primary bg-secondary text-secondary-foreground p-2.5"
|
||||
}
|
||||
>
|
||||
<small className="font-normal leading-none">{head}</small>
|
||||
</th>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export default function SetupLayout({
|
|||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
const isDev = process.env.NODE_ENV == "development";
|
||||
const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@ export default function RootLayout({
|
|||
<script src="https://vrc-get.localhost/global-info.js" />
|
||||
</head>
|
||||
<body
|
||||
className={`font-sans w-screen h-screen flex flex-row overflow-hidden whitespace-nowrap`}
|
||||
className={
|
||||
"font-sans w-screen h-screen flex flex-row overflow-hidden whitespace-nowrap"
|
||||
}
|
||||
>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,17 @@
|
|||
"enabled": true
|
||||
},
|
||||
"linter": {
|
||||
"rules": {
|
||||
"style": {
|
||||
// For parallel ifs, we should place else. (we may use conditional operator but if-else looks better)
|
||||
"noUselessElse": "off",
|
||||
"noNonNullAssertion": {
|
||||
// In my opinion, '!.' => '?.' is not reasonable for all cases, so I disabled automatic fix.
|
||||
"fix": "none",
|
||||
"level": "error"
|
||||
}
|
||||
}
|
||||
},
|
||||
"enabled": true
|
||||
},
|
||||
"organizeImports": {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function CheckForUpdateMessage({
|
|||
const [totalBytes, setTotalBytes] = useState(100);
|
||||
|
||||
useTauriListen<UpdateStatusResult>("tauri://update-status", (e) => {
|
||||
if ((e.payload.status as string) == "DOWNLOADED") {
|
||||
if ((e.payload.status as string) === "DOWNLOADED") {
|
||||
setConfirmStatus("waitingForRelaunch");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ export function ReorderableList<T>({
|
|||
{internal.reorderable && (
|
||||
<div className={"flex flex-col w-10 align-middle"}>
|
||||
<Button
|
||||
disabled={disabled || i == 0}
|
||||
disabled={disabled || i === 0}
|
||||
variant={"ghost"}
|
||||
size={"icon"}
|
||||
className={"h-5"}
|
||||
|
|
@ -229,7 +229,7 @@ export function ReorderableList<T>({
|
|||
<ArrowUp className={"size-2.5"} />
|
||||
</Button>
|
||||
<Button
|
||||
disabled={disabled || i == internal.backedList.length - 1}
|
||||
disabled={disabled || i === internal.backedList.length - 1}
|
||||
variant={"ghost"}
|
||||
size={"icon"}
|
||||
className={"h-5"}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export function SideBar({ className }: { className?: string }) {
|
|||
toastNormal(tc("sidebar:toast:version copied"));
|
||||
}
|
||||
};
|
||||
const isDev = process.env.NODE_ENV == "development";
|
||||
const isDev = process.env.NODE_ENV === "development";
|
||||
|
||||
return (
|
||||
<Card
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function Providers({ children }: { children: React.ReactNode }) {
|
|||
);
|
||||
|
||||
const moveToRepositories = useCallback(() => {
|
||||
if (location.pathname != "/repositories") {
|
||||
if (location.pathname !== "/repositories") {
|
||||
router.push("/repositories");
|
||||
}
|
||||
}, [router]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export function assertNever(x: never, message?: string): never {
|
||||
if (message) {
|
||||
throw new Error("Unexpected object: " + x + ": " + message);
|
||||
throw new Error(`Unexpected object: ${x}: ${message}`);
|
||||
} else {
|
||||
throw new Error("Unexpected object: " + x);
|
||||
throw new Error(`Unexpected object: ${x}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export function useBackupProjectModal(_: Params = {}): Result {
|
|||
);
|
||||
setState({ type: "backing-up", cancel });
|
||||
const channel = await promise;
|
||||
if (channel == "cancelled") {
|
||||
if (channel === "cancelled") {
|
||||
toastNormal(tt("projects:toast:backup canceled"));
|
||||
} else {
|
||||
toastSuccess(tt("projects:toast:backup succeeded"));
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ async function callAsyncCommandImpl<A extends any[], P, R>(
|
|||
finishHandler = (message) => {
|
||||
unlistenProgress();
|
||||
unlistenFinished();
|
||||
if (message.type == "Success") {
|
||||
if (message.type === "Success") {
|
||||
resolve(message.value);
|
||||
} else {
|
||||
reject(message.value);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import globalInfo from "./global-info";
|
||||
|
||||
export function pathSeparators(): string[] {
|
||||
return globalInfo.osType == "WindowsNT" ? ["\\", "/"] : ["/"];
|
||||
return globalInfo.osType === "WindowsNT" ? ["\\", "/"] : ["/"];
|
||||
}
|
||||
|
||||
export function pathSeparator(): string {
|
||||
|
|
@ -9,11 +9,11 @@ export function pathSeparator(): string {
|
|||
}
|
||||
|
||||
export function nameFromPath(path: string): string {
|
||||
if (globalInfo.osInfo == "WindowsNT") {
|
||||
if (globalInfo.osInfo === "WindowsNT") {
|
||||
const indexOfSlash = path.lastIndexOf("/");
|
||||
const indexOfBackSlash = path.lastIndexOf("\\");
|
||||
const indexOfSeparator = Math.max(indexOfSlash, indexOfBackSlash);
|
||||
if (indexOfSeparator == -1) return path;
|
||||
if (indexOfSeparator === -1) return path;
|
||||
return path.substring(indexOfSeparator + 1);
|
||||
} else {
|
||||
return path.substring(path.lastIndexOf("/") + 1);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export function useRemoveProjectModal({ onRemoved }: Params): Result {
|
|||
switch (state.type) {
|
||||
case "idle":
|
||||
break;
|
||||
case "confirm":
|
||||
case "confirm": {
|
||||
const project = state.project;
|
||||
|
||||
const removeProjectButton = async (directory: boolean) => {
|
||||
|
|
@ -112,6 +112,7 @@ export function useRemoveProjectModal({ onRemoved }: Params): Result {
|
|||
</DialogOpen>
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "removing":
|
||||
dialog = (
|
||||
<DialogOpen className={"whitespace-normal"}>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export function useOpenUnity(): Result {
|
|||
case 1:
|
||||
{
|
||||
if (selectedPath) {
|
||||
if (foundVersions[0][0] != selectedPath) {
|
||||
if (foundVersions[0][0] !== selectedPath) {
|
||||
// if only unity is not
|
||||
void projectSetUnityPath(projectPath, null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export function useUnitySelectorDialog(): ResultUnitySelector {
|
|||
switch (installStatus.state) {
|
||||
case "normal":
|
||||
break;
|
||||
case "selecting":
|
||||
case "selecting": {
|
||||
const cancel = () => {
|
||||
setInstallStatus({ state: "normal" });
|
||||
installStatus.resolve(null);
|
||||
|
|
@ -109,6 +109,7 @@ export function useUnitySelectorDialog(): ResultUnitySelector {
|
|||
</DialogOpen>
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertNever(installStatus);
|
||||
}
|
||||
|
|
@ -147,7 +148,7 @@ function SelectUnityVersionDialog({
|
|||
>
|
||||
<Checkbox
|
||||
checked={keepUsingThisVersion}
|
||||
onCheckedChange={(e) => setKeepUsingThisVersion(e == true)}
|
||||
onCheckedChange={(e) => setKeepUsingThisVersion(e === true)}
|
||||
className="hover:before:content-none"
|
||||
/>
|
||||
{tc("projects:manage:dialog:keep using this version")}
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ function compareUnityChannel(
|
|||
a: UnityVersion["channel"],
|
||||
b: UnityVersion["channel"],
|
||||
) {
|
||||
if (a == "c") a = "f";
|
||||
if (b == "c") b = "f";
|
||||
if (a === "c") a = "f";
|
||||
if (b === "c") b = "f";
|
||||
|
||||
if (a === b) return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue