Fix to not use cursed empty object type and add lint (#6033)

This commit is contained in:
Jonathan Tran
2025-03-27 18:08:57 -04:00
committed by GitHub
parent 4f35197a96
commit 71b9e40bd9
9 changed files with 15 additions and 9 deletions

View File

@ -20,6 +20,7 @@
"plugin:react-hooks/recommended" "plugin:react-hooks/recommended"
], ],
"rules": { "rules": {
"@typescript-eslint/no-empty-object-type": "error",
"@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": "error", "@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-unused-vars": ["error", { "@typescript-eslint/no-unused-vars": ["error", {

View File

@ -8,7 +8,7 @@ import Tooltip from 'components/Tooltip'
import { roundOff } from 'lib/utils' import { roundOff } from 'lib/utils'
import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine' import { commandBarActor, useCommandBarState } from 'machines/commandBarMachine'
function CommandBarHeader({ children }: React.PropsWithChildren<{}>) { function CommandBarHeader({ children }: React.PropsWithChildren<object>) {
const commandBarState = useCommandBarState() const commandBarState = useCommandBarState()
const { const {
context: { selectedCommand, currentArgument, argumentsToSubmit }, context: { selectedCommand, currentArgument, argumentsToSubmit },

View File

@ -1,11 +1,11 @@
import { Dialog } from '@headlessui/react' import { Dialog } from '@headlessui/react'
import { ActionButton } from 'components/ActionButton' import { ActionButton } from 'components/ActionButton'
interface DeleteConfirmationDialogProps extends React.PropsWithChildren<{}> { type DeleteConfirmationDialogProps = React.PropsWithChildren<{
title: string title: string
onConfirm: () => void onConfirm: () => void
onDismiss: () => void onDismiss: () => void
} }>
export function DeleteConfirmationDialog({ export function DeleteConfirmationDialog({
title, title,

View File

@ -6,7 +6,7 @@ import {
import { ForwardedRef, forwardRef } from 'react' import { ForwardedRef, forwardRef } from 'react'
import { useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
interface AllKeybindingsFieldsProps {} type AllKeybindingsFieldsProps = object
export const AllKeybindingsFields = forwardRef( export const AllKeybindingsFields = forwardRef(
( (

View File

@ -41,7 +41,7 @@ export const COMMAND_APPEARANCE_COLOR_DEFAULT = 'default'
export type HelixModes = 'Axis' | 'Edge' | 'Cylinder' export type HelixModes = 'Axis' | 'Edge' | 'Cylinder'
export type ModelingCommandSchema = { export type ModelingCommandSchema = {
'Enter sketch': {} 'Enter sketch': { forceNewSketch?: boolean }
Export: { Export: {
type: OutputTypeKey type: OutputTypeKey
storage?: StorageUnion storage?: StorageUnion
@ -146,6 +146,8 @@ export type ModelingCommandSchema = {
prompt: string prompt: string
selection: Selections 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': {} 'Delete selection': {}
Appearance: { Appearance: {
nodeToEdit?: PathToNode nodeToEdit?: PathToNode

View File

@ -4,7 +4,7 @@ import { isDesktop } from 'lib/isDesktop'
import { projectsMachine } from 'machines/projectsMachine' import { projectsMachine } from 'machines/projectsMachine'
export type ProjectsCommandSchema = { export type ProjectsCommandSchema = {
'Read projects': {} 'Read projects': Record<string, unknown>
'Create project': { 'Create project': {
name: string name: string
} }

View File

@ -12,7 +12,7 @@ export type FileLoaderData = {
file?: FileEntry file?: FileEntry
} }
export type HomeLoaderData = {} export type HomeLoaderData = Record<string, never>
// From the very helpful @jcalz on StackOverflow: https://stackoverflow.com/a/58436959/22753272 // From the very helpful @jcalz on StackOverflow: https://stackoverflow.com/a/58436959/22753272
type Join<K, P> = K extends string | number type Join<K, P> = K extends string | number

View File

@ -668,7 +668,10 @@ export const modelingMachine = setup({
}, },
'assign tool in context': assign({ 'assign tool in context': assign({
currentTool: ({ event }) => 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 ? event.data.tool
: 'none', : 'none',
}), }),

View File

@ -12,7 +12,7 @@ export const projectsMachine = setup({
hasListedProjects: boolean hasListedProjects: boolean
}, },
events: {} as events: {} as
| { type: 'Read projects'; data: {} } | { type: 'Read projects'; data: ProjectsCommandSchema['Read projects'] }
| { type: 'Open project'; data: ProjectsCommandSchema['Open project'] } | { type: 'Open project'; data: ProjectsCommandSchema['Open project'] }
| { | {
type: 'Rename project' type: 'Rename project'