diff --git a/.eslintrc b/.eslintrc index 6454fb68d..049d639b3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -20,6 +20,7 @@ "plugin:react-hooks/recommended" ], "rules": { + "@typescript-eslint/no-empty-object-type": "error", "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-unused-vars": ["error", { diff --git a/src/components/CommandBar/CommandBarHeader.tsx b/src/components/CommandBar/CommandBarHeader.tsx index c990037b9..2a9526055 100644 --- a/src/components/CommandBar/CommandBarHeader.tsx +++ b/src/components/CommandBar/CommandBarHeader.tsx @@ -8,7 +8,7 @@ import Tooltip from 'components/Tooltip' import { roundOff } from 'lib/utils' import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine' -function CommandBarHeader({ children }: React.PropsWithChildren<{}>) { +function CommandBarHeader({ children }: React.PropsWithChildren) { const commandBarState = useCommandBarState() const { context: { selectedCommand, currentArgument, argumentsToSubmit }, diff --git a/src/components/ProjectCard/DeleteProjectDialog.tsx b/src/components/ProjectCard/DeleteProjectDialog.tsx index 3bc9a002f..0fd43e848 100644 --- a/src/components/ProjectCard/DeleteProjectDialog.tsx +++ b/src/components/ProjectCard/DeleteProjectDialog.tsx @@ -1,11 +1,11 @@ import { Dialog } from '@headlessui/react' import { ActionButton } from 'components/ActionButton' -interface DeleteConfirmationDialogProps extends React.PropsWithChildren<{}> { +type DeleteConfirmationDialogProps = React.PropsWithChildren<{ title: string onConfirm: () => void onDismiss: () => void -} +}> export function DeleteConfirmationDialog({ title, diff --git a/src/components/Settings/AllKeybindingsFields.tsx b/src/components/Settings/AllKeybindingsFields.tsx index b426bf35b..356ec7746 100644 --- a/src/components/Settings/AllKeybindingsFields.tsx +++ b/src/components/Settings/AllKeybindingsFields.tsx @@ -6,7 +6,7 @@ import { import { ForwardedRef, forwardRef } from 'react' import { useLocation } from 'react-router-dom' -interface AllKeybindingsFieldsProps {} +type AllKeybindingsFieldsProps = object export const AllKeybindingsFields = forwardRef( ( diff --git a/src/lib/commandBarConfigs/modelingCommandConfig.ts b/src/lib/commandBarConfigs/modelingCommandConfig.ts index 0719760d1..efefd1fa9 100644 --- a/src/lib/commandBarConfigs/modelingCommandConfig.ts +++ b/src/lib/commandBarConfigs/modelingCommandConfig.ts @@ -41,7 +41,7 @@ export const COMMAND_APPEARANCE_COLOR_DEFAULT = 'default' export type HelixModes = 'Axis' | 'Edge' | 'Cylinder' export type ModelingCommandSchema = { - 'Enter sketch': {} + 'Enter sketch': { forceNewSketch?: boolean } Export: { type: OutputTypeKey storage?: StorageUnion @@ -146,6 +146,8 @@ export type ModelingCommandSchema = { prompt: string selection: Selections } + // TODO: {} means any non-nullish value. This is probably not what we want. + // eslint-disable-next-line @typescript-eslint/no-empty-object-type 'Delete selection': {} Appearance: { nodeToEdit?: PathToNode diff --git a/src/lib/commandBarConfigs/projectsCommandConfig.ts b/src/lib/commandBarConfigs/projectsCommandConfig.ts index 5141ce961..8c6f1550f 100644 --- a/src/lib/commandBarConfigs/projectsCommandConfig.ts +++ b/src/lib/commandBarConfigs/projectsCommandConfig.ts @@ -4,7 +4,7 @@ import { isDesktop } from 'lib/isDesktop' import { projectsMachine } from 'machines/projectsMachine' export type ProjectsCommandSchema = { - 'Read projects': {} + 'Read projects': Record 'Create project': { name: string } diff --git a/src/lib/types.ts b/src/lib/types.ts index d897d6680..b76a5c8f2 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -12,7 +12,7 @@ export type FileLoaderData = { file?: FileEntry } -export type HomeLoaderData = {} +export type HomeLoaderData = Record // From the very helpful @jcalz on StackOverflow: https://stackoverflow.com/a/58436959/22753272 type Join = K extends string | number diff --git a/src/machines/modelingMachine.ts b/src/machines/modelingMachine.ts index 9adaeecbc..a8a7762fb 100644 --- a/src/machines/modelingMachine.ts +++ b/src/machines/modelingMachine.ts @@ -668,7 +668,10 @@ export const modelingMachine = setup({ }, 'assign tool in context': assign({ currentTool: ({ event }) => - 'data' in event && event.data && 'tool' in event.data + 'data' in event && + event.data && + typeof event.data === 'object' && + 'tool' in event.data ? event.data.tool : 'none', }), diff --git a/src/machines/projectsMachine.ts b/src/machines/projectsMachine.ts index 408360870..7344259f6 100644 --- a/src/machines/projectsMachine.ts +++ b/src/machines/projectsMachine.ts @@ -12,7 +12,7 @@ export const projectsMachine = setup({ hasListedProjects: boolean }, events: {} as - | { type: 'Read projects'; data: {} } + | { type: 'Read projects'; data: ProjectsCommandSchema['Read projects'] } | { type: 'Open project'; data: ProjectsCommandSchema['Open project'] } | { type: 'Rename project'