Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

chore: add biome-lint to remove unused imports (#2116)

Myles Scolnick71475b4a8186
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9f10009462..19dc8e2dc7 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -30,9 +30,9 @@ repos:
- repo: https://github.com/biomejs/pre-commit
rev: v0.4.0
hooks:
- - id: biome-format
- args: [--config-path, frontend/biome.json]
- additional_dependencies: ["@biomejs/[email protected]"]
+ - id: biome-check
+ args: [--config-path, biome.json]
+ additional_dependencies: ['@biomejs/[email protected]']
exclude: |
(?x)^(
docs/_static/.*|
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000000..699ed73319
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,3 @@
+{
+ "recommendations": ["biomejs.biome"]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000..607c4c8956
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,11 @@
+{
+ "[javascript]": {
+ "editor.defaultFormatter": "biomejs.biome"
+ },
+ "[typescript]": {
+ "editor.defaultFormatter": "biomejs.biome"
+ },
+ "[typescriptreact]": {
+ "editor.defaultFormatter": "biomejs.biome"
+ }
+}
diff --git a/biome.json b/biome.json
new file mode 100644
index 0000000000..6183906abc
--- /dev/null
+++ b/biome.json
@@ -0,0 +1,100 @@
+{
+ "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
+ "formatter": {
+ "enabled": true,
+ "formatWithErrors": false,
+ "indentStyle": "space",
+ "indentWidth": 2,
+ "lineEnding": "lf",
+ "lineWidth": 80,
+ "attributePosition": "auto",
+ "ignore": [
+ "dist",
+ "lib",
+ "pnpm-lock.yaml",
+ "storybook-static",
+ "package.json"
+ ]
+ },
+ "organizeImports": {
+ "ignore": [
+ "dist",
+ "lib",
+ "pnpm-lock.yaml",
+ "storybook-static",
+ "package.json"
+ ],
+ "enabled": false
+ },
+ "linter": {
+ "ignore": [
+ "dist",
+ "lib",
+ "pnpm-lock.yaml",
+ "storybook-static",
+ "package.json"
+ ],
+ "enabled": true,
+ "rules": {
+ "recommended": true,
+ "a11y": {
+ "noAutofocus": "off",
+ "noSvgWithoutTitle": "off",
+ "useButtonType": "off",
+ "useIframeTitle": "off",
+ "useKeyWithClickEvents": "off",
+ "useMediaCaption": "off"
+ },
+ "complexity": {
+ "noBannedTypes": "off",
+ "noForEach": "off",
+ "useArrowFunction": "off"
+ },
+ "correctness": {
+ "noInnerDeclarations": "off",
+ "noUnusedImports": "error",
+ "useExhaustiveDependencies": "off",
+ "useHookAtTopLevel": "off"
+ },
+ "security": {
+ "noDangerouslySetInnerHtml": "off"
+ },
+ "style": {
+ "noCommaOperator": "off",
+ "noNonNullAssertion": "off",
+ "noParameterAssign": "off",
+ "noUnusedTemplateLiteral": "off",
+ "useConsistentArrayType": "off",
+ "useImportType": "off",
+ "useNodejsImportProtocol": "off",
+ "useSingleVarDeclarator": "off",
+ "useTemplate": "off"
+ },
+ "suspicious": {
+ "noArrayIndexKey": "off",
+ "noAssignInExpressions": "off",
+ "noConsoleLog": "off",
+ "noDoubleEquals": "off",
+ "noEmptyBlockStatements": "off",
+ "noExplicitAny": "off",
+ "noImplicitAnyLet": "off",
+ "noRedeclare": "off",
+ "noShadowRestrictedNames": "off"
+ }
+ }
+ },
+ "javascript": {
+ "jsxRuntime": "reactClassic",
+ "formatter": {
+ "jsxQuoteStyle": "double",
+ "quoteProperties": "asNeeded",
+ "trailingCommas": "all",
+ "semicolons": "always",
+ "arrowParentheses": "always",
+ "bracketSpacing": true,
+ "bracketSameLine": false,
+ "quoteStyle": "double",
+ "attributePosition": "auto"
+ }
+ }
+}
diff --git a/frontend/biome.json b/frontend/biome.json
deleted file mode 100644
index 217d2b0f85..0000000000
--- a/frontend/biome.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
- "formatter": {
- "enabled": true,
- "formatWithErrors": false,
- "indentStyle": "space",
- "indentWidth": 2,
- "lineEnding": "lf",
- "lineWidth": 80,
- "attributePosition": "auto",
- "ignore": [
- "dist",
- "lib",
- "pnpm-lock.yaml",
- "storybook-static",
- "package.json"
- ]
- },
- "organizeImports": { "enabled": true },
- "linter": { "enabled": true, "rules": { "recommended": true } },
- "javascript": {
- "formatter": {
- "jsxQuoteStyle": "double",
- "quoteProperties": "asNeeded",
- "trailingCommas": "all",
- "semicolons": "always",
- "arrowParentheses": "always",
- "bracketSpacing": true,
- "bracketSameLine": false,
- "quoteStyle": "double",
- "attributePosition": "auto"
- }
- }
-}
diff --git a/frontend/e2e-tests/components.spec.ts b/frontend/e2e-tests/components.spec.ts
index 3dc2d9bbfb..0fe776cda9 100644
--- a/frontend/e2e-tests/components.spec.ts
+++ b/frontend/e2e-tests/components.spec.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { test, expect, Page } from "@playwright/test";
+import { test, expect, type Page } from "@playwright/test";
import { getAppUrl } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
diff --git a/frontend/e2e-tests/helper.ts b/frontend/e2e-tests/helper.ts
index d0a0b345cb..310d85a0cf 100644
--- a/frontend/e2e-tests/helper.ts
+++ b/frontend/e2e-tests/helper.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Page, expect } from "@playwright/test";
-import { HotkeyProvider, HotkeyAction } from "../src/core/hotkeys/hotkeys";
+import { type Page, expect } from "@playwright/test";
+import { HotkeyProvider, type HotkeyAction } from "../src/core/hotkeys/hotkeys";
import path from "node:path";
export async function createCellBelow(opts: {
diff --git a/frontend/e2e-tests/layout-grid.spec.ts b/frontend/e2e-tests/layout-grid.spec.ts
index 97476ada67..1b3b5b10ea 100644
--- a/frontend/e2e-tests/layout-grid.spec.ts
+++ b/frontend/e2e-tests/layout-grid.spec.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { test, expect, Page } from "@playwright/test";
+import { test, expect, type Page } from "@playwright/test";
import { getAppUrl } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
diff --git a/frontend/e2e-tests/mode.spec.ts b/frontend/e2e-tests/mode.spec.ts
index 80aa697188..337b513115 100644
--- a/frontend/e2e-tests/mode.spec.ts
+++ b/frontend/e2e-tests/mode.spec.ts
@@ -1,6 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { test, expect, Page, BrowserContext } from "@playwright/test";
-import { ApplicationNames, getAppMode, getAppUrl } from "../playwright.config";
+import { test, expect, type Page, type BrowserContext } from "@playwright/test";
+import {
+ type ApplicationNames,
+ getAppMode,
+ getAppUrl,
+} from "../playwright.config";
import { maybeRestartKernel, takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
diff --git a/frontend/islands/vite.config.mts b/frontend/islands/vite.config.mts
index f4d0ff2afe..27df09ce0d 100644
--- a/frontend/islands/vite.config.mts
+++ b/frontend/islands/vite.config.mts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Plugin, defineConfig } from "vite";
+import { type Plugin, defineConfig } from "vite";
import fs from "fs";
import path from "path";
import react from "@vitejs/plugin-react-swc";
diff --git a/frontend/package.json b/frontend/package.json
index 760b652d77..ece1eb01f2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -149,6 +149,7 @@
"test": "vitest",
"typecheck": "tsc --noEmit",
"lint": "run-s lint:eslint lint:stylelint format",
+ "lint:biome": "biome lint --write .",
"lint:eslint": "TIMING=1 eslint src e2e-tests --max-warnings=0 --fix",
"lint:stylelint": "stylelint src/**/*.css --fix",
"format": "biome format --write .",
diff --git a/frontend/src/components/app-config/app-config-form.tsx b/frontend/src/components/app-config/app-config-form.tsx
index 4d5f6dfd3d..6a694c4ba7 100644
--- a/frontend/src/components/app-config/app-config-form.tsx
+++ b/frontend/src/components/app-config/app-config-form.tsx
@@ -11,7 +11,7 @@ import {
FormMessage,
} from "@/components/ui/form";
import {
- AppConfig,
+ type AppConfig,
AppConfigSchema,
APP_WIDTHS,
AppTitleSchema,
diff --git a/frontend/src/components/app-config/common.tsx b/frontend/src/components/app-config/common.tsx
index 299cba9981..7c37240387 100644
--- a/frontend/src/components/app-config/common.tsx
+++ b/frontend/src/components/app-config/common.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { PropsWithChildren } from "react";
+import type { PropsWithChildren } from "react";
export const SettingTitle: React.FC<PropsWithChildren> = ({ children }) => {
return (
diff --git a/frontend/src/components/audio/audio-recorder.tsx b/frontend/src/components/audio/audio-recorder.tsx
index bd9290bf4e..d08b57e5ed 100644
--- a/frontend/src/components/audio/audio-recorder.tsx
+++ b/frontend/src/components/audio/audio-recorder.tsx
@@ -3,7 +3,7 @@ import { cn } from "@/utils/cn";
import React from "react";
import { Button } from "../ui/button";
import { CircleIcon, SquareIcon } from "lucide-react";
-import { RecordingStatus } from "@/hooks/useAudioRecorder";
+import type { RecordingStatus } from "@/hooks/useAudioRecorder";
interface AudioRecorderProps {
onStart: () => void;
diff --git a/frontend/src/components/data-table/chart-spec-model.tsx b/frontend/src/components/data-table/chart-spec-model.tsx
index 113aef7244..c61e77afda 100644
--- a/frontend/src/components/data-table/chart-spec-model.tsx
+++ b/frontend/src/components/data-table/chart-spec-model.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
+import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
import { mint, orange, slate } from "@radix-ui/colors";
-import { ColumnHeaderSummary, FieldTypes } from "./types";
+import type { ColumnHeaderSummary, FieldTypes } from "./types";
export class ColumnChartSpecModel<T> {
private columnSummaries = new Map<string | number, ColumnHeaderSummary>();
diff --git a/frontend/src/components/data-table/column-wrapping/feature.ts b/frontend/src/components/data-table/column-wrapping/feature.ts
index 31ea247184..b476a28d6b 100644
--- a/frontend/src/components/data-table/column-wrapping/feature.ts
+++ b/frontend/src/components/data-table/column-wrapping/feature.ts
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- TableFeature,
- RowData,
+ type TableFeature,
+ type RowData,
makeStateUpdater,
- Table,
- Column,
- Updater,
+ type Table,
+ type Column,
+ type Updater,
} from "@tanstack/react-table";
-import {
+import type {
ColumnWrappingTableState,
ColumnWrappingOptions,
ColumnWrappingState,
diff --git a/frontend/src/components/data-table/column-wrapping/types.ts b/frontend/src/components/data-table/column-wrapping/types.ts
index 83ede2e86c..048f8a986b 100644
--- a/frontend/src/components/data-table/column-wrapping/types.ts
+++ b/frontend/src/components/data-table/column-wrapping/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-empty-interface */
-import { OnChangeFn, RowData } from "@tanstack/react-table";
+import type { OnChangeFn, RowData } from "@tanstack/react-table";
export type ColumnWrappingState = Record<string, "nowrap" | "wrap" | undefined>;
export interface ColumnWrappingTableState {
diff --git a/frontend/src/components/data-table/filter-pills.tsx b/frontend/src/components/data-table/filter-pills.tsx
index 3ef1cd69b2..239dc610d5 100644
--- a/frontend/src/components/data-table/filter-pills.tsx
+++ b/frontend/src/components/data-table/filter-pills.tsx
@@ -1,7 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ColumnFilter, ColumnFiltersState, Table } from "@tanstack/react-table";
+import type {
+ ColumnFilter,
+ ColumnFiltersState,
+ Table,
+} from "@tanstack/react-table";
import { Badge } from "../ui/badge";
-import { ColumnFilterValue } from "./filters";
+import type { ColumnFilterValue } from "./filters";
import { logNever } from "@/utils/assertNever";
import { XIcon } from "lucide-react";
diff --git a/frontend/src/components/data-table/filters.ts b/frontend/src/components/data-table/filters.ts
index 11fe585f9e..8cc0736fc9 100644
--- a/frontend/src/components/data-table/filters.ts
+++ b/frontend/src/components/data-table/filters.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataType } from "@/core/kernel/messages";
-import { ConditionType } from "@/plugins/impl/data-frames/schema";
-import { ColumnId } from "@/plugins/impl/data-frames/types";
+import type { DataType } from "@/core/kernel/messages";
+import type { ConditionType } from "@/plugins/impl/data-frames/schema";
+import type { ColumnId } from "@/plugins/impl/data-frames/types";
import { assertNever } from "@/utils/assertNever";
-import { RowData } from "@tanstack/react-table";
+import type { RowData } from "@tanstack/react-table";
declare module "@tanstack/react-table" {
//allows us to define custom properties for our columns
diff --git a/frontend/src/components/data-table/mime-cell.tsx b/frontend/src/components/data-table/mime-cell.tsx
index bc2c02c7fc..71e2a4a9c4 100644
--- a/frontend/src/components/data-table/mime-cell.tsx
+++ b/frontend/src/components/data-table/mime-cell.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { cn } from "@/utils/cn";
import { OutputRenderer } from "../editor/Output";
-import { OutputMessage } from "@/core/kernel/messages";
+import type { OutputMessage } from "@/core/kernel/messages";
interface MimeCellProps {
value: unknown;
diff --git a/frontend/src/components/data-table/pagination.tsx b/frontend/src/components/data-table/pagination.tsx
index 571a41d993..2b7d988f14 100644
--- a/frontend/src/components/data-table/pagination.tsx
+++ b/frontend/src/components/data-table/pagination.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Table } from "@tanstack/react-table";
+import type { Table } from "@tanstack/react-table";
import {
ChevronLeft,
ChevronRight,
diff --git a/frontend/src/components/data-table/types.ts b/frontend/src/components/data-table/types.ts
index 3dafb4d0fa..799db863ce 100644
--- a/frontend/src/components/data-table/types.ts
+++ b/frontend/src/components/data-table/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataType } from "@/core/kernel/messages";
+import type { DataType } from "@/core/kernel/messages";
export interface ColumnHeaderSummary {
column: string | number;
diff --git a/frontend/src/components/datasets/icons.tsx b/frontend/src/components/datasets/icons.tsx
index d5b04580b5..f7702994e7 100644
--- a/frontend/src/components/datasets/icons.tsx
+++ b/frontend/src/components/datasets/icons.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataType } from "@/core/kernel/messages";
+import type { DataType } from "@/core/kernel/messages";
import {
ToggleLeftIcon,
CalendarIcon,
diff --git a/frontend/src/components/debugger/debugger-code.tsx b/frontend/src/components/debugger/debugger-code.tsx
index 7593d7f4d9..a0e942d9f2 100644
--- a/frontend/src/components/debugger/debugger-code.tsx
+++ b/frontend/src/components/debugger/debugger-code.tsx
@@ -3,7 +3,7 @@ import { langs } from "@uiw/codemirror-extensions-langs";
import ReactCodeMirror, {
EditorView,
Prec,
- ReactCodeMirrorRef,
+ type ReactCodeMirrorRef,
keymap,
} from "@uiw/react-codemirror";
import React, { memo } from "react";
diff --git a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
index b5d1ce1381..1a1ea3199a 100644
--- a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
@@ -1,28 +1,28 @@
/* Copyright 2024 Marimo. All rights reserved. */
import ReactFlow, {
- Node,
- Edge,
+ type Node,
+ type Edge,
useEdgesState,
useNodesState,
PanOnScrollMode,
useStore,
- CoordinateExtent,
+ type CoordinateExtent,
} from "reactflow";
import React, {
- PropsWithChildren,
+ type PropsWithChildren,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import { nodeTypes } from "@/components/dependency-graph/custom-node";
-import { Variables } from "@/core/variables/types";
-import { CellId } from "@/core/cells/ids";
-import { CellData } from "@/core/cells/types";
-import { Atom } from "jotai";
+import type { Variables } from "@/core/variables/types";
+import type { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
+import type { Atom } from "jotai";
-import { NodeData, VerticalElementsBuilder } from "./elements";
+import { type NodeData, VerticalElementsBuilder } from "./elements";
import useEvent from "react-use-event-hook";
import { scrollAndHighlightCell } from "../editor/links/cell-link";
import { GraphSelectionPanel } from "./panels";
diff --git a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx b/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
index 9d057e08cd..6fb56be92d 100644
--- a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
@@ -5,23 +5,28 @@ import ReactFlow, {
Controls,
Background,
BackgroundVariant,
- Node,
- Edge,
+ type Node,
+ type Edge,
} from "reactflow";
-import React, { PropsWithChildren, useEffect, useMemo, useState } from "react";
+import React, {
+ type PropsWithChildren,
+ useEffect,
+ useMemo,
+ useState,
+} from "react";
import {
EdgeMarkerContext,
nodeTypes,
} from "@/components/dependency-graph/custom-node";
-import { Variables } from "@/core/variables/types";
-import { CellId } from "@/core/cells/ids";
-import { CellData } from "@/core/cells/types";
-import { Atom } from "jotai";
+import type { Variables } from "@/core/variables/types";
+import type { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
+import type { Atom } from "jotai";
-import { NodeData, TreeElementsBuilder } from "./elements";
+import { type NodeData, TreeElementsBuilder } from "./elements";
import { layoutElements } from "./utils/layout";
-import { GraphSelection, GraphSettings, LayoutDirection } from "./types";
+import type { GraphSelection, GraphSettings, LayoutDirection } from "./types";
import useEvent from "react-use-event-hook";
import { scrollAndHighlightCell } from "../editor/links/cell-link";
import { GraphSelectionPanel } from "./panels";
diff --git a/frontend/src/components/dependency-graph/dependency-graph.tsx b/frontend/src/components/dependency-graph/dependency-graph.tsx
index 5b4a161ab3..32527f003c 100644
--- a/frontend/src/components/dependency-graph/dependency-graph.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph.tsx
@@ -2,12 +2,12 @@
import { ReactFlowProvider } from "reactflow";
import React from "react";
-import { Variables } from "@/core/variables/types";
-import { CellId } from "@/core/cells/ids";
-import { CellData } from "@/core/cells/types";
-import { Atom, atom, useAtom } from "jotai";
+import type { Variables } from "@/core/variables/types";
+import type { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
+import { type Atom, atom, useAtom } from "jotai";
-import { GraphLayoutView, GraphSettings } from "./types";
+import type { GraphLayoutView, GraphSettings } from "./types";
import { DependencyGraphMinimap } from "./dependency-graph-minimap";
import { GraphToolbar } from "./panels";
import { DependencyGraphTree } from "./dependency-graph-tree";
diff --git a/frontend/src/components/dependency-graph/elements.ts b/frontend/src/components/dependency-graph/elements.ts
index aa9270644e..e844221037 100644
--- a/frontend/src/components/dependency-graph/elements.ts
+++ b/frontend/src/components/dependency-graph/elements.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellData } from "@/core/cells/types";
-import { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
+import type { CellId } from "@/core/cells/ids";
import { store } from "@/core/state/jotai";
-import { Variables } from "@/core/variables/types";
-import { Edge, MarkerType, Node, NodeProps } from "reactflow";
-import { Atom } from "jotai";
+import type { Variables } from "@/core/variables/types";
+import { type Edge, MarkerType, type Node, type NodeProps } from "reactflow";
+import type { Atom } from "jotai";
import { Arrays } from "@/utils/arrays";
export interface NodeData {
diff --git a/frontend/src/components/dependency-graph/types.ts b/frontend/src/components/dependency-graph/types.ts
index c115505727..7e10d8f24c 100644
--- a/frontend/src/components/dependency-graph/types.ts
+++ b/frontend/src/components/dependency-graph/types.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
export type LayoutDirection = "TB" | "LR";
export type GraphLayoutView = LayoutDirection | "_minimap_";
diff --git a/frontend/src/components/dependency-graph/utils/changes.ts b/frontend/src/components/dependency-graph/utils/changes.ts
index 100defa65f..4572195fff 100644
--- a/frontend/src/components/dependency-graph/utils/changes.ts
+++ b/frontend/src/components/dependency-graph/utils/changes.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
+import type {
Node,
NodeAddChange,
NodeRemoveChange,
diff --git a/frontend/src/components/dependency-graph/utils/layout.ts b/frontend/src/components/dependency-graph/utils/layout.ts
index 852bf2cf29..f9d5d1cce7 100644
--- a/frontend/src/components/dependency-graph/utils/layout.ts
+++ b/frontend/src/components/dependency-graph/utils/layout.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { graphlib, layout } from "@dagrejs/dagre";
-import { Edge, Node } from "reactflow";
-import { LayoutDirection } from "../types";
+import type { Edge, Node } from "reactflow";
+import type { LayoutDirection } from "../types";
const g = new graphlib.Graph().setDefaultEdgeLabel(() => ({}));
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsx
index 4ede0fdc2d..9b5b5498f2 100644
--- a/frontend/src/components/editor/Cell.tsx
+++ b/frontend/src/components/editor/Cell.tsx
@@ -425,11 +425,11 @@ const CellComponent = (
const cellTitle = () => {
if (cellConfig.disabled) {
return "This cell is disabled";
- } else if (status === "disabled-transitively") {
+ }
+ if (status === "disabled-transitively") {
return "This cell has a disabled ancestor";
- } else {
- return undefined;
}
+ return undefined;
};
const handleRefactorWithAI = (opts: { prompt: string }) => {
diff --git a/frontend/src/components/editor/SortableCell.tsx b/frontend/src/components/editor/SortableCell.tsx
index d93b147b98..68f82eedd5 100644
--- a/frontend/src/components/editor/SortableCell.tsx
+++ b/frontend/src/components/editor/SortableCell.tsx
@@ -4,7 +4,7 @@ import { mergeRefs } from "../../utils/mergeRefs";
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { GripVerticalIcon } from "lucide-react";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import { cn } from "@/utils/cn";
interface Props extends React.HTMLAttributes<HTMLDivElement> {
diff --git a/frontend/src/components/editor/actions/name-cell-input.tsx b/frontend/src/components/editor/actions/name-cell-input.tsx
index 34d5137bd2..1926934e0d 100644
--- a/frontend/src/components/editor/actions/name-cell-input.tsx
+++ b/frontend/src/components/editor/actions/name-cell-input.tsx
@@ -2,7 +2,7 @@
import { Input } from "@/components/ui/input";
import { Tooltip } from "@/components/ui/tooltip";
import { getCellNames, useCellActions } from "@/core/cells/cells";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import {
DEFAULT_CELL_NAME,
normalizeName,
diff --git a/frontend/src/components/editor/actions/types.ts b/frontend/src/components/editor/actions/types.ts
index 40b6f5a42e..479ddf1cbc 100644
--- a/frontend/src/components/editor/actions/types.ts
+++ b/frontend/src/components/editor/actions/types.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { HotkeyAction } from "@/core/hotkeys/hotkeys";
+import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
/**
* Shared interface to render a user action in the editor.
diff --git a/frontend/src/components/editor/actions/useConfigActions.tsx b/frontend/src/components/editor/actions/useConfigActions.tsx
index f9f1ab7189..37342028e4 100644
--- a/frontend/src/components/editor/actions/useConfigActions.tsx
+++ b/frontend/src/components/editor/actions/useConfigActions.tsx
@@ -1,7 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { saveAppConfig, saveUserConfig } from "@/core/network/requests";
-import { ActionButton } from "./types";
-import { APP_WIDTHS, AppConfig, UserConfig } from "@/core/config/config-schema";
+import type { ActionButton } from "./types";
+import {
+ APP_WIDTHS,
+ type AppConfig,
+ type UserConfig,
+} from "@/core/config/config-schema";
import { useAppConfig, useUserConfig } from "@/core/config/config";
import { useTheme } from "@/theme/useTheme";
diff --git a/frontend/src/components/editor/cell/CellStatus.tsx b/frontend/src/components/editor/cell/CellStatus.tsx
index fda5b9909f..bc3c31984a 100644
--- a/frontend/src/components/editor/cell/CellStatus.tsx
+++ b/frontend/src/components/editor/cell/CellStatus.tsx
@@ -6,7 +6,7 @@ import {
RefreshCwIcon,
} from "lucide-react";
import { Tooltip } from "../../ui/tooltip";
-import { CellRuntimeState } from "../../../core/cells/types";
+import type { CellRuntimeState } from "../../../core/cells/types";
import { useElapsedTime } from "../../../hooks/useElapsedTime";
import { Logger } from "@/utils/Logger";
import { MultiIcon } from "@/components/icons/multi-icon";
@@ -238,11 +238,11 @@ function formatElapsedTime(elapsedTime: number | null) {
const minutes = (elapsedTime / (1000 * 60)).toFixed(0);
const seconds = ((elapsedTime % (1000 * 60)) / 1000).toFixed(0);
return `${minutes.toString()}m${seconds.toString()}s`;
- } else if (elapsedTime > 1000) {
+ }
+ if (elapsedTime > 1000) {
return `${(elapsedTime / 1000).toFixed(2).toString()}s`;
- } else {
- return `${elapsedTime.toFixed(0).toString()}ms`;
}
+ return `${elapsedTime.toFixed(0).toString()}ms`;
}
const CellTimer = (props: { startTime: Time }) => {
diff --git a/frontend/src/components/editor/cell/RunButton.tsx b/frontend/src/components/editor/cell/RunButton.tsx
index 9c0c3bb8d4..b029083d5c 100644
--- a/frontend/src/components/editor/cell/RunButton.tsx
+++ b/frontend/src/components/editor/cell/RunButton.tsx
@@ -16,13 +16,14 @@ function computeColor(
) {
if (appClosed) {
return "disabled";
- } else if (needsRun && !loading) {
+ }
+ if (needsRun && !loading) {
return "yellow";
- } else if (loading || inactive) {
+ }
+ if (loading || inactive) {
return "disabled";
- } else {
- return "hint-green";
}
+ return "hint-green";
}
export const RunButton = (props: {
@@ -63,7 +64,8 @@ export const RunButton = (props: {
</Button>
</Tooltip>
);
- } else if (!config.disabled && blockedStatus && !edited) {
+ }
+ if (!config.disabled && blockedStatus && !edited) {
return (
<Tooltip
content="This cell can't be run because it has a disabled ancestor"
diff --git a/frontend/src/components/editor/cell/cell-actions.tsx b/frontend/src/components/editor/cell/cell-actions.tsx
index 4b9f77672a..e3672ea95a 100644
--- a/frontend/src/components/editor/cell/cell-actions.tsx
+++ b/frontend/src/components/editor/cell/cell-actions.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
Fragment,
- PropsWithChildren,
+ type PropsWithChildren,
useImperativeHandle,
useMemo,
useState,
@@ -28,13 +28,13 @@ import {
import { renderMinimalShortcut } from "@/components/shortcuts/renderShortcut";
import React from "react";
import {
- CellActionButtonProps,
+ type CellActionButtonProps,
useCellActionButtons,
} from "../actions/useCellActionButton";
import { useRestoreFocus } from "@/components/ui/use-restore-focus";
import { useAtomValue } from "jotai";
import { cellFocusDetailsAtom } from "@/core/cells/focus";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
interface Props extends CellActionButtonProps {
children: React.ReactNode;
diff --git a/frontend/src/components/editor/cell/code/icons.tsx b/frontend/src/components/editor/cell/code/icons.tsx
index e7578ed7de..fe6597b66c 100644
--- a/frontend/src/components/editor/cell/code/icons.tsx
+++ b/frontend/src/components/editor/cell/code/icons.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SVGProps } from "react";
+import type { SVGProps } from "react";
export const PythonIcon = (props: SVGProps<SVGSVGElement>) => (
<svg
diff --git a/frontend/src/components/editor/cell/collapse.tsx b/frontend/src/components/editor/cell/collapse.tsx
index 58f0c0bbda..37dc6d03fc 100644
--- a/frontend/src/components/editor/cell/collapse.tsx
+++ b/frontend/src/components/editor/cell/collapse.tsx
@@ -3,7 +3,7 @@ import { Toolbar } from "@/components/layout/toolbar";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
import { useNotebook } from "@/core/cells/cells";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import { getDescendantsStatus } from "@/core/cells/utils";
import { cn } from "@/utils/cn";
import {
diff --git a/frontend/src/components/editor/cell/useRunCells.ts b/frontend/src/components/editor/cell/useRunCells.ts
index bd1ab30b4d..2b4e5eca4a 100644
--- a/frontend/src/components/editor/cell/useRunCells.ts
+++ b/frontend/src/components/editor/cell/useRunCells.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import { sendRun } from "@/core/network/requests";
import { staleCellIds, useCellActions, useNotebook } from "@/core/cells/cells";
import useEvent from "react-use-event-hook";
diff --git a/frontend/src/components/editor/cell/useSplitCell.tsx b/frontend/src/components/editor/cell/useSplitCell.tsx
index ec45521fb7..d5b442d159 100644
--- a/frontend/src/components/editor/cell/useSplitCell.tsx
+++ b/frontend/src/components/editor/cell/useSplitCell.tsx
@@ -2,7 +2,7 @@
import { UndoButton } from "@/components/buttons/undo-button";
import { toast } from "@/components/ui/use-toast";
import { getCellEditorView, useCellActions } from "@/core/cells/cells";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import useEvent from "react-use-event-hook";
export function useSplitCellCallback() {
diff --git a/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx b/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx
index c772b78d23..819e639643 100644
--- a/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx
+++ b/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx
@@ -8,7 +8,7 @@ import {
DialogDescription,
} from "@/components/ui/dialog";
import { Slot } from "@radix-ui/react-slot";
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
diff --git a/frontend/src/components/editor/chrome/components/feedback-button.tsx b/frontend/src/components/editor/chrome/components/feedback-button.tsx
index be7fdc1ca0..6b32cd7da4 100644
--- a/frontend/src/components/editor/chrome/components/feedback-button.tsx
+++ b/frontend/src/components/editor/chrome/components/feedback-button.tsx
@@ -8,7 +8,7 @@ import {
DialogDescription,
} from "@/components/ui/dialog";
import { Slot } from "@radix-ui/react-slot";
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
diff --git a/frontend/src/components/editor/chrome/panels/logs-panel.tsx b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
index 1f8dcaa48e..dd100f838e 100644
--- a/frontend/src/components/editor/chrome/panels/logs-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useCellActions, useCellLogs } from "@/core/cells/cells";
-import { CellLog, formatLogTimestamp } from "@/core/cells/logs";
+import { type CellLog, formatLogTimestamp } from "@/core/cells/logs";
import { cn } from "@/utils/cn";
import React from "react";
import { FileTextIcon } from "lucide-react";
diff --git a/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx b/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx
index 229eb55825..ef48696f08 100644
--- a/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx
@@ -8,7 +8,7 @@ import {
scrollToOutlineItem,
findOutlineElements,
} from "./useActiveOutline";
-import { OutlineItem } from "@/core/cells/outline";
+import type { OutlineItem } from "@/core/cells/outline";
export const FloatingOutline: React.FC = () => {
const { items } = useAtomValue(notebookOutline);
diff --git a/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx b/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx
index eee666d288..5265d0434a 100644
--- a/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { OutlineItem } from "@/core/cells/outline";
+import type { OutlineItem } from "@/core/cells/outline";
import { headingToIdentifier } from "@/core/dom/outline";
import { initialMode } from "@/core/mode";
import { Logger } from "@/utils/Logger";
@@ -139,14 +139,13 @@ export function findOutlineItem(
`[id="${CSS.escape(item.by.id)}"]`,
);
return elems[index];
- } else {
- const el = document.evaluate(
- item.by.path,
- document,
- null,
- XPathResult.FIRST_ORDERED_NODE_TYPE,
- null,
- ).singleNodeValue as HTMLElement;
- return el;
}
+ const el = document.evaluate(
+ item.by.path,
+ document,
+ null,
+ XPathResult.FIRST_ORDERED_NODE_TYPE,
+ null,
+ ).singleNodeValue as HTMLElement;
+ return el;
}
diff --git a/frontend/src/components/editor/code/readonly-python-code.tsx b/frontend/src/components/editor/code/readonly-python-code.tsx
index 33dba98da1..d85729dceb 100644
--- a/frontend/src/components/editor/code/readonly-python-code.tsx
+++ b/frontend/src/components/editor/code/readonly-python-code.tsx
@@ -2,7 +2,7 @@
import { memo, useState } from "react";
import CodeMirror, {
EditorView,
- ReactCodeMirrorProps,
+ type ReactCodeMirrorProps,
} from "@uiw/react-codemirror";
import { CopyIcon, EyeIcon, EyeOffIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
diff --git a/frontend/src/components/editor/controls/Controls.tsx b/frontend/src/components/editor/controls/Controls.tsx
index 454ae937dd..1f0409ebdf 100644
--- a/frontend/src/components/editor/controls/Controls.tsx
+++ b/frontend/src/components/editor/controls/Controls.tsx
@@ -190,7 +190,8 @@ const RunControlButton = ({
</Button>
</Tooltip>
);
- } else if (needsRun) {
+ }
+ if (needsRun) {
return (
<Tooltip content={renderShortcut("global.runStale")}>
<Button
diff --git a/frontend/src/components/editor/controls/command-palette.tsx b/frontend/src/components/editor/controls/command-palette.tsx
index b56ab062ce..e8ba482e56 100644
--- a/frontend/src/components/editor/controls/command-palette.tsx
+++ b/frontend/src/components/editor/controls/command-palette.tsx
@@ -12,7 +12,7 @@ import {
import { useRegisteredActions } from "../../../core/hotkeys/actions";
import { useRecentCommands } from "../../../hooks/useRecentCommands";
import { KeyboardHotkeys } from "../../shortcuts/renderShortcut";
-import { HotkeyAction, isHotkeyAction } from "@/core/hotkeys/hotkeys";
+import { type HotkeyAction, isHotkeyAction } from "@/core/hotkeys/hotkeys";
import { atom, useAtom, useAtomValue } from "jotai";
import { useNotebookActions } from "../actions/useNotebookActions";
import { Objects } from "@/utils/objects";
diff --git a/frontend/src/components/editor/controls/keyboard-shortcuts.tsx b/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
index a5f780360e..6e20c3b8ca 100644
--- a/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
+++ b/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
@@ -10,8 +10,8 @@ import {
} from "../../ui/dialog";
import { KeyboardHotkeys } from "../../shortcuts/renderShortcut";
import {
- HotkeyAction,
- HotkeyGroup,
+ type HotkeyAction,
+ type HotkeyGroup,
getDefaultHotkey,
} from "@/core/hotkeys/hotkeys";
import { atom, useAtom, useAtomValue } from "jotai";
@@ -22,7 +22,7 @@ import { hotkeysAtom, useUserConfig } from "@/core/config/config";
import { saveUserConfig } from "@/core/network/requests";
import { isPlatformMac } from "@/core/hotkeys/shortcuts";
import { Button } from "@/components/ui/button";
-import { UserConfig } from "@/core/config/config-schema";
+import type { UserConfig } from "@/core/config/config-schema";
export const keyboardShortcutsAtom = atom(false);
diff --git a/frontend/src/components/editor/file-tree/renderers.tsx b/frontend/src/components/editor/file-tree/renderers.tsx
index c957fb8448..eafca784c7 100644
--- a/frontend/src/components/editor/file-tree/renderers.tsx
+++ b/frontend/src/components/editor/file-tree/renderers.tsx
@@ -4,7 +4,7 @@ import { DataTable } from "@/components/data-table/data-table";
import { parseCsvData } from "@/plugins/impl/vega/loader";
import { Objects } from "@/utils/objects";
import React, { useMemo } from "react";
-import { Base64String, base64ToDataURL } from "@/utils/json/base64";
+import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
export const CsvViewer: React.FC<{ contents: string }> = ({ contents }) => {
const data = useMemo(() => parseCsvData(contents), [contents]);
diff --git a/frontend/src/components/editor/file-tree/upload.tsx b/frontend/src/components/editor/file-tree/upload.tsx
index 6cee2eff08..aeda8be5f5 100644
--- a/frontend/src/components/editor/file-tree/upload.tsx
+++ b/frontend/src/components/editor/file-tree/upload.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { toast } from "@/components/ui/use-toast";
import { sendCreateFileOrFolder } from "@/core/network/requests";
-import { FilePath } from "@/utils/paths";
+import type { FilePath } from "@/utils/paths";
import { serializeBlob } from "@/utils/blob";
-import { DropzoneOptions, useDropzone } from "react-dropzone";
+import { type DropzoneOptions, useDropzone } from "react-dropzone";
import { refreshRoot } from "./state";
import { Logger } from "@/utils/Logger";
diff --git a/frontend/src/components/editor/header/app-header.tsx b/frontend/src/components/editor/header/app-header.tsx
index 1dfa9d827b..f6af7cabf1 100644
--- a/frontend/src/components/editor/header/app-header.tsx
+++ b/frontend/src/components/editor/header/app-header.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ConnectionStatus, WebSocketState } from "@/core/websocket/types";
-import React, { PropsWithChildren } from "react";
+import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
+import React, { type PropsWithChildren } from "react";
import { Disconnected } from "../Disconnected";
interface Props {
diff --git a/frontend/src/components/editor/inputs/Inputs.tsx b/frontend/src/components/editor/inputs/Inputs.tsx
index fe372fe339..b8fbf7f32e 100644
--- a/frontend/src/components/editor/inputs/Inputs.tsx
+++ b/frontend/src/components/editor/inputs/Inputs.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { VariantProps } from "class-variance-authority";
+import type { VariantProps } from "class-variance-authority";
import * as styles from "./Inputs.styles";
import React from "react";
import clsx from "clsx";
diff --git a/frontend/src/components/editor/links/cell-link.tsx b/frontend/src/components/editor/links/cell-link.tsx
index ac914072a3..026813d910 100644
--- a/frontend/src/components/editor/links/cell-link.tsx
+++ b/frontend/src/components/editor/links/cell-link.tsx
@@ -97,24 +97,23 @@ export function scrollAndHighlightCell(
if (cell === null) {
Logger.error(`Cell ${cellHtmlId} not found on page.`);
return false;
- } else {
- if (!skipScroll) {
- cell.scrollIntoView({ behavior: "smooth", block: "center" });
- }
-
- if (variant === "destructive") {
- cell.classList.add("error-outline");
- setTimeout(() => {
- cell.classList.remove("error-outline");
- }, 2000);
- }
- if (variant === "focus") {
- cell.classList.add("focus-outline");
- setTimeout(() => {
- cell.classList.remove("focus-outline");
- }, 2000);
- }
+ }
+ if (!skipScroll) {
+ cell.scrollIntoView({ behavior: "smooth", block: "center" });
+ }
- return true;
+ if (variant === "destructive") {
+ cell.classList.add("error-outline");
+ setTimeout(() => {
+ cell.classList.remove("error-outline");
+ }, 2000);
}
+ if (variant === "focus") {
+ cell.classList.add("focus-outline");
+ setTimeout(() => {
+ cell.classList.remove("focus-outline");
+ }, 2000);
+ }
+
+ return true;
}
diff --git a/frontend/src/components/editor/output/CalloutOutput.tsx b/frontend/src/components/editor/output/CalloutOutput.tsx
index c80841e7d1..4eab7e45af 100644
--- a/frontend/src/components/editor/output/CalloutOutput.tsx
+++ b/frontend/src/components/editor/output/CalloutOutput.tsx
@@ -2,7 +2,7 @@
import { memo } from "react";
import { HtmlOutput } from "./HtmlOutput";
import { calloutStyles } from "./CalloutOutput.styles";
-import { Intent } from "@/plugins/impl/common/intent";
+import type { Intent } from "@/plugins/impl/common/intent";
interface Props {
html: string;
diff --git a/frontend/src/components/editor/output/EmotionCacheProvider.tsx b/frontend/src/components/editor/output/EmotionCacheProvider.tsx
index 5191292adc..e87ac79402 100644
--- a/frontend/src/components/editor/output/EmotionCacheProvider.tsx
+++ b/frontend/src/components/editor/output/EmotionCacheProvider.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { PropsWithChildren, useMemo } from "react";
+import { type PropsWithChildren, useMemo } from "react";
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
diff --git a/frontend/src/components/editor/output/MarimoErrorOutput.tsx b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
index 3c40b00d92..018943c9f4 100644
--- a/frontend/src/components/editor/output/MarimoErrorOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
@@ -2,7 +2,7 @@
import { cn } from "../../../utils/cn";
import { logNever } from "../../../utils/assertNever";
-import { MarimoError } from "../../../core/kernel/messages";
+import type { MarimoError } from "../../../core/kernel/messages";
import { Alert } from "../../ui/alert";
import { AlertTitle } from "../../ui/alert";
@@ -14,7 +14,7 @@ import {
} from "@/components/ui/accordion";
import { Fragment } from "react";
import { CellLinkError } from "../links/cell-link";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
const Tip = (props: {
className?: string;
diff --git a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx b/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
index db112d44c4..316c54d59b 100644
--- a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
@@ -2,7 +2,7 @@
import { cn } from "../../../utils/cn";
-import { type CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import {
Accordion,
@@ -16,7 +16,7 @@ import { BugIcon, ChevronDown, ExternalLinkIcon } from "lucide-react";
import { useState } from "react";
import { useAtomValue } from "jotai";
import { aiEnabledAtom } from "@/core/config/config";
-import { Element, Text, DOMNode } from "html-react-parser";
+import { Element, Text, type DOMNode } from "html-react-parser";
import { CellLinkTraceback } from "../links/cell-link";
diff --git a/frontend/src/components/editor/output/TextOutput.tsx b/frontend/src/components/editor/output/TextOutput.tsx
index b71339e710..89feee752d 100644
--- a/frontend/src/components/editor/output/TextOutput.tsx
+++ b/frontend/src/components/editor/output/TextOutput.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { OutputChannel } from "@/core/kernel/messages";
+import type { OutputChannel } from "@/core/kernel/messages";
import { cn } from "@/utils/cn";
import { AnsiUp } from "ansi_up";
diff --git a/frontend/src/components/editor/package-alert.tsx b/frontend/src/components/editor/package-alert.tsx
index 96aa8921c2..efc3f49a9c 100644
--- a/frontend/src/components/editor/package-alert.tsx
+++ b/frontend/src/components/editor/package-alert.tsx
@@ -123,7 +123,8 @@ export const PackageAlert: React.FC = (props) => {
</Banner>
</div>
);
- } else if (isInstallingPackageAlert(packageAlert)) {
+ }
+ if (isInstallingPackageAlert(packageAlert)) {
const { status, title, titleIcon, description } =
getInstallationStatusElements(packageAlert.packages);
if (status === "installed") {
@@ -184,10 +185,9 @@ export const PackageAlert: React.FC = (props) => {
</Banner>
</div>
);
- } else {
- logNever(packageAlert);
- return null;
}
+ logNever(packageAlert);
+ return null;
};
function getInstallationStatusElements(packages: PackageInstallationStatus) {
@@ -206,21 +206,21 @@ function getInstallationStatusElements(packages: PackageInstallationStatus) {
titleIcon: <DownloadCloudIcon className="w-5 h-5 inline-block mr-2" />,
description: "Installing packages:",
};
- } else if (status === "installed") {
+ }
+ if (status === "installed") {
return {
status: "installed",
title: "All packages installed!",
titleIcon: <PackageCheckIcon className="w-5 h-5 inline-block mr-2" />,
description: "Installed packages:",
};
- } else {
- return {
- status: "failed",
- title: "Some packages failed to install",
- titleIcon: <PackageXIcon className="w-5 h-5 inline-block mr-2" />,
- description: "See terminal for error logs.",
- };
}
+ return {
+ status: "failed",
+ title: "Some packages failed to install",
+ titleIcon: <PackageXIcon className="w-5 h-5 inline-block mr-2" />,
+ description: "See terminal for error logs.",
+ };
}
const ProgressIcon = ({
diff --git a/frontend/src/components/editor/renderers/grid-layout/plugin.tsx b/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
index 40f852796f..43122fef86 100644
--- a/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ICellRendererPlugin } from "../types";
-import {
+import type { ICellRendererPlugin } from "../types";
+import type {
GridLayout,
GridLayoutCellSide,
SerializedGridLayout,
@@ -10,7 +10,7 @@ import { Logger } from "@/utils/Logger";
import { z } from "zod";
import { Maps } from "@/utils/maps";
import { GridLayoutRenderer } from "./grid-layout";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
/**
* Plugin definition for the grid layout.
diff --git a/frontend/src/components/editor/renderers/grid-layout/types.ts b/frontend/src/components/editor/renderers/grid-layout/types.ts
index 503c845ea2..23d2da57e5 100644
--- a/frontend/src/components/editor/renderers/grid-layout/types.ts
+++ b/frontend/src/components/editor/renderers/grid-layout/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
/**
* The serialized form of a grid layout.
diff --git a/frontend/src/components/editor/renderers/plugins.ts b/frontend/src/components/editor/renderers/plugins.ts
index 66e6ee7668..3646d3d0e6 100644
--- a/frontend/src/components/editor/renderers/plugins.ts
+++ b/frontend/src/components/editor/renderers/plugins.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { GridLayoutPlugin } from "./grid-layout/plugin";
-import { ICellRendererPlugin, LayoutType } from "./types";
-import { CellData } from "@/core/cells/types";
+import type { ICellRendererPlugin, LayoutType } from "./types";
+import type { CellData } from "@/core/cells/types";
import { VerticalLayoutPlugin } from "./vertical-layout/vertical-layout";
import { SlidesLayoutPlugin } from "./slides-layout/plugin";
diff --git a/frontend/src/components/editor/renderers/slides-layout/plugin.tsx b/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
index 99a36f0c4a..d1da71f20c 100644
--- a/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
+++ b/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ICellRendererPlugin } from "../types";
-import { SlidesLayout } from "./types";
+import type { ICellRendererPlugin } from "../types";
+import type { SlidesLayout } from "./types";
import { z } from "zod";
import { SlidesLayoutRenderer } from "./slides-layout";
diff --git a/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx b/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
index 9829db7866..99d8e06a8c 100644
--- a/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
+++ b/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, { memo } from "react";
-import { ICellRendererProps } from "../types";
-import { SlidesLayout } from "./types";
+import type { ICellRendererProps } from "../types";
+import type { SlidesLayout } from "./types";
-import { CellId } from "@/core/cells/ids";
-import { CellRuntimeState } from "@/core/cells/types";
-import { AppMode } from "@/core/mode";
+import type { CellId } from "@/core/cells/ids";
+import type { CellRuntimeState } from "@/core/cells/types";
+import type { AppMode } from "@/core/mode";
import { OutputArea } from "../../Output";
type Props = ICellRendererProps<SlidesLayout>;
diff --git a/frontend/src/components/editor/renderers/slides-layout/types.ts b/frontend/src/components/editor/renderers/slides-layout/types.ts
index 64d87e14a1..5e5e93ff6e 100644
--- a/frontend/src/components/editor/renderers/slides-layout/types.ts
+++ b/frontend/src/components/editor/renderers/slides-layout/types.ts
@@ -5,9 +5,7 @@
* The serialized form of a slides layout.
* This must be backwards-compatible as it is stored on the user's disk.
*/
-export interface SerializedSlidesLayout {
- // No additional properties for now
-}
+export type SerializedSlidesLayout = {};
export interface SlidesLayout extends SerializedSlidesLayout {
// No additional properties for now
diff --git a/frontend/src/components/export/export-output-button.tsx b/frontend/src/components/export/export-output-button.tsx
index ceeeed7eb3..3a2e608507 100644
--- a/frontend/src/components/export/export-output-button.tsx
+++ b/frontend/src/components/export/export-output-button.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { downloadHTMLAsImage } from "@/utils/download";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
export function downloadCellOutput(cellId: CellId) {
const output = document.getElementById(`output-${cellId}`);
diff --git a/frontend/src/components/home/state.ts b/frontend/src/components/home/state.ts
index 8ee3394b2d..0c296bddcc 100644
--- a/frontend/src/components/home/state.ts
+++ b/frontend/src/components/home/state.ts
@@ -2,7 +2,7 @@
import React, {} from "react";
import { Functions } from "@/utils/functions";
import { atomWithStorage } from "jotai/utils";
-import { MarimoFile } from "@/core/network/types";
+import type { MarimoFile } from "@/core/network/types";
export type RunningNotebooksMap = Map<string, MarimoFile>;
diff --git a/frontend/src/components/icons/multi-icon.tsx b/frontend/src/components/icons/multi-icon.tsx
index 72bd6a94a5..6b50c6c3be 100644
--- a/frontend/src/components/icons/multi-icon.tsx
+++ b/frontend/src/components/icons/multi-icon.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import "./multi-icon.css";
diff --git a/frontend/src/components/icons/spinner.tsx b/frontend/src/components/icons/spinner.tsx
index 7fe0d137c9..4879329901 100644
--- a/frontend/src/components/icons/spinner.tsx
+++ b/frontend/src/components/icons/spinner.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { cn } from "@/utils/cn";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { Loader2Icon } from "lucide-react";
import React from "react";
diff --git a/frontend/src/components/pages/run-page.tsx b/frontend/src/components/pages/run-page.tsx
index 92c1e7283e..e75675685c 100644
--- a/frontend/src/components/pages/run-page.tsx
+++ b/frontend/src/components/pages/run-page.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { AppConfig } from "@/core/config/config-schema";
+import type { AppConfig } from "@/core/config/config-schema";
import { RunApp } from "@/core/run-app";
import { StaticBanner } from "../static-html/static-banner";
diff --git a/frontend/src/components/slides/slides-component.tsx b/frontend/src/components/slides/slides-component.tsx
index 6e63bdf488..36ca471d40 100644
--- a/frontend/src/components/slides/slides-component.tsx
+++ b/frontend/src/components/slides/slides-component.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren, useEffect } from "react";
-import { Swiper, SwiperSlide, SwiperRef } from "swiper/react";
+import React, { type PropsWithChildren, useEffect } from "react";
+import { Swiper, SwiperSlide, type SwiperRef } from "swiper/react";
import {
Virtual,
Keyboard,
diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx
index 3086d60070..cb223bbf56 100644
--- a/frontend/src/components/ui/alert.tsx
+++ b/frontend/src/components/ui/alert.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/badge.tsx b/frontend/src/components/ui/badge.tsx
index 9b46f6ea67..3db8a2d47a 100644
--- a/frontend/src/components/ui/badge.tsx
+++ b/frontend/src/components/ui/badge.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/button.tsx b/frontend/src/components/ui/button.tsx
index e6c15a39d9..cd0751ee32 100644
--- a/frontend/src/components/ui/button.tsx
+++ b/frontend/src/components/ui/button.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/ui/command.tsx
index 3d8cb8bd3e..3f83546b48 100644
--- a/frontend/src/components/ui/command.tsx
+++ b/frontend/src/components/ui/command.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
-import { DialogProps } from "@radix-ui/react-dialog";
+import type { DialogProps } from "@radix-ui/react-dialog";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
@@ -11,7 +11,7 @@ import {
menuItemVariants,
menuSeparatorVariants,
} from "./menu-items";
-import { VariantProps } from "class-variance-authority";
+import type { VariantProps } from "class-variance-authority";
import { Strings } from "@/utils/strings";
const Command = React.forwardRef<
diff --git a/frontend/src/components/ui/form.tsx b/frontend/src/components/ui/form.tsx
index 5c81703071..2dbbd9e414 100644
--- a/frontend/src/components/ui/form.tsx
+++ b/frontend/src/components/ui/form.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
-import * as LabelPrimitive from "@radix-ui/react-label";
+import type * as LabelPrimitive from "@radix-ui/react-label";
import { Slot } from "@radix-ui/react-slot";
import {
Controller,
- ControllerProps,
- FieldPath,
- FieldValues,
+ type ControllerProps,
+ type FieldPath,
+ type FieldValues,
FormProvider,
useFormContext,
} from "react-hook-form";
diff --git a/frontend/src/components/ui/input.tsx b/frontend/src/components/ui/input.tsx
index 63dc59edaf..619c972b7b 100644
--- a/frontend/src/components/ui/input.tsx
+++ b/frontend/src/components/ui/input.tsx
@@ -4,7 +4,10 @@ import * as React from "react";
import { cn } from "@/utils/cn";
import { useDebounceControlledState } from "@/hooks/useDebounce";
import { Events } from "@/utils/events";
-import { NumberField, NumberFieldProps } from "@/components/ui/number-field";
+import {
+ NumberField,
+ type NumberFieldProps,
+} from "@/components/ui/number-field";
import { SearchIcon, XIcon } from "lucide-react";
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
diff --git a/frontend/src/components/ui/label.tsx b/frontend/src/components/ui/label.tsx
index 40abd1f78f..85f851490e 100644
--- a/frontend/src/components/ui/label.tsx
+++ b/frontend/src/components/ui/label.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
import * as LabelPrimitive from "@radix-ui/react-label";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/navigation.tsx b/frontend/src/components/ui/navigation.tsx
index 1b9089a1a1..126b406169 100644
--- a/frontend/src/components/ui/navigation.tsx
+++ b/frontend/src/components/ui/navigation.tsx
@@ -2,7 +2,7 @@
import * as React from "react";
import { ChevronDownIcon } from "@radix-ui/react-icons";
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
const NavigationMenu = React.forwardRef<
diff --git a/frontend/src/components/ui/number-field.tsx b/frontend/src/components/ui/number-field.tsx
index 4845e8a130..8b53d3c427 100644
--- a/frontend/src/components/ui/number-field.tsx
+++ b/frontend/src/components/ui/number-field.tsx
@@ -2,9 +2,9 @@
import { ChevronUp, ChevronDown } from "lucide-react";
import {
NumberField as AriaNumberField,
- NumberFieldProps as AriaNumberFieldProps,
+ type NumberFieldProps as AriaNumberFieldProps,
Button,
- ButtonProps,
+ type ButtonProps,
Input as RACInput,
} from "react-aria-components";
import React from "react";
diff --git a/frontend/src/components/ui/switch.tsx b/frontend/src/components/ui/switch.tsx
index 62c6a75549..d52473a41e 100644
--- a/frontend/src/components/ui/switch.tsx
+++ b/frontend/src/components/ui/switch.tsx
@@ -3,7 +3,7 @@ import * as React from "react";
import * as SwitchPrimitives from "@radix-ui/react-switch";
import { cn } from "@/utils/cn";
-import { cva, VariantProps } from "class-variance-authority";
+import { cva, type VariantProps } from "class-variance-authority";
const switchVariants = cva(
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
diff --git a/frontend/src/components/ui/toaster.tsx b/frontend/src/components/ui/toaster.tsx
index af5d77d30b..311dc4ace4 100644
--- a/frontend/src/components/ui/toaster.tsx
+++ b/frontend/src/components/ui/toaster.tsx
@@ -14,20 +14,16 @@ export const Toaster = () => {
return (
<ToastProvider>
- {toasts.map(function ({ id, title, description, action, ...props }) {
- return (
- <Toast key={id} {...props}>
- <div className="grid gap-1">
- {title && <ToastTitle>{title}</ToastTitle>}
- {description && (
- <ToastDescription>{description}</ToastDescription>
- )}
- </div>
- {action}
- <ToastClose />
- </Toast>
- );
- })}
+ {toasts.map(({ id, title, description, action, ...props }) => (
+ <Toast key={id} {...props}>
+ <div className="grid gap-1">
+ {title && <ToastTitle>{title}</ToastTitle>}
+ {description && <ToastDescription>{description}</ToastDescription>}
+ </div>
+ {action}
+ <ToastClose />
+ </Toast>
+ ))}
<ToastViewport />
</ToastProvider>
);
diff --git a/frontend/src/components/ui/use-toast.ts b/frontend/src/components/ui/use-toast.ts
index d7fc74439f..fb44bbd5d1 100644
--- a/frontend/src/components/ui/use-toast.ts
+++ b/frontend/src/components/ui/use-toast.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as React from "react";
-import { ToastActionElement, type ToastProps } from "@/components/ui/toast";
+import type { ToastActionElement, ToastProps } from "@/components/ui/toast";
const TOAST_LIMIT = 1;
const TOAST_REMOVE_DELAY = 10_000; // 10 seconds
diff --git a/frontend/src/core/ai/state.ts b/frontend/src/core/ai/state.ts
index 535e7d77bf..f81de3dabd 100644
--- a/frontend/src/core/ai/state.ts
+++ b/frontend/src/core/ai/state.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { CellId } from "../cells/ids";
+import type { CellId } from "../cells/ids";
export const aiCompletionCellAtom = atom<{
cellId: CellId;
diff --git a/frontend/src/core/alerts/state.ts b/frontend/src/core/alerts/state.ts
index 8aa4025a8a..7aa6172ffd 100644
--- a/frontend/src/core/alerts/state.ts
+++ b/frontend/src/core/alerts/state.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { PackageInstallationStatus } from "@/core/kernel/messages";
+import type { PackageInstallationStatus } from "@/core/kernel/messages";
import { createReducerAndAtoms } from "@/utils/createReducer";
import { generateUUID } from "@/utils/uuid";
import { useAtomValue } from "jotai";
diff --git a/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts b/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
index 3d9af46b4b..778baa32f1 100644
--- a/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
+++ b/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
@@ -2,7 +2,7 @@
import { expect, describe, it } from "vitest";
import { collapseConsoleOutputs } from "../collapseConsoleOutputs";
-import { OutputMessage } from "@/core/kernel/messages";
+import type { OutputMessage } from "@/core/kernel/messages";
describe("collapseConsoleOutputs", () => {
it("should collapse last two text/plain outputs on the same channel", () => {
diff --git a/frontend/src/core/cells/collapseConsoleOutputs.tsx b/frontend/src/core/cells/collapseConsoleOutputs.tsx
index a2a3669a29..b122491b5f 100644
--- a/frontend/src/core/cells/collapseConsoleOutputs.tsx
+++ b/frontend/src/core/cells/collapseConsoleOutputs.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { OutputMessage } from "@/core/kernel/messages";
+import type { OutputMessage } from "@/core/kernel/messages";
import { invariant } from "@/utils/invariant";
/**
@@ -60,7 +60,7 @@ function handleCarriageReturns(
}
// eslint-disable-next-line no-control-regex
- const carriagePattern = new RegExp("\r[^\n]", "g");
+ const carriagePattern = /\r[^\n]/g;
// collapse carriage returns in the final output's data
let text = lastOutput.data;
invariant(typeof text === "string", "expected string");
@@ -128,7 +128,6 @@ function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
{ ...output, data: output_lines.slice(-nLinesToKeep).join("\n") },
...consoleOutputs.slice(cutoff + 1),
];
- } else {
- return [warningOutput, ...consoleOutputs.slice(cutoff + 1)];
}
+ return [warningOutput, ...consoleOutputs.slice(cutoff + 1)];
}
diff --git a/frontend/src/core/cells/ids.ts b/frontend/src/core/cells/ids.ts
index 42426541bf..a0df6f8602 100644
--- a/frontend/src/core/cells/ids.ts
+++ b/frontend/src/core/cells/ids.ts
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-redeclare */
import { invariant } from "@/utils/invariant";
-import { TypedString } from "../../utils/typed";
+import type { TypedString } from "../../utils/typed";
const lowercase = "abcdefghijklmnopqrstuvwxyz";
const uppercase = lowercase.toUpperCase();
diff --git a/frontend/src/core/cells/logs.ts b/frontend/src/core/cells/logs.ts
index 79d2033f8f..82beffb32a 100644
--- a/frontend/src/core/cells/logs.ts
+++ b/frontend/src/core/cells/logs.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { invariant } from "@/utils/invariant";
-import { CellMessage, OutputMessage } from "../kernel/messages";
-import { CellId } from "./ids";
+import type { CellMessage, OutputMessage } from "../kernel/messages";
+import type { CellId } from "./ids";
import { fromUnixTime } from "date-fns";
export interface CellLog {
diff --git a/frontend/src/core/cells/outputs.ts b/frontend/src/core/cells/outputs.ts
index f6b5557de2..596b441f6f 100644
--- a/frontend/src/core/cells/outputs.ts
+++ b/frontend/src/core/cells/outputs.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useState } from "react";
-import { CellId } from "./ids";
-import { OutputMessage } from "../kernel/messages";
+import type { CellId } from "./ids";
+import type { OutputMessage } from "../kernel/messages";
// This does not need to be overcomplicated. We can just store the expanded
// state in a global map instead of Jotai since state is not shared between cells.
diff --git a/frontend/src/core/codemirror/completion/Autocompleter.ts b/frontend/src/core/codemirror/completion/Autocompleter.ts
index ca46ac1641..7591f6f49b 100644
--- a/frontend/src/core/codemirror/completion/Autocompleter.ts
+++ b/frontend/src/core/codemirror/completion/Autocompleter.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CompletionResult } from "@codemirror/autocomplete";
+import type { CompletionResult } from "@codemirror/autocomplete";
-import {
+import type {
CompletionOption,
CompletionResultMessage,
} from "../../kernel/messages";
import { sendCodeCompletionRequest } from "@/core/network/requests";
-import { Tooltip } from "@codemirror/view";
+import type { Tooltip } from "@codemirror/view";
import { DeferredRequestRegistry } from "@/core/network/DeferredRequestRegistry";
-import { CodeCompletionRequest } from "@/core/network/types";
+import type { CodeCompletionRequest } from "@/core/network/types";
import "../../../components/editor/documentation.css";
function constructCompletionInfoNode(
@@ -115,10 +115,12 @@ function getFirstOption(
): CompletionOption | undefined {
if (options.length === 0) {
return undefined;
- } else if (options.length === 1) {
+ }
+ if (options.length === 1) {
// One option
return options[0];
- } else if (tieBreak) {
+ }
+ if (tieBreak) {
// Tie break to a matching name
return options.find((option) => option.name === tieBreak);
}
diff --git a/frontend/src/core/codemirror/completion/hints.ts b/frontend/src/core/codemirror/completion/hints.ts
index d8c74561c8..3ebe5f5491 100644
--- a/frontend/src/core/codemirror/completion/hints.ts
+++ b/frontend/src/core/codemirror/completion/hints.ts
@@ -3,7 +3,7 @@ import { HTMLCellId } from "@/core/cells/ids";
import { EditorView, hoverTooltip } from "@codemirror/view";
import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
import { Logger } from "@/utils/Logger";
-import { EditorState, Text } from "@codemirror/state";
+import type { EditorState, Text } from "@codemirror/state";
import { debounce } from "lodash-es";
import { documentationAtom } from "@/core/documentation/state";
import { store } from "@/core/state/jotai";
diff --git a/frontend/src/core/codemirror/config/extension.ts b/frontend/src/core/codemirror/config/extension.ts
index 362d2a9f84..462852a4f1 100644
--- a/frontend/src/core/codemirror/config/extension.ts
+++ b/frontend/src/core/codemirror/config/extension.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CompletionConfig } from "@/core/config/config-schema";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { CompletionConfig } from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import { Facet } from "@codemirror/state";
-import { MovementCallbacks } from "../cells/extensions";
+import type { MovementCallbacks } from "../cells/extensions";
export const completionConfigState = Facet.define<
CompletionConfig,
diff --git a/frontend/src/core/codemirror/copilot/client.ts b/frontend/src/core/codemirror/copilot/client.ts
index d9045ad84a..12d2b675b9 100644
--- a/frontend/src/core/codemirror/copilot/client.ts
+++ b/frontend/src/core/codemirror/copilot/client.ts
@@ -4,7 +4,7 @@ import { languageServerWithTransport } from "codemirror-languageserver";
import { CopilotLanguageServerClient } from "./language-server";
import { WebSocketTransport } from "@open-rpc/client-js";
import { Transport } from "@open-rpc/client-js/build/transports/Transport";
-import { JSONRPCRequestData } from "@open-rpc/client-js/build/Request";
+import type { JSONRPCRequestData } from "@open-rpc/client-js/build/Request";
import { waitForEnabledCopilot } from "./state";
import { waitForWs } from "@/utils/waitForWs";
diff --git a/frontend/src/core/codemirror/copilot/language-server.ts b/frontend/src/core/codemirror/copilot/language-server.ts
index c36c826c2f..f3bddb07d1 100644
--- a/frontend/src/core/codemirror/copilot/language-server.ts
+++ b/frontend/src/core/codemirror/copilot/language-server.ts
@@ -11,7 +11,7 @@ import type {
import { VersionedTextDocumentIdentifier } from "vscode-languageserver-protocol";
import { LanguageServerClient } from "codemirror-languageserver";
-import {
+import type {
CopilotStatus,
CopilotSignInInitiateParams,
CopilotSignInInitiateResult,
diff --git a/frontend/src/core/codemirror/copilot/types.ts b/frontend/src/core/codemirror/copilot/types.ts
index 12bc334ea8..1ecb6303b1 100644
--- a/frontend/src/core/codemirror/copilot/types.ts
+++ b/frontend/src/core/codemirror/copilot/types.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-empty-interface */
-export interface CopilotSignInInitiateParams {}
+export type CopilotSignInInitiateParams = {};
export interface CopilotSignInInitiateResult {
verificationUri: string;
status: string;
@@ -33,7 +33,7 @@ export interface CopilotSignInConfirmResult {
status: CopilotStatus;
user: string;
}
-export interface CopilotSignOutParams {}
+export type CopilotSignOutParams = {};
export interface CopilotSignOutResult {
status: CopilotStatus;
}
diff --git a/frontend/src/core/codemirror/dnd/extension.ts b/frontend/src/core/codemirror/dnd/extension.ts
index 63a605b009..4259a88faa 100644
--- a/frontend/src/core/codemirror/dnd/extension.ts
+++ b/frontend/src/core/codemirror/dnd/extension.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Extension } from "@codemirror/state";
+import type { Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
export function dndBundle(): Extension {
diff --git a/frontend/src/core/codemirror/editing/commands.ts b/frontend/src/core/codemirror/editing/commands.ts
index 7c3c9393d6..949f3d929b 100644
--- a/frontend/src/core/codemirror/editing/commands.ts
+++ b/frontend/src/core/codemirror/editing/commands.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { foldAll, unfoldAll } from "@codemirror/language";
-import { EditorView, Command } from "@codemirror/view";
-import { Nullable } from "vitest";
+import type { EditorView, Command } from "@codemirror/view";
+import type { Nullable } from "vitest";
export type BulkCommand = (targets: Array<Nullable<EditorView>>) => boolean;
diff --git a/frontend/src/core/codemirror/extensions.ts b/frontend/src/core/codemirror/extensions.ts
index 70878c048a..4daefa8487 100644
--- a/frontend/src/core/codemirror/extensions.ts
+++ b/frontend/src/core/codemirror/extensions.ts
@@ -7,7 +7,7 @@ import {
toggleToLanguage,
} from "./language/commands";
import { smartScrollIntoView } from "../../utils/scroll";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import { invariant } from "@/utils/invariant";
import type { CodeCallbacks } from "./cells/extensions";
diff --git a/frontend/src/core/codemirror/find-replace/extension.ts b/frontend/src/core/codemirror/find-replace/extension.ts
index 83b7cf64e3..e74278012a 100644
--- a/frontend/src/core/codemirror/find-replace/extension.ts
+++ b/frontend/src/core/codemirror/find-replace/extension.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import {
highlightSelectionMatches,
selectNextOccurrence,
diff --git a/frontend/src/core/codemirror/find-replace/navigate.ts b/frontend/src/core/codemirror/find-replace/navigate.ts
index 4a16bb60f1..b0c806d9d1 100644
--- a/frontend/src/core/codemirror/find-replace/navigate.ts
+++ b/frontend/src/core/codemirror/find-replace/navigate.ts
@@ -5,7 +5,7 @@ import { EditorSelection } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { findReplaceAtom } from "./state";
import { getAllEditorViews } from "@/core/cells/cells";
-import { QueryType, asQueryCreator } from "./query";
+import { type QueryType, asQueryCreator } from "./query";
function searchCommand<T>(
f: (state: { query: QueryType; search: SearchQuery }) => T,
diff --git a/frontend/src/core/codemirror/find-replace/query.ts b/frontend/src/core/codemirror/find-replace/query.ts
index cfeb3bcf83..4225fe7157 100644
--- a/frontend/src/core/codemirror/find-replace/query.ts
+++ b/frontend/src/core/codemirror/find-replace/query.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { invariant } from "@/utils/invariant";
-import { SearchCursor, SearchQuery } from "@codemirror/search";
-import { EditorState } from "@codemirror/state";
+import type { SearchCursor, SearchQuery } from "@codemirror/search";
+import type { EditorState } from "@codemirror/state";
type SearchResult = typeof SearchCursor.prototype.value;
diff --git a/frontend/src/core/codemirror/find-replace/state.ts b/frontend/src/core/codemirror/find-replace/state.ts
index c150f2a3b7..08446301b2 100644
--- a/frontend/src/core/codemirror/find-replace/state.ts
+++ b/frontend/src/core/codemirror/find-replace/state.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { store } from "@/core/state/jotai";
-import { EditorView } from "@codemirror/view";
+import type { EditorView } from "@codemirror/view";
import { atomWithReducer } from "jotai/utils";
interface FindReplaceState {
diff --git a/frontend/src/core/codemirror/keymaps/vim.ts b/frontend/src/core/codemirror/keymaps/vim.ts
index 29384d68dc..43ad3293b6 100644
--- a/frontend/src/core/codemirror/keymaps/vim.ts
+++ b/frontend/src/core/codemirror/keymaps/vim.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CodeMirror, getCM, Vim } from "@replit/codemirror-vim";
+import { type CodeMirror, getCM, Vim } from "@replit/codemirror-vim";
import { type EditorView, keymap, ViewPlugin } from "@codemirror/view";
import {
isAtEndOfEditor,
diff --git a/frontend/src/core/codemirror/language/LanguageAdapters.ts b/frontend/src/core/codemirror/language/LanguageAdapters.ts
index d79c920d4f..8b86518cfd 100644
--- a/frontend/src/core/codemirror/language/LanguageAdapters.ts
+++ b/frontend/src/core/codemirror/language/LanguageAdapters.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { LanguageAdapter, LanguageAdapterType } from "./types";
+import type { LanguageAdapter, LanguageAdapterType } from "./types";
import { PythonLanguageAdapter } from "./python";
import { MarkdownLanguageAdapter } from "./markdown";
import { SQLLanguageAdapter } from "./sql";
diff --git a/frontend/src/core/codemirror/language/__tests__/extension.test.ts b/frontend/src/core/codemirror/language/__tests__/extension.test.ts
index 30636e8008..6b6ce2b6dc 100644
--- a/frontend/src/core/codemirror/language/__tests__/extension.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/extension.test.ts
@@ -6,7 +6,7 @@ import {
} from "../extension";
import { EditorState } from "@codemirror/state";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { MovementCallbacks } from "../../cells/extensions";
+import type { MovementCallbacks } from "../../cells/extensions";
import { store } from "@/core/state/jotai";
import { capabilitiesAtom } from "@/core/config/capabilities";
diff --git a/frontend/src/core/codemirror/language/__tests__/utils.test.ts b/frontend/src/core/codemirror/language/__tests__/utils.test.ts
index c5568f9379..389aa0d5e9 100644
--- a/frontend/src/core/codemirror/language/__tests__/utils.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/utils.test.ts
@@ -9,7 +9,7 @@ import { EditorView } from "@codemirror/view";
import { describe, it, expect } from "vitest";
import { adaptiveLanguageConfiguration, switchLanguage } from "../extension";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { MovementCallbacks } from "../../cells/extensions";
+import type { MovementCallbacks } from "../../cells/extensions";
function createEditor(doc: string) {
return new EditorView({
diff --git a/frontend/src/core/codemirror/language/extension.ts b/frontend/src/core/codemirror/language/extension.ts
index 1709e1791c..bc466c8897 100644
--- a/frontend/src/core/codemirror/language/extension.ts
+++ b/frontend/src/core/codemirror/language/extension.ts
@@ -5,10 +5,15 @@ import {
StateEffect,
StateField,
} from "@codemirror/state";
-import { LanguageAdapter } from "./types";
-import { EditorView, Panel, keymap, showPanel } from "@codemirror/view";
+import type { LanguageAdapter } from "./types";
+import {
+ type EditorView,
+ type Panel,
+ keymap,
+ showPanel,
+} from "@codemirror/view";
import { clamp } from "@/utils/math";
-import { CompletionConfig } from "@/core/config/config-schema";
+import type { CompletionConfig } from "@/core/config/config-schema";
import {
completionConfigState,
hotkeysProviderState,
@@ -19,8 +24,8 @@ import { historyCompartment } from "../editing/extensions";
import { history } from "@codemirror/commands";
import { formattingChangeEffect } from "../format";
import { getEditorCodeAsPython } from "./utils";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { CodeMirrorSetupOpts } from "../cm";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { CodeMirrorSetupOpts } from "../cm";
import { getLanguageAdapters, LanguageAdapters } from "./LanguageAdapters";
import { createPanel } from "../react-dom/createPanel";
import { LanguagePanelComponent } from "./panel";
diff --git a/frontend/src/core/codemirror/language/markdown.ts b/frontend/src/core/codemirror/language/markdown.ts
index 447647f57e..be455e307d 100644
--- a/frontend/src/core/codemirror/language/markdown.ts
+++ b/frontend/src/core/codemirror/language/markdown.ts
@@ -1,22 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Extension } from "@codemirror/state";
-import { LanguageAdapter } from "./types";
+import type { Extension } from "@codemirror/state";
+import type { LanguageAdapter } from "./types";
import { markdown } from "@codemirror/lang-markdown";
import { languages } from "@codemirror/language-data";
import { parseMixed } from "@lezer/common";
import { python, pythonLanguage } from "@codemirror/lang-python";
import dedent from "string-dedent";
import {
- Completion,
- CompletionSource,
+ type Completion,
+ type CompletionSource,
autocompletion,
} from "@codemirror/autocomplete";
import { once } from "lodash-es";
import { enhancedMarkdownExtension } from "../markdown/extension";
-import { CompletionConfig } from "@/core/config/config-schema";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { CompletionConfig } from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import { indentOneTab } from "./utils/indentOneTab";
-import { QuotePrefixKind, splitQuotePrefix } from "./utils/quotes";
+import { type QuotePrefixKind, splitQuotePrefix } from "./utils/quotes";
const quoteKinds = [
['"""', '"""'],
diff --git a/frontend/src/core/codemirror/language/python.ts b/frontend/src/core/codemirror/language/python.ts
index f394a35caa..2d1cc6b890 100644
--- a/frontend/src/core/codemirror/language/python.ts
+++ b/frontend/src/core/codemirror/language/python.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Extension, Prec } from "@codemirror/state";
-import { LanguageAdapter } from "./types";
+import { type Extension, Prec } from "@codemirror/state";
+import type { LanguageAdapter } from "./types";
import {
pythonLanguage,
localCompletionSource,
@@ -11,16 +11,16 @@ import {
foldInside,
LanguageSupport,
} from "@codemirror/language";
-import { CompletionConfig } from "@/core/config/config-schema";
+import type { CompletionConfig } from "@/core/config/config-schema";
import { autocompletion } from "@codemirror/autocomplete";
import { completer } from "../completion/completer";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { PlaceholderType } from "../config/extension";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { PlaceholderType } from "../config/extension";
import {
smartPlaceholderExtension,
clickablePlaceholderExtension,
} from "../placeholder/extensions";
-import { MovementCallbacks } from "../cells/extensions";
+import type { MovementCallbacks } from "../cells/extensions";
/**
* Language adapter for Python.
diff --git a/frontend/src/core/codemirror/language/sql.ts b/frontend/src/core/codemirror/language/sql.ts
index a1ac81ce1d..7e2e3d4b43 100644
--- a/frontend/src/core/codemirror/language/sql.ts
+++ b/frontend/src/core/codemirror/language/sql.ts
@@ -1,17 +1,20 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Extension } from "@codemirror/state";
-import { LanguageAdapter } from "./types";
+import type { Extension } from "@codemirror/state";
+import type { LanguageAdapter } from "./types";
import { sql, StandardSQL, schemaCompletionSource } from "@codemirror/lang-sql";
import dedent from "string-dedent";
-import { CompletionConfig } from "@/core/config/config-schema";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { CompletionConfig } from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import { indentOneTab } from "./utils/indentOneTab";
-import { autocompletion, CompletionSource } from "@codemirror/autocomplete";
+import {
+ autocompletion,
+ type CompletionSource,
+} from "@codemirror/autocomplete";
import { store } from "@/core/state/jotai";
import { datasetsAtom } from "@/core/datasets/state";
import {
QUOTE_PREFIX_KINDS,
- QuotePrefixKind,
+ type QuotePrefixKind,
splitQuotePrefix,
upgradePrefixKind,
} from "./utils/quotes";
diff --git a/frontend/src/core/codemirror/language/types.ts b/frontend/src/core/codemirror/language/types.ts
index b7d84d5867..0488d02667 100644
--- a/frontend/src/core/codemirror/language/types.ts
+++ b/frontend/src/core/codemirror/language/types.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CompletionConfig } from "@/core/config/config-schema";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { Extension } from "@codemirror/state";
-import { PlaceholderType } from "../config/extension";
-import { MovementCallbacks } from "../cells/extensions";
+import type { CompletionConfig } from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { Extension } from "@codemirror/state";
+import type { PlaceholderType } from "../config/extension";
+import type { MovementCallbacks } from "../cells/extensions";
/**
* A language adapter is a class that can transform code from one language to
diff --git a/frontend/src/core/codemirror/markdown/commands.ts b/frontend/src/core/codemirror/markdown/commands.ts
index 93fa7f084f..516055d015 100644
--- a/frontend/src/core/codemirror/markdown/commands.ts
+++ b/frontend/src/core/codemirror/markdown/commands.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
EditorSelection,
- SelectionRange,
+ type SelectionRange,
Text,
Transaction,
} from "@codemirror/state";
-import { EditorView } from "@codemirror/view";
+import type { EditorView } from "@codemirror/view";
function hasSelection(view: EditorView) {
return !view.state.selection.main.empty;
diff --git a/frontend/src/core/codemirror/markdown/extension.ts b/frontend/src/core/codemirror/markdown/extension.ts
index d61c9a81bf..947aa8bb6c 100644
--- a/frontend/src/core/codemirror/markdown/extension.ts
+++ b/frontend/src/core/codemirror/markdown/extension.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Extension, Prec } from "@codemirror/state";
+import { type Extension, Prec } from "@codemirror/state";
import {
insertBlockquote,
insertBoldMarker,
@@ -10,7 +10,7 @@ import {
insertUL,
} from "./commands";
import { EditorView, keymap } from "@codemirror/view";
-import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
export function enhancedMarkdownExtension(
hotkeys: HotkeyProvider,
diff --git a/frontend/src/core/codemirror/react-dom/createPanel.tsx b/frontend/src/core/codemirror/react-dom/createPanel.tsx
index 3ebae76c30..3e811737a6 100644
--- a/frontend/src/core/codemirror/react-dom/createPanel.tsx
+++ b/frontend/src/core/codemirror/react-dom/createPanel.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EditorView, Panel } from "@codemirror/view";
-import { Root, createRoot } from "react-dom/client";
+import type { EditorView, Panel } from "@codemirror/view";
+import { type Root, createRoot } from "react-dom/client";
export function createPanel(
view: EditorView,
diff --git a/frontend/src/core/codemirror/utils.ts b/frontend/src/core/codemirror/utils.ts
index b4a54aece7..4c7ec1c562 100644
--- a/frontend/src/core/codemirror/utils.ts
+++ b/frontend/src/core/codemirror/utils.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EditorState } from "@codemirror/state";
-import { EditorView } from "@codemirror/view";
+import type { EditorState } from "@codemirror/state";
+import type { EditorView } from "@codemirror/view";
import { getCM } from "@replit/codemirror-vim";
export function isAtStartOfEditor(ev: { state: EditorState }) {
diff --git a/frontend/src/core/config/capabilities.ts b/frontend/src/core/config/capabilities.ts
index 3806c040c5..a4997aa037 100644
--- a/frontend/src/core/config/capabilities.ts
+++ b/frontend/src/core/config/capabilities.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { Capabilities } from "../kernel/messages";
+import type { Capabilities } from "../kernel/messages";
export const capabilitiesAtom = atom<Capabilities>({
sql: false,
diff --git a/frontend/src/core/config/if-capability.tsx b/frontend/src/core/config/if-capability.tsx
index 38e57cd012..1a95e19de4 100644
--- a/frontend/src/core/config/if-capability.tsx
+++ b/frontend/src/core/config/if-capability.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React from "react";
-import { Capabilities } from "../kernel/messages";
+import type { Capabilities } from "../kernel/messages";
import { useAtomValue } from "jotai";
import { capabilitiesAtom } from "./capabilities";
diff --git a/frontend/src/core/datasets/types.ts b/frontend/src/core/datasets/types.ts
index bb683cc79f..80f987e545 100644
--- a/frontend/src/core/datasets/types.ts
+++ b/frontend/src/core/datasets/types.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataColumnPreview, DataTable } from "../kernel/messages";
+import type { DataColumnPreview, DataTable } from "../kernel/messages";
/**
* A qualified column name, e.g. `table:column`.
diff --git a/frontend/src/core/debugger/state.ts b/frontend/src/core/debugger/state.ts
index 7ca3e215e1..d35f4941ee 100644
--- a/frontend/src/core/debugger/state.ts
+++ b/frontend/src/core/debugger/state.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { OutputMessage } from "../kernel/messages";
+import type { OutputMessage } from "../kernel/messages";
interface DebuggerState {
cellId: string;
diff --git a/frontend/src/core/dom/ui-element.ts b/frontend/src/core/dom/ui-element.ts
index 32a74a40e6..07b2200bd7 100644
--- a/frontend/src/core/dom/ui-element.ts
+++ b/frontend/src/core/dom/ui-element.ts
@@ -113,10 +113,12 @@ export function initializeUIElement() {
if (objectId === null) {
Logger.error("[marimo-ui-element] missing object-id attribute");
return;
- } else if (child === null) {
+ }
+ if (child === null) {
Logger.error("[marimo-ui-element] has no child");
return;
- } else if (!(child instanceof HTMLElement)) {
+ }
+ if (!(child instanceof HTMLElement)) {
Logger.error(
"[marimo-ui-element] first child must be instance of HTMLElement",
);
diff --git a/frontend/src/core/errors/state.ts b/frontend/src/core/errors/state.ts
index 5f5cf2341c..95be08e096 100644
--- a/frontend/src/core/errors/state.ts
+++ b/frontend/src/core/errors/state.ts
@@ -2,9 +2,9 @@
import { createReducerAndAtoms } from "@/utils/createReducer";
import { useAtomValue } from "jotai";
-import { Banner } from "../kernel/messages";
+import type { Banner } from "../kernel/messages";
import { generateUUID } from "@/utils/uuid";
-import { Identified } from "@/utils/typed";
+import type { Identified } from "@/utils/typed";
interface BannerState {
banners: Array<Identified<Banner>>;
diff --git a/frontend/src/core/hotkeys/actions.ts b/frontend/src/core/hotkeys/actions.ts
index e94eb7f3a2..baae578f3e 100644
--- a/frontend/src/core/hotkeys/actions.ts
+++ b/frontend/src/core/hotkeys/actions.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom, useAtomValue, useSetAtom } from "jotai";
-import { HotkeyAction } from "@/core/hotkeys/hotkeys";
+import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
/**
* Map of registered keyboard shortcuts and their callbacks.
diff --git a/frontend/src/core/islands/components/output-wrapper.tsx b/frontend/src/core/islands/components/output-wrapper.tsx
index 3a297e4fa0..5e8f961fe3 100644
--- a/frontend/src/core/islands/components/output-wrapper.tsx
+++ b/frontend/src/core/islands/components/output-wrapper.tsx
@@ -2,17 +2,17 @@
import { OutputRenderer } from "@/components/editor/Output";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
-import { NotebookState, notebookAtom } from "@/core/cells/cells";
-import { CellId } from "@/core/cells/ids";
+import { type NotebookState, notebookAtom } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
import { isOutputEmpty } from "@/core/cells/outputs";
-import { CellRuntimeState } from "@/core/cells/types";
+import type { CellRuntimeState } from "@/core/cells/types";
import { sendRun } from "@/core/network/requests";
import { useEventListener } from "@/hooks/useEventListener";
import { Logger } from "@/utils/Logger";
import { useAtomValue } from "jotai";
import { selectAtom } from "jotai/utils";
import { CopyIcon, Loader2Icon, PlayIcon } from "lucide-react";
-import React, { PropsWithChildren, useCallback, useState } from "react";
+import React, { type PropsWithChildren, useCallback, useState } from "react";
interface Props {
cellId: CellId;
diff --git a/frontend/src/core/islands/components/web-components.tsx b/frontend/src/core/islands/components/web-components.tsx
index 9f7511be20..107dad25a5 100644
--- a/frontend/src/core/islands/components/web-components.tsx
+++ b/frontend/src/core/islands/components/web-components.tsx
@@ -69,7 +69,7 @@ export class MarimoIslandElement extends HTMLElement {
codeCallback: () => string,
editor: JSX.Element | null,
) {
- const alwaysShowRun = editor ? true : false;
+ const alwaysShowRun = !!editor;
this.root?.render(
<ErrorBoundary>
<Provider store={store}>
diff --git a/frontend/src/core/kernel/messages.ts b/frontend/src/core/kernel/messages.ts
index d2a8c703fe..930649fd85 100644
--- a/frontend/src/core/kernel/messages.ts
+++ b/frontend/src/core/kernel/messages.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type components } from "@marimo-team/marimo-api";
+import type { components } from "@marimo-team/marimo-api";
export type schemas = components["schemas"];
export type DataType = schemas["DataType"];
diff --git a/frontend/src/core/kernel/queryParamHandlers.ts b/frontend/src/core/kernel/queryParamHandlers.ts
index 25ecc98442..1078ddd3f3 100644
--- a/frontend/src/core/kernel/queryParamHandlers.ts
+++ b/frontend/src/core/kernel/queryParamHandlers.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { OperationMessageData } from "./messages";
+import type { OperationMessageData } from "./messages";
export const queryParamHandlers = {
append: (data: OperationMessageData<"query-params-append">) => {
diff --git a/frontend/src/core/layout/layout.ts b/frontend/src/core/layout/layout.ts
index 34bc3feb45..8366b43d5a 100644
--- a/frontend/src/core/layout/layout.ts
+++ b/frontend/src/core/layout/layout.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { GridLayout } from "@/components/editor/renderers/grid-layout/types";
-import { LayoutType } from "@/components/editor/renderers/types";
+import type { GridLayout } from "@/components/editor/renderers/grid-layout/types";
+import type { LayoutType } from "@/components/editor/renderers/types";
import { useAtomValue } from "jotai";
import { createReducerAndAtoms } from "@/utils/createReducer";
import { cellRendererPlugins } from "@/components/editor/renderers/plugins";
diff --git a/frontend/src/core/mode.ts b/frontend/src/core/mode.ts
index e8e6b5810b..cbf27bf37c 100644
--- a/frontend/src/core/mode.ts
+++ b/frontend/src/core/mode.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { CellId } from "./cells/ids";
+import type { CellId } from "./cells/ids";
import { store } from "./state/jotai";
import { assertNever } from "@/utils/assertNever";
import { Logger } from "@/utils/Logger";
diff --git a/frontend/src/core/network/DeferredRequestRegistry.ts b/frontend/src/core/network/DeferredRequestRegistry.ts
index fcf0a7c47e..11ae12c03f 100644
--- a/frontend/src/core/network/DeferredRequestRegistry.ts
+++ b/frontend/src/core/network/DeferredRequestRegistry.ts
@@ -2,7 +2,7 @@
/* eslint-disable @typescript-eslint/no-redeclare */
import { Deferred } from "@/utils/Deferred";
import { generateUUID } from "@/utils/uuid";
-import { TypedString } from "../../utils/typed";
+import type { TypedString } from "../../utils/typed";
export type RequestId = TypedString<"RequestId">;
export const RequestId = {
diff --git a/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts b/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
index 98420ed7d8..514a6e4809 100644
--- a/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
+++ b/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
@@ -1,6 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { beforeEach, expect, vi, describe, it } from "vitest";
-import { DeferredRequestRegistry, RequestId } from "../DeferredRequestRegistry";
+import {
+ DeferredRequestRegistry,
+ type RequestId,
+} from "../DeferredRequestRegistry";
vi.mock("@/utils/uuid", () => ({
generateUUID: vi.fn().mockReturnValue("uuid"),
diff --git a/frontend/src/core/network/api.ts b/frontend/src/core/network/api.ts
index c959efac81..b26b382dd8 100644
--- a/frontend/src/core/network/api.ts
+++ b/frontend/src/core/network/api.ts
@@ -42,11 +42,11 @@ export const API = {
? await response.json()
: await response.text();
throw new Error(response.statusText, { cause: errorBody });
- } else if (isJson) {
+ }
+ if (isJson) {
return response.json() as RESP;
- } else {
- return response.text() as unknown as RESP;
}
+ return response.text() as unknown as RESP;
})
.catch((error) => {
// Catch and rethrow
diff --git a/frontend/src/core/network/connection.ts b/frontend/src/core/network/connection.ts
index 3a044a1899..36e3961e64 100644
--- a/frontend/src/core/network/connection.ts
+++ b/frontend/src/core/network/connection.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { ConnectionStatus, WebSocketState } from "../websocket/types";
+import { type ConnectionStatus, WebSocketState } from "../websocket/types";
/**
* Atom for storing the connection status.
diff --git a/frontend/src/core/run-app.tsx b/frontend/src/core/run-app.tsx
index 96df71efcd..65717ef1d4 100644
--- a/frontend/src/core/run-app.tsx
+++ b/frontend/src/core/run-app.tsx
@@ -3,7 +3,7 @@
import { useEffect } from "react";
import { notebookIsRunningAtom, useCellActions } from "./cells/cells";
-import { AppConfig } from "./config/config-schema";
+import type { AppConfig } from "./config/config-schema";
import { RuntimeState } from "./kernel/RuntimeState";
import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
import { useAtomValue } from "jotai";
diff --git a/frontend/src/core/saving/useAutoSave.ts b/frontend/src/core/saving/useAutoSave.ts
index f26db06e66..256917f028 100644
--- a/frontend/src/core/saving/useAutoSave.ts
+++ b/frontend/src/core/saving/useAutoSave.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useEffect, useRef } from "react";
-import { ConnectionStatus, WebSocketState } from "../websocket/types";
-import { UserConfig } from "../config/config-schema";
-import { CellConfig } from "../network/types";
+import { type ConnectionStatus, WebSocketState } from "../websocket/types";
+import type { UserConfig } from "../config/config-schema";
+import type { CellConfig } from "../network/types";
export function useAutoSave(opts: {
codes: string[];
diff --git a/frontend/src/core/state/jotai.ts b/frontend/src/core/state/jotai.ts
index 73f0c0faa7..0e77dbdcfb 100644
--- a/frontend/src/core/state/jotai.ts
+++ b/frontend/src/core/state/jotai.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Atom, createStore, useStore } from "jotai";
+import { type Atom, createStore, useStore } from "jotai";
import { useEffect } from "react";
/**
diff --git a/frontend/src/core/static/__tests__/virtual-file-tracker.test.ts b/frontend/src/core/static/__tests__/virtual-file-tracker.test.ts
index 4b766fad4a..cead8eea10 100644
--- a/frontend/src/core/static/__tests__/virtual-file-tracker.test.ts
+++ b/frontend/src/core/static/__tests__/virtual-file-tracker.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, it } from "vitest";
import { VirtualFileTracker, findVirtualFiles } from "../virtual-file-tracker";
-import { CellId } from "@/core/cells/ids";
-import { OutputMessage } from "@/core/kernel/messages";
+import type { CellId } from "@/core/cells/ids";
+import type { OutputMessage } from "@/core/kernel/messages";
describe("findVirtualFiles", () => {
it("should return a set containing all virtual file paths in a string", () => {
diff --git a/frontend/src/core/static/static-state.ts b/frontend/src/core/static/static-state.ts
index 55c524c8d4..233b4ac1fb 100644
--- a/frontend/src/core/static/static-state.ts
+++ b/frontend/src/core/static/static-state.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { invariant } from "@/utils/invariant";
-import {
+import type {
MarimoStaticState,
StaticNotebookState,
StaticVirtualFiles,
diff --git a/frontend/src/core/static/types.ts b/frontend/src/core/static/types.ts
index 91cc4a5dcc..f0274cdaba 100644
--- a/frontend/src/core/static/types.ts
+++ b/frontend/src/core/static/types.ts
@@ -1,8 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Base64String, DataURLString, JsonString } from "@/utils/json/base64";
-import { CellId } from "../cells/ids";
-import { OutputMessage } from "../kernel/messages";
-import { CellConfig } from "../network/types";
+import type {
+ Base64String,
+ DataURLString,
+ JsonString,
+} from "@/utils/json/base64";
+import type { CellId } from "../cells/ids";
+import type { OutputMessage } from "../kernel/messages";
+import type { CellConfig } from "../network/types";
export interface StaticNotebookState {
cellIds: CellId[];
diff --git a/frontend/src/core/static/virtual-file-tracker.ts b/frontend/src/core/static/virtual-file-tracker.ts
index cd0a39815b..2cf3bf11ae 100644
--- a/frontend/src/core/static/virtual-file-tracker.ts
+++ b/frontend/src/core/static/virtual-file-tracker.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellMessage } from "../kernel/messages";
-import { CellId } from "../cells/ids";
+import type { CellMessage } from "../kernel/messages";
+import type { CellId } from "../cells/ids";
// Virtual files are of the form /@file/<file-name>.<extension>
const VIRTUAL_FILE_REGEX = /\/@file\/([^\s/]+)\.([\dA-Za-z]+)/g;
diff --git a/frontend/src/core/variables/__tests__/state.test.ts b/frontend/src/core/variables/__tests__/state.test.ts
index 8f7c92bd93..12d2ebc423 100644
--- a/frontend/src/core/variables/__tests__/state.test.ts
+++ b/frontend/src/core/variables/__tests__/state.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { beforeEach, describe, expect, it } from "vitest";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
import { exportedForTesting } from "../state";
-import { VariableName, Variables } from "../types";
+import type { VariableName, Variables } from "../types";
const { initialState, reducer, createActions } = exportedForTesting;
diff --git a/frontend/src/core/variables/types.ts b/frontend/src/core/variables/types.ts
index da3bae3e68..c5a0cd17a4 100644
--- a/frontend/src/core/variables/types.ts
+++ b/frontend/src/core/variables/types.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CellId } from "../cells/ids";
-import { TypedString } from "../../utils/typed";
+import type { CellId } from "../cells/ids";
+import type { TypedString } from "../../utils/typed";
export type VariableName = TypedString<"VariableName">;
diff --git a/frontend/src/core/wasm/worker/getController.ts b/frontend/src/core/wasm/worker/getController.ts
index 71ca1727e4..7e6f0bbe5f 100644
--- a/frontend/src/core/wasm/worker/getController.ts
+++ b/frontend/src/core/wasm/worker/getController.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { DefaultWasmController } from "./bootstrap";
-import { WasmController } from "./types";
+import type { WasmController } from "./types";
// Load the controller
// Falls back to the default controller
diff --git a/frontend/src/core/wasm/worker/save-worker.ts b/frontend/src/core/wasm/worker/save-worker.ts
index c99b2fba49..a113387f76 100644
--- a/frontend/src/core/wasm/worker/save-worker.ts
+++ b/frontend/src/core/wasm/worker/save-worker.ts
@@ -8,11 +8,11 @@ import {
createRPCRequestHandler,
type RPCSchema,
} from "rpc-anywhere";
-import { ParentSchema } from "../rpc";
+import type { ParentSchema } from "../rpc";
import { Logger } from "../../../utils/Logger";
import { TRANSPORT_ID } from "./constants";
import { getPyodideVersion, importPyodide } from "./getPyodideVersion";
-import { SaveNotebookRequest } from "@/core/network/types";
+import type { SaveNotebookRequest } from "@/core/network/types";
import { WasmFileSystem } from "./fs";
import { getController } from "./getController";
diff --git a/frontend/src/core/wasm/worker/types.ts b/frontend/src/core/wasm/worker/types.ts
index 9fc5609a75..34054fa0c3 100644
--- a/frontend/src/core/wasm/worker/types.ts
+++ b/frontend/src/core/wasm/worker/types.ts
@@ -21,9 +21,9 @@ import type {
SaveUserConfigurationRequest,
Snippets,
} from "../../network/types";
-import { OperationMessage } from "@/core/kernel/messages";
-import { JsonString } from "@/utils/json/base64";
-import { UserConfig } from "@/core/config/config-schema";
+import type { OperationMessage } from "@/core/kernel/messages";
+import type { JsonString } from "@/utils/json/base64";
+import type { UserConfig } from "@/core/config/config-schema";
export interface WasmController {
/**
diff --git a/frontend/src/core/websocket/StaticWebsocket.ts b/frontend/src/core/websocket/StaticWebsocket.ts
index 64c5a1ada4..ad8a37cbaa 100644
--- a/frontend/src/core/websocket/StaticWebsocket.ts
+++ b/frontend/src/core/websocket/StaticWebsocket.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { IReconnectingWebSocket } from "./types";
+import type { IReconnectingWebSocket } from "./types";
export class StaticWebsocket implements IReconnectingWebSocket {
CONNECTING = WebSocket.CONNECTING;
diff --git a/frontend/src/core/websocket/types.ts b/frontend/src/core/websocket/types.ts
index c9f87ae60c..1fce7085dc 100644
--- a/frontend/src/core/websocket/types.ts
+++ b/frontend/src/core/websocket/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import ReconnectingWebSocket from "partysocket/ws";
+import type ReconnectingWebSocket from "partysocket/ws";
export enum WebSocketState {
CONNECTING = "CONNECTING",
diff --git a/frontend/src/hooks/useAsyncData.ts b/frontend/src/hooks/useAsyncData.ts
index 67d4f54ab5..d65fd2b191 100644
--- a/frontend/src/hooks/useAsyncData.ts
+++ b/frontend/src/hooks/useAsyncData.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SetStateAction } from "jotai";
-import { DependencyList, useState, useEffect, Dispatch } from "react";
+import type { SetStateAction } from "jotai";
+import { type DependencyList, useState, useEffect, type Dispatch } from "react";
interface AsyncDataResponse<T> {
data: T | undefined;
diff --git a/frontend/src/hooks/useAudioRecorder.ts b/frontend/src/hooks/useAudioRecorder.ts
index 9a0c3a772a..ef6418bca4 100644
--- a/frontend/src/hooks/useAudioRecorder.ts
+++ b/frontend/src/hooks/useAudioRecorder.ts
@@ -58,13 +58,13 @@ export function useAudioRecorder(opts: {
mediaRecorder.current?.pause();
timer.stop();
return "paused";
- } else if (state === "paused") {
+ }
+ if (state === "paused") {
mediaRecorder.current?.resume();
timer.start();
return "recording";
- } else {
- return state;
}
+ return state;
});
});
diff --git a/frontend/src/hooks/useElapsedTime.ts b/frontend/src/hooks/useElapsedTime.ts
index 556c694630..80f419f533 100644
--- a/frontend/src/hooks/useElapsedTime.ts
+++ b/frontend/src/hooks/useElapsedTime.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Milliseconds, Time } from "@/utils/time";
+import { type Milliseconds, Time } from "@/utils/time";
import { useEffect, useRef, useState } from "react";
/**
diff --git a/frontend/src/hooks/useHotkey.ts b/frontend/src/hooks/useHotkey.ts
index b667bb7af7..8c9452ad6e 100644
--- a/frontend/src/hooks/useHotkey.ts
+++ b/frontend/src/hooks/useHotkey.ts
@@ -5,7 +5,7 @@ import { parseShortcut } from "../core/hotkeys/shortcuts";
import { useEventListener } from "./useEventListener";
import { useEvent } from "./useEvent";
import { useSetRegisteredAction } from "../core/hotkeys/actions";
-import { HotkeyAction } from "@/core/hotkeys/hotkeys";
+import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
import { Objects } from "@/utils/objects";
import { Logger } from "@/utils/Logger";
import { Functions } from "@/utils/functions";
diff --git a/frontend/src/hooks/useLifecycle.ts b/frontend/src/hooks/useLifecycle.ts
index 091649a9fd..c55158cdd8 100644
--- a/frontend/src/hooks/useLifecycle.ts
+++ b/frontend/src/hooks/useLifecycle.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EffectCallback, useEffect } from "react";
+import { type EffectCallback, useEffect } from "react";
/**
* Wrapper around useEffect that makes it clearer that the effect is run, just on mount.
diff --git a/frontend/src/hooks/useRecentCommands.ts b/frontend/src/hooks/useRecentCommands.ts
index cb3aaed309..cca7d2290a 100644
--- a/frontend/src/hooks/useRecentCommands.ts
+++ b/frontend/src/hooks/useRecentCommands.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { HotkeyAction } from "@/core/hotkeys/hotkeys";
+import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
import { useLocalStorage } from "./useLocalStorage";
const MAX_RECENT_COMMANDS = 3;
diff --git a/frontend/src/plugins/core/RenderHTML.tsx b/frontend/src/plugins/core/RenderHTML.tsx
index 2e7a245c8f..38f055f970 100644
--- a/frontend/src/plugins/core/RenderHTML.tsx
+++ b/frontend/src/plugins/core/RenderHTML.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import parse, { Element, DOMNode } from "html-react-parser";
+import parse, { Element, type DOMNode } from "html-react-parser";
import React from "react";
type ReplacementFn = Array<(domNode: DOMNode) => JSX.Element | undefined>;
diff --git a/frontend/src/plugins/core/builder.ts b/frontend/src/plugins/core/builder.ts
index ea4350d1b4..f47bb39898 100644
--- a/frontend/src/plugins/core/builder.ts
+++ b/frontend/src/plugins/core/builder.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ZodType, ZodTypeDef } from "zod";
-import { IPluginProps, IPlugin } from "../types";
-import { FunctionSchemas, PluginFunctions } from "./rpc";
+import type { ZodType, ZodTypeDef } from "zod";
+import type { IPluginProps, IPlugin } from "../types";
+import type { FunctionSchemas, PluginFunctions } from "./rpc";
type Renderer<S, D, F> = (props: IPluginProps<S, D, F>) => JSX.Element;
// If this simple builder pattern becomes unwieldy, we can switch to a more
diff --git a/frontend/src/plugins/core/rpc.ts b/frontend/src/plugins/core/rpc.ts
index a2077b0556..8310bebfe9 100644
--- a/frontend/src/plugins/core/rpc.ts
+++ b/frontend/src/plugins/core/rpc.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { ZodType, ZodTypeDef } from "zod";
+import type { ZodType, ZodTypeDef } from "zod";
export type PluginFunction<REQ = any, RES = any> = (args: REQ) => Promise<RES>;
diff --git a/frontend/src/plugins/impl/ButtonPlugin.tsx b/frontend/src/plugins/impl/ButtonPlugin.tsx
index 2e8490ed40..ed626eb88b 100644
--- a/frontend/src/plugins/impl/ButtonPlugin.tsx
+++ b/frontend/src/plugins/impl/ButtonPlugin.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps } from "../types";
+import type { IPlugin, IPluginProps } from "../types";
import { Button } from "../../components/ui/button";
import { renderHTML } from "../core/RenderHTML";
-import { Intent, zodIntent } from "./common/intent";
+import { type Intent, zodIntent } from "./common/intent";
import { cn } from "@/utils/cn";
import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
diff --git a/frontend/src/plugins/impl/CheckboxPlugin.tsx b/frontend/src/plugins/impl/CheckboxPlugin.tsx
index 3062a783c5..b011174d27 100644
--- a/frontend/src/plugins/impl/CheckboxPlugin.tsx
+++ b/frontend/src/plugins/impl/CheckboxPlugin.tsx
@@ -2,9 +2,9 @@
import { useId } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps } from "../types";
+import type { IPlugin, IPluginProps } from "../types";
import { Checkbox } from "../../components/ui/checkbox";
-import { CheckedState } from "@radix-ui/react-checkbox";
+import type { CheckedState } from "@radix-ui/react-checkbox";
import { Labeled } from "./common/labeled";
export class CheckboxPlugin
diff --git a/frontend/src/plugins/impl/CodeEditorPlugin.tsx b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
index 38c192871d..93fff1a5c5 100644
--- a/frontend/src/plugins/impl/CodeEditorPlugin.tsx
+++ b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Labeled } from "./common/labeled";
-import { Theme, useTheme } from "@/theme/useTheme";
+import { type Theme, useTheme } from "@/theme/useTheme";
import { LazyAnyLanguageCodeMirror } from "./code/LazyAnyLanguageCodeMirror";
type T = string;
diff --git a/frontend/src/plugins/impl/DatePickerPlugin.tsx b/frontend/src/plugins/impl/DatePickerPlugin.tsx
index 7fdfe378f6..9a65b35202 100644
--- a/frontend/src/plugins/impl/DatePickerPlugin.tsx
+++ b/frontend/src/plugins/impl/DatePickerPlugin.tsx
@@ -2,7 +2,7 @@
import { useId, useRef } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Input } from "../../components/ui/input";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/DropdownPlugin.tsx b/frontend/src/plugins/impl/DropdownPlugin.tsx
index e590aff16d..4a1386e070 100644
--- a/frontend/src/plugins/impl/DropdownPlugin.tsx
+++ b/frontend/src/plugins/impl/DropdownPlugin.tsx
@@ -2,7 +2,7 @@
import { useId } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps } from "../types";
+import type { IPlugin, IPluginProps } from "../types";
import { NativeSelect } from "../../components/ui/native-select";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/FileBrowserPlugin.tsx b/frontend/src/plugins/impl/FileBrowserPlugin.tsx
index 50ea363d5d..2a64c13888 100644
--- a/frontend/src/plugins/impl/FileBrowserPlugin.tsx
+++ b/frontend/src/plugins/impl/FileBrowserPlugin.tsx
@@ -9,11 +9,11 @@ import { toast } from "@/components/ui/use-toast";
import { NativeSelect } from "@/components/ui/native-select";
import {
FILE_TYPE_ICONS,
- FileType,
+ type FileType,
guessFileType,
} from "@/components/editor/file-tree/types";
import { renderHTML } from "../core/RenderHTML";
-import { FilePath, PathBuilder, Paths } from "@/utils/paths";
+import { type FilePath, PathBuilder, Paths } from "@/utils/paths";
import { CornerLeftUp } from "lucide-react";
import { Logger } from "@/utils/Logger";
import { Button } from "@/components/ui/button";
diff --git a/frontend/src/plugins/impl/FileUploadPlugin.tsx b/frontend/src/plugins/impl/FileUploadPlugin.tsx
index 14f8441ec1..5b53c5eacf 100644
--- a/frontend/src/plugins/impl/FileUploadPlugin.tsx
+++ b/frontend/src/plugins/impl/FileUploadPlugin.tsx
@@ -4,7 +4,7 @@ import { useDropzone } from "react-dropzone";
import { Upload, MousePointerSquareDashedIcon } from "lucide-react";
import { cn } from "@/utils/cn";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { filesToBase64 } from "../../utils/fileToBase64";
import { buttonVariants } from "../../components/ui/button";
import { renderHTML } from "../core/RenderHTML";
diff --git a/frontend/src/plugins/impl/MicrophonePlugin.tsx b/frontend/src/plugins/impl/MicrophonePlugin.tsx
index 83af43999e..aa507cde15 100644
--- a/frontend/src/plugins/impl/MicrophonePlugin.tsx
+++ b/frontend/src/plugins/impl/MicrophonePlugin.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps } from "@/plugins/types";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { Labeled } from "./common/labeled";
import { useAudioRecorder } from "@/hooks/useAudioRecorder";
import { AudioRecorder } from "@/components/audio/audio-recorder";
diff --git a/frontend/src/plugins/impl/MultiselectPlugin.tsx b/frontend/src/plugins/impl/MultiselectPlugin.tsx
index c39fc46a0a..52f81a59b3 100644
--- a/frontend/src/plugins/impl/MultiselectPlugin.tsx
+++ b/frontend/src/plugins/impl/MultiselectPlugin.tsx
@@ -2,7 +2,7 @@
import { useId, useMemo, useState } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Combobox, ComboboxItem } from "../../components/ui/combobox";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/NumberPlugin.tsx b/frontend/src/plugins/impl/NumberPlugin.tsx
index 92b0122d6d..20340c39f8 100644
--- a/frontend/src/plugins/impl/NumberPlugin.tsx
+++ b/frontend/src/plugins/impl/NumberPlugin.tsx
@@ -2,7 +2,7 @@
import { useId } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Labeled } from "./common/labeled";
import { useDebounceControlledState } from "@/hooks/useDebounce";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/RadioPlugin.tsx b/frontend/src/plugins/impl/RadioPlugin.tsx
index 5be43127c0..a36f7de1e3 100644
--- a/frontend/src/plugins/impl/RadioPlugin.tsx
+++ b/frontend/src/plugins/impl/RadioPlugin.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
-import { IPlugin, IPluginProps } from "@/plugins/types";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/RangeSliderPlugin.tsx b/frontend/src/plugins/impl/RangeSliderPlugin.tsx
index 4408cb10af..240c9ea103 100644
--- a/frontend/src/plugins/impl/RangeSliderPlugin.tsx
+++ b/frontend/src/plugins/impl/RangeSliderPlugin.tsx
@@ -2,7 +2,7 @@
import { useEffect, useId, useState } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { RangeSlider } from "../../components/ui/range-slider";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/RefreshPlugin.tsx b/frontend/src/plugins/impl/RefreshPlugin.tsx
index efc20021ba..174e96306e 100644
--- a/frontend/src/plugins/impl/RefreshPlugin.tsx
+++ b/frontend/src/plugins/impl/RefreshPlugin.tsx
@@ -2,7 +2,7 @@
import { useEffect, useState } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps } from "@/plugins/types";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { RefreshCwIcon } from "lucide-react";
import timestring from "timestring";
import { NativeSelect } from "@/components/ui/native-select";
diff --git a/frontend/src/plugins/impl/SliderPlugin.tsx b/frontend/src/plugins/impl/SliderPlugin.tsx
index 502796f65c..7a6a0b28cc 100644
--- a/frontend/src/plugins/impl/SliderPlugin.tsx
+++ b/frontend/src/plugins/impl/SliderPlugin.tsx
@@ -2,7 +2,7 @@
import { useEffect, useId, useState } from "react";
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Slider } from "../../components/ui/slider";
import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/impl/SwitchPlugin.tsx b/frontend/src/plugins/impl/SwitchPlugin.tsx
index eeb88d7804..2554c83f79 100644
--- a/frontend/src/plugins/impl/SwitchPlugin.tsx
+++ b/frontend/src/plugins/impl/SwitchPlugin.tsx
@@ -3,7 +3,7 @@ import { useId } from "react";
import { z } from "zod";
import { Switch } from "@/components/ui/switch";
-import { IPlugin, IPluginProps } from "@/plugins/types";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { Labeled } from "./common/labeled";
export class SwitchPlugin
diff --git a/frontend/src/plugins/impl/TabsPlugin.tsx b/frontend/src/plugins/impl/TabsPlugin.tsx
index 0c4d24aeec..bbb3c5798e 100644
--- a/frontend/src/plugins/impl/TabsPlugin.tsx
+++ b/frontend/src/plugins/impl/TabsPlugin.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import {
Tabs,
@@ -9,7 +9,7 @@ import {
} from "../../components/ui/tabs";
import { z } from "zod";
import { renderHTML } from "../core/RenderHTML";
-import { IPlugin, IPluginProps } from "../types";
+import type { IPlugin, IPluginProps } from "../types";
interface Data {
/**
diff --git a/frontend/src/plugins/impl/TextAreaPlugin.tsx b/frontend/src/plugins/impl/TextAreaPlugin.tsx
index 57a543dfd5..1d3b468354 100644
--- a/frontend/src/plugins/impl/TextAreaPlugin.tsx
+++ b/frontend/src/plugins/impl/TextAreaPlugin.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Textarea } from "../../components/ui/textarea";
import { Labeled } from "./common/labeled";
diff --git a/frontend/src/plugins/impl/TextInputPlugin.tsx b/frontend/src/plugins/impl/TextInputPlugin.tsx
index d6f4fbf9ea..9c92abc0a5 100644
--- a/frontend/src/plugins/impl/TextInputPlugin.tsx
+++ b/frontend/src/plugins/impl/TextInputPlugin.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "../types";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Input } from "../../components/ui/input";
import { cn } from "../../utils/cn";
diff --git a/frontend/src/plugins/impl/code/any-language-editor.tsx b/frontend/src/plugins/impl/code/any-language-editor.tsx
index ade1835066..3919a95a20 100644
--- a/frontend/src/plugins/impl/code/any-language-editor.tsx
+++ b/frontend/src/plugins/impl/code/any-language-editor.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import ReactCodeMirror, {
- Extension,
- ReactCodeMirrorProps,
+ type Extension,
+ type ReactCodeMirrorProps,
} from "@uiw/react-codemirror";
import {
loadLanguage,
langs,
- LanguageName,
+ type LanguageName,
} from "@uiw/codemirror-extensions-langs";
import React, { useMemo } from "react";
import { Logger } from "@/utils/Logger";
diff --git a/frontend/src/plugins/impl/common/error-banner.tsx b/frontend/src/plugins/impl/common/error-banner.tsx
index 63ebc40c06..56624150c7 100644
--- a/frontend/src/plugins/impl/common/error-banner.tsx
+++ b/frontend/src/plugins/impl/common/error-banner.tsx
@@ -10,7 +10,7 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { cn } from "@/utils/cn";
-import { VariantProps, cva } from "class-variance-authority";
+import { type VariantProps, cva } from "class-variance-authority";
import { Logger } from "@/utils/Logger";
export const ErrorBanner = ({
diff --git a/frontend/src/plugins/impl/common/labeled.tsx b/frontend/src/plugins/impl/common/labeled.tsx
index e64aaf5b14..09b4195da3 100644
--- a/frontend/src/plugins/impl/common/labeled.tsx
+++ b/frontend/src/plugins/impl/common/labeled.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Label } from "@/components/ui/label";
import { renderHTML } from "@/plugins/core/RenderHTML";
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import { cn } from "@/utils/cn";
interface Props {
diff --git a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
index 5b99123bea..875e6f1730 100644
--- a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
+++ b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
@@ -15,14 +15,14 @@ import {
} from "./state/reducer";
import { Provider, createStore, useAtomValue } from "jotai";
import { Button } from "@/components/ui/button";
-import { SpecificEncoding } from "./encoding";
+import type { SpecificEncoding } from "./encoding";
import { Objects } from "@/utils/objects";
import { Badge } from "@/components/ui/badge";
import { ErrorBanner } from "../common/error-banner";
import { ColumnSummary } from "./components/column-summary";
-import { VegaLiteProps } from "react-vega/lib/VegaLite";
+import type { VegaLiteProps } from "react-vega/lib/VegaLite";
import { useOnMount } from "@/hooks/useLifecycle";
-import { ChartSpec } from "./state/types";
+import type { ChartSpec } from "./state/types";
/**
* @param label - a label of the table
diff --git a/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx b/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx
index daec3f6670..78fb48aac5 100644
--- a/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx
+++ b/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx
@@ -2,7 +2,7 @@
import { BarChartBigIcon } from "lucide-react";
import React, { useState } from "react";
import { PRIMITIVE_TYPE_ICON } from "./icons";
-import { Schema } from "compassql/build/src/schema";
+import type { Schema } from "compassql/build/src/schema";
import { Button } from "@/components/ui/button";
import { cn } from "@/utils/cn";
import {
diff --git a/frontend/src/plugins/impl/data-explorer/components/query-form.tsx b/frontend/src/plugins/impl/data-explorer/components/query-form.tsx
index b67638c0b8..c6e2525911 100644
--- a/frontend/src/plugins/impl/data-explorer/components/query-form.tsx
+++ b/frontend/src/plugins/impl/data-explorer/components/query-form.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-base-to-string */
-import { PrimitiveType, Schema } from "compassql/build/src/schema";
+import { PrimitiveType, type Schema } from "compassql/build/src/schema";
import React from "react";
import { Label } from "@/components/ui/label";
import { PRIMITIVE_TYPE_ICON } from "./icons";
import { useAtomValue } from "jotai";
import { chartSpecAtom, useChartSpecActions } from "../state/reducer";
-import { EncodingChannel, FieldDefinition } from "../encoding";
+import type { EncodingChannel, FieldDefinition } from "../encoding";
import {
Select,
SelectContent,
@@ -22,11 +22,11 @@ import {
QUANTITATIVE_FUNCTIONS,
SINGLE_TEMPORAL_FUNCTIONS,
} from "../functions/function";
-import { FieldFunction } from "../functions/types";
+import type { FieldFunction } from "../functions/types";
import { FunctionSquareIcon } from "lucide-react";
import { startCase } from "lodash-es";
import { ExpandedType } from "compassql/build/src/query/expandedtype";
-import { MARKS, SpecMark } from "../marks";
+import { MARKS, type SpecMark } from "../marks";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
interface Props {
diff --git a/frontend/src/plugins/impl/data-explorer/encoding.ts b/frontend/src/plugins/impl/data-explorer/encoding.ts
index 7f04249a90..b702121284 100644
--- a/frontend/src/plugins/impl/data-explorer/encoding.ts
+++ b/frontend/src/plugins/impl/data-explorer/encoding.ts
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { FieldQuery } from "compassql/build/src/query/encoding";
-import { ExpandedType } from "compassql/build/src/query/expandedtype";
+import type { FieldQuery } from "compassql/build/src/query/encoding";
+import type { ExpandedType } from "compassql/build/src/query/expandedtype";
import {
isWildcard,
- SHORT_WILDCARD,
- WildcardProperty,
+ type SHORT_WILDCARD,
+ type WildcardProperty,
} from "compassql/build/src/wildcard";
import {
fromFieldQueryFunctionMixins,
toFieldQueryFunctionMixins,
} from "./functions/function";
import { invariant } from "@/utils/invariant";
-import { FieldFunction } from "./functions/types";
+import type { FieldFunction } from "./functions/types";
import { removeUndefined } from "./queries/removeUndefined";
import { Logger } from "@/utils/Logger";
@@ -85,7 +85,8 @@ export function fromFieldQuery(fieldQ: FieldQuery): FieldDefinition {
if (isWildcard(type)) {
throw new Error("Wildcard not support");
- } else if (type === "ordinal") {
+ }
+ if (type === "ordinal") {
Logger.warn("Ordinal type is not supported. Using nominal type instead.");
type = "nominal";
}
diff --git a/frontend/src/plugins/impl/data-explorer/functions/function.ts b/frontend/src/plugins/impl/data-explorer/functions/function.ts
index 30ba1bc45b..4d6983c759 100644
--- a/frontend/src/plugins/impl/data-explorer/functions/function.ts
+++ b/frontend/src/plugins/impl/data-explorer/functions/function.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-base-to-string */
-import { FieldQuery } from "compassql/build/src/query/encoding";
+import type { FieldQuery } from "compassql/build/src/query/encoding";
import { isAggregateOp } from "vega-lite/build/src/aggregate";
-import { FieldFunction, TimeUnitOp } from "./types";
+import type { FieldFunction, TimeUnitOp } from "./types";
// This code is adapted and simplified from https://github.com/vega/voyager
@@ -16,11 +16,14 @@ export function toFieldQueryFunctionMixins(
): FieldQueryFunctionMixins {
if (!fn) {
return {};
- } else if (fn === "bin") {
+ }
+ if (fn === "bin") {
return { bin: true };
- } else if (isAggregateOp(fn)) {
+ }
+ if (isAggregateOp(fn)) {
return { aggregate: fn };
- } else if (isTimeUnit(fn)) {
+ }
+ if (isTimeUnit(fn)) {
return { timeUnit: fn };
}
return {};
diff --git a/frontend/src/plugins/impl/data-explorer/marks.ts b/frontend/src/plugins/impl/data-explorer/marks.ts
index 760329f30d..08f73afecc 100644
--- a/frontend/src/plugins/impl/data-explorer/marks.ts
+++ b/frontend/src/plugins/impl/data-explorer/marks.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SpecQuery } from "compassql/build/src/query/spec";
+import type { SpecQuery } from "compassql/build/src/query/spec";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
export type SpecMark = SpecQuery["mark"] | SHORT_WILDCARD;
diff --git a/frontend/src/plugins/impl/data-explorer/queries/field-suggestion.ts b/frontend/src/plugins/impl/data-explorer/queries/field-suggestion.ts
index c941f6be9d..37fedbac2f 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/field-suggestion.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/field-suggestion.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { FieldQuery } from "compassql/build/src/query/encoding";
-import { Query } from "compassql/build/src/query/query";
+import type { FieldQuery } from "compassql/build/src/query/encoding";
+import type { Query } from "compassql/build/src/query/query";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
-import { QueryCreator, ResultingCharts } from "./types";
+import type { QueryCreator, ResultingCharts } from "./types";
// This code is adapted and simplified from https://github.com/vega/voyager
diff --git a/frontend/src/plugins/impl/data-explorer/queries/histograms.ts b/frontend/src/plugins/impl/data-explorer/queries/histograms.ts
index 657de9488c..7f9769f730 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/histograms.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/histograms.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Query } from "compassql/build/src/query/query";
+import type { Query } from "compassql/build/src/query/query";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
-import { QueryCreator } from "./types";
+import type { QueryCreator } from "./types";
// This code is adapted and simplified from https://github.com/vega/voyager
diff --git a/frontend/src/plugins/impl/data-explorer/queries/queries.ts b/frontend/src/plugins/impl/data-explorer/queries/queries.ts
index 2429585d4b..6d0f2b4c03 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/queries.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/queries.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Query } from "compassql/build/src/query";
-import { SpecQuery } from "compassql/build/src/query/spec";
+import type { Query } from "compassql/build/src/query";
+import type { SpecQuery } from "compassql/build/src/query/spec";
import { contains } from "vega-lite";
import { NONPOSITION_SCALE_CHANNELS } from "vega-lite/build/src/channel";
import {
@@ -9,16 +9,19 @@ import {
addTemporalField,
} from "./field-suggestion";
import { recommend } from "compassql/build/src";
-import { Schema } from "compassql/build/src/schema";
-import { SpecQueryModelGroup, SpecQueryModel } from "compassql/build/src/model";
+import type { Schema } from "compassql/build/src/schema";
+import type {
+ SpecQueryModelGroup,
+ SpecQueryModel,
+} from "compassql/build/src/model";
import { isResultTree, getTopResultTreeItem } from "compassql/build/src/result";
-import { NamedData } from "vega-lite/build/src/data";
+import type { NamedData } from "vega-lite/build/src/data";
import { isFieldQuery } from "compassql/build/src/query/encoding";
-import { EncodingChannel, fromFieldQuery } from "../encoding";
-import { ChartSpec } from "../state/types";
+import { type EncodingChannel, fromFieldQuery } from "../encoding";
+import type { ChartSpec } from "../state/types";
import { hasWildcards, isQueryEmpty } from "./utils";
import { toSpecQuery } from "../spec";
-import {
+import type {
Result,
QueryCreator,
ResultPlot,
diff --git a/frontend/src/plugins/impl/data-explorer/queries/utils.ts b/frontend/src/plugins/impl/data-explorer/queries/utils.ts
index 64be4240e2..6f39c5ce4e 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/utils.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/utils.ts
@@ -3,9 +3,9 @@ import {
isValueQuery,
isAutoCountQuery,
} from "compassql/build/src/query/encoding";
-import { SpecQuery } from "compassql/build/src/query/spec";
+import type { SpecQuery } from "compassql/build/src/query/spec";
import { isWildcard } from "compassql/build/src/wildcard";
-import { EncodingChannel } from "../encoding";
+import type { EncodingChannel } from "../encoding";
// This code is adapted and simplified from https://github.com/vega/voyager
@@ -51,7 +51,9 @@ export function hasWildcards(spec: SpecQuery): HasWildcard {
for (const encQ of spec.encodings) {
if (isValueQuery(encQ)) {
continue;
- } else if (isAutoCountQuery(encQ)) {
+ }
+
+ if (isAutoCountQuery(encQ)) {
if (isWildcard(encQ.autoCount)) {
hasWildcardFn = true;
}
diff --git a/frontend/src/plugins/impl/data-explorer/spec.ts b/frontend/src/plugins/impl/data-explorer/spec.ts
index a8b2084c08..10e2d726b9 100644
--- a/frontend/src/plugins/impl/data-explorer/spec.ts
+++ b/frontend/src/plugins/impl/data-explorer/spec.ts
@@ -1,8 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EncodingQuery } from "compassql/build/src/query/encoding";
-import { SpecQuery } from "compassql/build/src/query/spec";
-import { SpecificEncoding, toFieldQuery, EncodingChannel } from "./encoding";
-import { ChartSpec } from "./state/types";
+import type { EncodingQuery } from "compassql/build/src/query/encoding";
+import type { SpecQuery } from "compassql/build/src/query/spec";
+import {
+ type SpecificEncoding,
+ toFieldQuery,
+ type EncodingChannel,
+} from "./encoding";
+import type { ChartSpec } from "./state/types";
export function toSpecQuery(spec: ChartSpec): SpecQuery {
return {
diff --git a/frontend/src/plugins/impl/data-explorer/state/reducer.ts b/frontend/src/plugins/impl/data-explorer/state/reducer.ts
index 960ca2b8b8..9eef91e781 100644
--- a/frontend/src/plugins/impl/data-explorer/state/reducer.ts
+++ b/frontend/src/plugins/impl/data-explorer/state/reducer.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SpecificEncoding } from "../encoding";
+import type { SpecificEncoding } from "../encoding";
import { createReducerAndAtoms } from "@/utils/createReducer";
-import { ChartSpec } from "./types";
+import type { ChartSpec } from "./types";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
import { atom } from "jotai";
import {
@@ -13,9 +13,9 @@ import {
import { isQueryEmpty, isQueryFull, isQuerySpecific } from "../queries/utils";
import { removeUndefined } from "../queries/removeUndefined";
import { histograms } from "../queries/histograms";
-import { Schema } from "compassql/build/src/schema";
-import { SpecMark } from "../marks";
-import { ResultingCharts } from "../queries/types";
+import type { Schema } from "compassql/build/src/schema";
+import type { SpecMark } from "../marks";
+import type { ResultingCharts } from "../queries/types";
function initialState(): ChartSpec {
return {
diff --git a/frontend/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx b/frontend/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx
index 10c9c0d19a..b19c5777fd 100644
--- a/frontend/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx
+++ b/frontend/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx
@@ -5,8 +5,8 @@ import { TransformTypeSchema } from "../../schema";
import { render } from "@testing-library/react";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
-import { z } from "zod";
-import { ColumnId } from "../../types";
+import type { z } from "zod";
+import type { ColumnId } from "../../types";
import { ColumnInfoContext } from "../context";
const ColumnTypes = new Map([
diff --git a/frontend/src/plugins/impl/data-frames/forms/context.ts b/frontend/src/plugins/impl/data-frames/forms/context.ts
index 8d2a4a1301..01d99dd7e6 100644
--- a/frontend/src/plugins/impl/data-frames/forms/context.ts
+++ b/frontend/src/plugins/impl/data-frames/forms/context.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { createContext } from "react";
-import { ColumnDataTypes } from "../types";
+import type { ColumnDataTypes } from "../types";
export const ColumnInfoContext = createContext<ColumnDataTypes>(new Map());
diff --git a/frontend/src/plugins/impl/data-frames/forms/form.tsx b/frontend/src/plugins/impl/data-frames/forms/form.tsx
index 4a70f131d6..bb14f8d663 100644
--- a/frontend/src/plugins/impl/data-frames/forms/form.tsx
+++ b/frontend/src/plugins/impl/data-frames/forms/form.tsx
@@ -7,10 +7,10 @@ import {
} from "../../../../components/ui/input";
import { Checkbox } from "../../../../components/ui/checkbox";
import {
- FieldValues,
+ type FieldValues,
FormProvider,
- Path,
- UseFormReturn,
+ type Path,
+ type UseFormReturn,
useController,
useFieldArray,
} from "react-hook-form";
@@ -60,7 +60,7 @@ import {
TextAreaMultiSelect,
ensureStringArray,
} from "@/components/forms/switchable-multi-select";
-import { ColumnId } from "../types";
+import type { ColumnId } from "../types";
interface Props<T extends FieldValues> {
form: UseFormReturn<T>;
@@ -136,13 +136,15 @@ function renderZodSchema<T extends FieldValues, S>(
})}
</div>
);
- } else if (schema instanceof z.ZodString) {
+ }
+ if (schema instanceof z.ZodString) {
if (special === "column_values") {
return <ColumnValuesFormField schema={schema} form={form} path={path} />;
}
return <StringFormField schema={schema} form={form} path={path} />;
- } else if (schema instanceof z.ZodBoolean) {
+ }
+ if (schema instanceof z.ZodBoolean) {
return (
<FormField
control={form.control}
@@ -165,7 +167,8 @@ function renderZodSchema<T extends FieldValues, S>(
)}
/>
);
- } else if (schema instanceof z.ZodNumber) {
+ }
+ if (schema instanceof z.ZodNumber) {
if (special === "random_number_button") {
return (
<FormField
@@ -208,7 +211,8 @@ function renderZodSchema<T extends FieldValues, S>(
)}
/>
);
- } else if (schema instanceof z.ZodDate) {
+ }
+ if (schema instanceof z.ZodDate) {
return (
<FormField
control={form.control}
@@ -230,9 +234,11 @@ function renderZodSchema<T extends FieldValues, S>(
)}
/>
);
- } else if (schema instanceof z.ZodAny) {
+ }
+ if (schema instanceof z.ZodAny) {
return <StringFormField schema={schema} form={form} path={path} />;
- } else if (schema instanceof z.ZodEnum) {
+ }
+ if (schema instanceof z.ZodEnum) {
return (
<SelectFormField
schema={schema}
@@ -241,7 +247,8 @@ function renderZodSchema<T extends FieldValues, S>(
options={schema._def.values}
/>
);
- } else if (schema instanceof z.ZodArray) {
+ }
+ if (schema instanceof z.ZodArray) {
if (special === "text_area_multiline") {
return <MultiStringFormField schema={schema} form={form} path={path} />;
}
@@ -294,7 +301,8 @@ function renderZodSchema<T extends FieldValues, S>(
/>
</div>
);
- } else if (schema instanceof z.ZodUnion) {
+ }
+ if (schema instanceof z.ZodUnion) {
return (
<FormField
control={form.control}
@@ -336,7 +344,8 @@ function renderZodSchema<T extends FieldValues, S>(
}}
/>
);
- } else if (schema instanceof z.ZodLiteral) {
+ }
+ if (schema instanceof z.ZodLiteral) {
return (
<FormField
control={form.control}
@@ -344,19 +353,19 @@ function renderZodSchema<T extends FieldValues, S>(
render={({ field }) => <input {...field} type="hidden" />}
/>
);
- } else if (
+ }
+ if (
schema instanceof z.ZodEffects &&
["refinement", "transform"].includes(schema._def.effect.type)
) {
return renderZodSchema(schema._def.schema, form, path);
- } else {
- return (
- <div>
- Unknown schema type{" "}
- {schema == null ? path : JSON.stringify(schema._type ?? schema)}
- </div>
- );
}
+ return (
+ <div>
+ Unknown schema type{" "}
+ {schema == null ? path : JSON.stringify(schema._type ?? schema)}
+ </div>
+ );
}
const StyledFormMessage = ({ className }: { className?: string }) => {
diff --git a/frontend/src/plugins/impl/data-frames/panel.tsx b/frontend/src/plugins/impl/data-frames/panel.tsx
index bc27d7eab7..7b58978c27 100644
--- a/frontend/src/plugins/impl/data-frames/panel.tsx
+++ b/frontend/src/plugins/impl/data-frames/panel.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren, useEffect, useMemo } from "react";
+import React, { type PropsWithChildren, useEffect, useMemo } from "react";
import {
- TransformType,
+ type TransformType,
TransformTypeSchema,
- Transformations,
+ type Transformations,
TransformationsSchema,
} from "./schema";
import {
@@ -18,7 +18,7 @@ import {
import { Button } from "../../../components/ui/button";
import { zodResolver } from "@hookform/resolvers/zod";
import { useFieldArray, useForm } from "react-hook-form";
-import { z } from "zod";
+import type { z } from "zod";
import { ZodForm } from "./forms/form";
import { getDefaults, getUnionLiteral } from "./forms/form-utils";
import {
@@ -43,7 +43,7 @@ import {
ColumnInfoContext,
} from "@/plugins/impl/data-frames/forms/context";
import useEvent from "react-use-event-hook";
-import { ColumnDataTypes } from "./types";
+import type { ColumnDataTypes } from "./types";
import { getUpdatedColumnTypes } from "./utils/getUpdatedColumnTypes";
import { Strings } from "@/utils/strings";
diff --git a/frontend/src/plugins/impl/data-frames/python/__tests__/python-print.test.ts b/frontend/src/plugins/impl/data-frames/python/__tests__/python-print.test.ts
index be195ad563..b0d8f40ee2 100644
--- a/frontend/src/plugins/impl/data-frames/python/__tests__/python-print.test.ts
+++ b/frontend/src/plugins/impl/data-frames/python/__tests__/python-print.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { pythonPrint } from "@/plugins/impl/data-frames/python/python-print";
-import { TransformType } from "@/plugins/impl/data-frames/schema";
+import type { TransformType } from "@/plugins/impl/data-frames/schema";
import { expect, describe, it } from "vitest";
import {
BOOLEAN_OPERATORS,
@@ -9,7 +9,7 @@ import {
STRING_OPERATORS,
} from "../../utils/operators";
import { Objects } from "@/utils/objects";
-import { ColumnId } from "../../types";
+import type { ColumnId } from "../../types";
describe("pythonPrint", () => {
// Test for column_conversion
diff --git a/frontend/src/plugins/impl/data-frames/python/code-panel.tsx b/frontend/src/plugins/impl/data-frames/python/code-panel.tsx
index 0c7889b8c6..9ac9229e00 100644
--- a/frontend/src/plugins/impl/data-frames/python/code-panel.tsx
+++ b/frontend/src/plugins/impl/data-frames/python/code-panel.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React from "react";
-import { Transformations } from "../schema";
+import type { Transformations } from "../schema";
import { pythonPrintTransforms } from "./python-print";
import { ReadonlyPythonCode } from "@/components/editor/code/readonly-python-code";
diff --git a/frontend/src/plugins/impl/data-frames/python/python-print.ts b/frontend/src/plugins/impl/data-frames/python/python-print.ts
index 3c0e9217ad..79cd48bda8 100644
--- a/frontend/src/plugins/impl/data-frames/python/python-print.ts
+++ b/frontend/src/plugins/impl/data-frames/python/python-print.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TransformType } from "@/plugins/impl/data-frames/schema";
+import type { TransformType } from "@/plugins/impl/data-frames/schema";
import { logNever } from "@/utils/assertNever";
-import { OperatorType } from "../utils/operators";
-import { ColumnId } from "../types";
+import type { OperatorType } from "../utils/operators";
+import type { ColumnId } from "../types";
export function pythonPrintTransforms(
dfName: string,
diff --git a/frontend/src/plugins/impl/data-frames/schema.ts b/frontend/src/plugins/impl/data-frames/schema.ts
index 48dc97c5ad..3ef2a8a212 100644
--- a/frontend/src/plugins/impl/data-frames/schema.ts
+++ b/frontend/src/plugins/impl/data-frames/schema.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
AGGREGATION_FNS,
- ColumnId,
+ type ColumnId,
NUMPY_DTYPES,
} from "@/plugins/impl/data-frames/types";
import {
@@ -11,7 +11,7 @@ import {
import { z } from "zod";
import {
ALL_OPERATORS,
- OperatorType,
+ type OperatorType,
isConditionValueValid,
} from "./utils/operators";
diff --git a/frontend/src/plugins/impl/data-frames/utils/__tests__/getUpdatedColumnTypes.test.ts b/frontend/src/plugins/impl/data-frames/utils/__tests__/getUpdatedColumnTypes.test.ts
index 4fdb517f4f..905367b212 100644
--- a/frontend/src/plugins/impl/data-frames/utils/__tests__/getUpdatedColumnTypes.test.ts
+++ b/frontend/src/plugins/impl/data-frames/utils/__tests__/getUpdatedColumnTypes.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, it } from "vitest";
import { getUpdatedColumnTypes } from "../getUpdatedColumnTypes";
-import { TransformType } from "../../schema";
-import { ColumnId } from "../../types";
+import type { TransformType } from "../../schema";
+import type { ColumnId } from "../../types";
const INITIAL_COLUMN_TYPES = new Map<ColumnId, string>([
["col1" as ColumnId, "str"],
diff --git a/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts b/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
index 3e28257fed..a60ba3535c 100644
--- a/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
+++ b/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { logNever } from "@/utils/assertNever";
-import { TransformType } from "../schema";
-import { ColumnDataTypes } from "../types";
+import type { TransformType } from "../schema";
+import type { ColumnDataTypes } from "../types";
import { Maps } from "@/utils/maps";
/**
diff --git a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
index 0130fbfca9..5bc57e6328 100644
--- a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
+++ b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps, Setter } from "@/plugins/types";
+import type { IPlugin, IPluginProps, Setter } from "@/plugins/types";
import type { Figure } from "react-plotly.js";
import { Logger } from "@/utils/Logger";
@@ -10,7 +10,7 @@ import "./plotly.css";
import "./mapbox.css";
import { lazy, memo, useEffect, useMemo, useState } from "react";
import useEvent from "react-use-event-hook";
-import { PlotlyTemplateParser, createParser } from "./parse-from-template";
+import { type PlotlyTemplateParser, createParser } from "./parse-from-template";
import { Objects } from "@/utils/objects";
import { isEqual, set } from "lodash-es";
import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
diff --git a/frontend/src/plugins/impl/vega/VegaPlugin.tsx b/frontend/src/plugins/impl/vega/VegaPlugin.tsx
index a03f2e61a3..14e2590194 100644
--- a/frontend/src/plugins/impl/vega/VegaPlugin.tsx
+++ b/frontend/src/plugins/impl/vega/VegaPlugin.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IPlugin, IPluginProps } from "@/plugins/types";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import type { VegaLiteSpec } from "./types";
import type { VegaComponentState, Data } from "./vega-component";
diff --git a/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts b/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts
index a33c09dd08..3006f8f323 100644
--- a/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, it } from "vitest";
import { findEncodedFields, makeEncodingInteractive } from "../encodings";
-import { EncodingType, Encodings, VegaLiteSpec } from "../types";
+import type { EncodingType, Encodings, VegaLiteSpec } from "../types";
describe("findEncodedFields", () => {
it("should return an empty array when spec is undefined", () => {
diff --git a/frontend/src/plugins/impl/vega/__tests__/params.test.ts b/frontend/src/plugins/impl/vega/__tests__/params.test.ts
index f7db99828b..7204d91256 100644
--- a/frontend/src/plugins/impl/vega/__tests__/params.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/params.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, it } from "vitest";
import { getDirectionOfBar } from "../params";
-import { VegaLiteUnitSpec } from "../types";
+import type { VegaLiteUnitSpec } from "../types";
describe("getDirectionOfBar", () => {
it("should return undefined if spec is not provided", () => {
diff --git a/frontend/src/plugins/impl/vega/__tests__/resolve-data.test.ts b/frontend/src/plugins/impl/vega/__tests__/resolve-data.test.ts
index 7526bcc9db..a3678a6c9b 100644
--- a/frontend/src/plugins/impl/vega/__tests__/resolve-data.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/resolve-data.test.ts
@@ -2,7 +2,7 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { vegaLoader } from "../loader";
import { resolveVegaSpecData } from "../resolve-data";
-import { VegaLiteSpec } from "../types";
+import type { VegaLiteSpec } from "../types";
function asSpec(spec: unknown): VegaLiteSpec {
return spec as VegaLiteSpec;
diff --git a/frontend/src/plugins/impl/vega/encodings.ts b/frontend/src/plugins/impl/vega/encodings.ts
index 4fe1fe6e4c..7e0a98e7f7 100644
--- a/frontend/src/plugins/impl/vega/encodings.ts
+++ b/frontend/src/plugins/impl/vega/encodings.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Marks } from "./marks";
-import {
+import type {
AnyMark,
EncodingType,
Encodings,
diff --git a/frontend/src/plugins/impl/vega/fix-relative-url.ts b/frontend/src/plugins/impl/vega/fix-relative-url.ts
index 7c48964dc7..3bd784b825 100644
--- a/frontend/src/plugins/impl/vega/fix-relative-url.ts
+++ b/frontend/src/plugins/impl/vega/fix-relative-url.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { asURL } from "@/utils/url";
-import { VegaLiteSpec } from "./types";
+import type { VegaLiteSpec } from "./types";
/**
* If the URL in the data-spec if relative, we need to fix it to be absolute,
diff --git a/frontend/src/plugins/impl/vega/loader.ts b/frontend/src/plugins/impl/vega/loader.ts
index 8780267f2f..cbb9d06c47 100644
--- a/frontend/src/plugins/impl/vega/loader.ts
+++ b/frontend/src/plugins/impl/vega/loader.ts
@@ -1,7 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataFormat } from "./types";
+import type { DataFormat } from "./types";
import { isNumber } from "lodash-es";
-import { typeParsers, createLoader, read, FieldTypes } from "./vega-loader";
+import {
+ typeParsers,
+ createLoader,
+ read,
+ type FieldTypes,
+} from "./vega-loader";
// Augment the typeParsers to support Date
typeParsers.date = (value: string) => new Date(value).toISOString();
diff --git a/frontend/src/plugins/impl/vega/marks.ts b/frontend/src/plugins/impl/vega/marks.ts
index 67b1370bf1..256e9140ff 100644
--- a/frontend/src/plugins/impl/vega/marks.ts
+++ b/frontend/src/plugins/impl/vega/marks.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { AnyMark, Mark } from "./types";
+import { type AnyMark, Mark } from "./types";
export const Marks = {
getMarkType(mark: AnyMark): Mark {
diff --git a/frontend/src/plugins/impl/vega/params.ts b/frontend/src/plugins/impl/vega/params.ts
index f46f337047..2d7e0ac974 100644
--- a/frontend/src/plugins/impl/vega/params.ts
+++ b/frontend/src/plugins/impl/vega/params.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TopLevelSpec } from "vega-lite";
+import type { TopLevelSpec } from "vega-lite";
import { Marks } from "./marks";
import {
- Field,
+ type Field,
Mark,
- SelectionParameter,
- SingleDefUnitChannel,
- VegaLiteUnitSpec,
+ type SelectionParameter,
+ type SingleDefUnitChannel,
+ type VegaLiteUnitSpec,
} from "./types";
-import { LayerSpec, UnitSpec } from "vega-lite/build/src/spec";
+import type { LayerSpec, UnitSpec } from "vega-lite/build/src/spec";
export const ParamNames = {
point(layerNum: number | undefined) {
diff --git a/frontend/src/plugins/impl/vega/resolve-data.ts b/frontend/src/plugins/impl/vega/resolve-data.ts
index 32b023436a..1e6b060917 100644
--- a/frontend/src/plugins/impl/vega/resolve-data.ts
+++ b/frontend/src/plugins/impl/vega/resolve-data.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { asURL } from "@/utils/url";
import { vegaLoadData } from "./loader";
-import {
+import type {
Field,
VegaLiteSpec,
LayerSpec,
diff --git a/frontend/src/plugins/impl/vega/utils.ts b/frontend/src/plugins/impl/vega/utils.ts
index f214d942f2..786b3527da 100644
--- a/frontend/src/plugins/impl/vega/utils.ts
+++ b/frontend/src/plugins/impl/vega/utils.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Objects } from "@/utils/objects";
-import { FieldTypes } from "./vega-loader";
+import type { FieldTypes } from "./vega-loader";
export function mergeAsArrays<T>(
left: T | T[] | undefined,
diff --git a/frontend/src/plugins/layout/CalloutPlugin.tsx b/frontend/src/plugins/layout/CalloutPlugin.tsx
index 1ba85cb1f2..1538859875 100644
--- a/frontend/src/plugins/layout/CalloutPlugin.tsx
+++ b/frontend/src/plugins/layout/CalloutPlugin.tsx
@@ -1,9 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { CalloutOutput } from "../../components/editor/output/CalloutOutput";
-import { Intent, zodIntent } from "../impl/common/intent";
+import { type Intent, zodIntent } from "../impl/common/intent";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/DownloadPlugin.tsx b/frontend/src/plugins/layout/DownloadPlugin.tsx
index 2274f5074f..048878d791 100644
--- a/frontend/src/plugins/layout/DownloadPlugin.tsx
+++ b/frontend/src/plugins/layout/DownloadPlugin.tsx
@@ -1,7 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { DownloadIcon } from "lucide-react";
import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/plugins/layout/JsonOutputPlugin.tsx b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
index 1f3e0074c6..a85029c869 100644
--- a/frontend/src/plugins/layout/JsonOutputPlugin.tsx
+++ b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
@@ -2,7 +2,10 @@
import { z } from "zod";
import { JsonOutput } from "../../components/editor/output/JsonOutput";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { EmotionCacheProvider } from "../../components/editor/output/EmotionCacheProvider";
interface Data {
diff --git a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx b/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
index b0af224a90..e8380f68c0 100644
--- a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
+++ b/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
@@ -1,8 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { PropsWithChildren } from "react";
+import type { PropsWithChildren } from "react";
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import {
NavigationMenu,
NavigationMenuList,
diff --git a/frontend/src/plugins/layout/ProgressPlugin.tsx b/frontend/src/plugins/layout/ProgressPlugin.tsx
index 174ae80faa..378ef3d47c 100644
--- a/frontend/src/plugins/layout/ProgressPlugin.tsx
+++ b/frontend/src/plugins/layout/ProgressPlugin.tsx
@@ -1,8 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { renderHTML } from "../core/RenderHTML";
import { Progress } from "@/components/ui/progress";
import { Loader2Icon } from "lucide-react";
diff --git a/frontend/src/plugins/layout/RoutesPlugin.tsx b/frontend/src/plugins/layout/RoutesPlugin.tsx
index 1425a382a1..5ad463dbf2 100644
--- a/frontend/src/plugins/layout/RoutesPlugin.tsx
+++ b/frontend/src/plugins/layout/RoutesPlugin.tsx
@@ -1,8 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren, useEffect, useMemo, useState } from "react";
+import React, {
+ type PropsWithChildren,
+ useEffect,
+ useMemo,
+ useState,
+} from "react";
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { TinyRouter } from "@/utils/routes";
import useEvent from "react-use-event-hook";
diff --git a/frontend/src/plugins/layout/StatPlugin.tsx b/frontend/src/plugins/layout/StatPlugin.tsx
index b1f626fc11..1b333f949c 100644
--- a/frontend/src/plugins/layout/StatPlugin.tsx
+++ b/frontend/src/plugins/layout/StatPlugin.tsx
@@ -1,7 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { TriangleIcon } from "lucide-react";
import { cn } from "@/utils/cn";
import { prettyNumber } from "@/utils/numbers";
diff --git a/frontend/src/plugins/layout/TexPlugin.tsx b/frontend/src/plugins/layout/TexPlugin.tsx
index ec46995142..8312dcbb47 100644
--- a/frontend/src/plugins/layout/TexPlugin.tsx
+++ b/frontend/src/plugins/layout/TexPlugin.tsx
@@ -2,7 +2,10 @@
import { useLayoutEffect, useRef } from "react";
import { z } from "zod";
-import { IStatelessPlugin, IStatelessPluginProps } from "../stateless-plugin";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import { once } from "@/utils/once";
/**
diff --git a/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx b/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
index dec62611b0..b02634d696 100644
--- a/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
+++ b/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import {
+import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../../stateless-plugin";
diff --git a/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx b/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
index 7602544e5b..72e8cdc184 100644
--- a/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
+++ b/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
@@ -2,7 +2,7 @@
import { z } from "zod";
import { lazy } from "react";
-import {
+import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "@/plugins/stateless-plugin";
diff --git a/frontend/src/plugins/stateless-plugin.ts b/frontend/src/plugins/stateless-plugin.ts
index f3a512d8b5..f0ba1a3c56 100644
--- a/frontend/src/plugins/stateless-plugin.ts
+++ b/frontend/src/plugins/stateless-plugin.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { IPlugin } from "./types";
+import type { IPlugin } from "./types";
export interface IStatelessPluginProps<D> {
/**
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index e587d5a0ec..cdc03a3c26 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ZodType, ZodTypeDef } from "zod";
-import { PluginFunctions, FunctionSchemas } from "./core/rpc";
+import type { ZodType, ZodTypeDef } from "zod";
+import type { PluginFunctions, FunctionSchemas } from "./core/rpc";
/**
* State setter. Either a value or a function that takes the previous value and
diff --git a/frontend/src/stories/__fixtures__/vega.ts b/frontend/src/stories/__fixtures__/vega.ts
index 4c37342abe..2afef5d7df 100644
--- a/frontend/src/stories/__fixtures__/vega.ts
+++ b/frontend/src/stories/__fixtures__/vega.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { VegaLiteSpec } from "@/plugins/impl/vega/types";
+import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
export const BAR_CHART: VegaLiteSpec = {
data: {
diff --git a/frontend/src/stories/cell-status.stories.tsx b/frontend/src/stories/cell-status.stories.tsx
index c07fef7053..e23efa669b 100644
--- a/frontend/src/stories/cell-status.stories.tsx
+++ b/frontend/src/stories/cell-status.stories.tsx
@@ -2,7 +2,7 @@
import type { Meta, StoryFn } from "@storybook/react";
import {
CellStatusComponent,
- CellStatusComponentProps,
+ type CellStatusComponentProps,
} from "@/components/editor/cell/CellStatus";
import { TooltipProvider } from "@/components/ui/tooltip";
diff --git a/frontend/src/stories/cell.stories.tsx b/frontend/src/stories/cell.stories.tsx
index 3c73ba4e07..3fcc0c70eb 100644
--- a/frontend/src/stories/cell.stories.tsx
+++ b/frontend/src/stories/cell.stories.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
-import { Cell, CellProps } from "../components/editor/Cell";
+import { Cell, type CellProps } from "../components/editor/Cell";
import { TooltipProvider } from "../components/ui/tooltip";
-import { CellId } from "../core/cells/ids";
+import type { CellId } from "../core/cells/ids";
import { Logger } from "@/utils/Logger";
-import { Milliseconds, Seconds } from "@/utils/time";
+import type { Milliseconds, Seconds } from "@/utils/time";
import { defaultUserConfig } from "@/core/config/config-schema";
const meta: Meta<typeof Cell> = {
diff --git a/frontend/src/stories/colors.stories.tsx b/frontend/src/stories/colors.stories.tsx
index 3b445e0ab2..3580b6de9d 100644
--- a/frontend/src/stories/colors.stories.tsx
+++ b/frontend/src/stories/colors.stories.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Meta, StoryObj } from "@storybook/react";
+import type { Meta, StoryObj } from "@storybook/react";
const COLORS = [
"bg-background",
diff --git a/frontend/src/stories/data-explorer.stories.tsx b/frontend/src/stories/data-explorer.stories.tsx
index fb8492021e..0c3fe8a0af 100644
--- a/frontend/src/stories/data-explorer.stories.tsx
+++ b/frontend/src/stories/data-explorer.stories.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable react-hooks/rules-of-hooks */
import { DataExplorerComponent } from "@/plugins/impl/data-explorer/ConnectedDataExplorerComponent";
-import { ChartSpec } from "@/plugins/impl/data-explorer/state/types";
+import type { ChartSpec } from "@/plugins/impl/data-explorer/state/types";
import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
diff --git a/frontend/src/stories/dataframe.stories.tsx b/frontend/src/stories/dataframe.stories.tsx
index 0f8d796c89..90588f5305 100644
--- a/frontend/src/stories/dataframe.stories.tsx
+++ b/frontend/src/stories/dataframe.stories.tsx
@@ -3,8 +3,8 @@
import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
import { DataFrameComponent } from "@/plugins/impl/data-frames/DataFramePlugin";
-import { Transformations } from "@/plugins/impl/data-frames/schema";
-import { ColumnId } from "@/plugins/impl/data-frames/types";
+import type { Transformations } from "@/plugins/impl/data-frames/schema";
+import type { ColumnId } from "@/plugins/impl/data-frames/types";
import { Functions } from "@/utils/functions";
const meta: Meta = {
diff --git a/frontend/src/stories/editor-inputs.stories.tsx b/frontend/src/stories/editor-inputs.stories.tsx
index 3724352f8d..f0668be943 100644
--- a/frontend/src/stories/editor-inputs.stories.tsx
+++ b/frontend/src/stories/editor-inputs.stories.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { StoryFn, Meta } from "@storybook/react";
+import type { StoryFn, Meta } from "@storybook/react";
import { Button, Input } from "../components/editor/inputs/Inputs";
import { PlayIcon } from "lucide-react";
diff --git a/frontend/src/stories/editor.stories.tsx b/frontend/src/stories/editor.stories.tsx
index 9135f3f41a..7a57c2c728 100644
--- a/frontend/src/stories/editor.stories.tsx
+++ b/frontend/src/stories/editor.stories.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
import { useEffect, useRef } from "react";
-import { EditorState, Extension } from "@codemirror/state";
+import { EditorState, type Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import CodeMirror from "@uiw/react-codemirror";
-import { CodeMirrorSetupOpts, basicBundle } from "../core/codemirror/cm";
+import { type CodeMirrorSetupOpts, basicBundle } from "../core/codemirror/cm";
import { python } from "@codemirror/lang-python";
import { CopilotConfig } from "@/core/codemirror/copilot/copilot-config";
import { copilotBundle } from "@/core/codemirror/copilot/extension";
diff --git a/frontend/src/stories/form-wrapper.stories.tsx b/frontend/src/stories/form-wrapper.stories.tsx
index 83eaded998..332ef7ec9b 100644
--- a/frontend/src/stories/form-wrapper.stories.tsx
+++ b/frontend/src/stories/form-wrapper.stories.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
import { TooltipProvider } from "../components/ui/tooltip";
-import { FormWrapper, FormWrapperProps } from "@/plugins/impl/FormPlugin";
+import { FormWrapper, type FormWrapperProps } from "@/plugins/impl/FormPlugin";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
diff --git a/frontend/src/stories/log-viewer.stories.tsx b/frontend/src/stories/log-viewer.stories.tsx
index a03a345c94..14d4523993 100644
--- a/frontend/src/stories/log-viewer.stories.tsx
+++ b/frontend/src/stories/log-viewer.stories.tsx
@@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react";
import { Dialog } from "../components/ui/dialog";
import { TooltipProvider } from "../components/ui/tooltip";
import { LogViewer } from "@/components/editor/chrome/panels/logs-panel";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
const meta: Meta<typeof LogViewer> = {
title: "LogViewer",
diff --git a/frontend/src/stories/select.stories.tsx b/frontend/src/stories/select.stories.tsx
index 7b5cc8dbae..6b4aba0f17 100644
--- a/frontend/src/stories/select.stories.tsx
+++ b/frontend/src/stories/select.stories.tsx
@@ -10,7 +10,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { Meta, StoryObj } from "@storybook/react";
+import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
const meta: Meta = {
diff --git a/frontend/src/stories/switchable-multi-select.stories.tsx b/frontend/src/stories/switchable-multi-select.stories.tsx
index c4ebbcafc6..31c3560e44 100644
--- a/frontend/src/stories/switchable-multi-select.stories.tsx
+++ b/frontend/src/stories/switchable-multi-select.stories.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable react-hooks/rules-of-hooks */
-import { Meta, StoryObj } from "@storybook/react";
+import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
import { SwitchableMultiSelect } from "@/components/forms/switchable-multi-select";
import { TooltipProvider } from "@/components/ui/tooltip";
diff --git a/frontend/src/stories/variables.stories.tsx b/frontend/src/stories/variables.stories.tsx
index ecd3e19524..4366bdaa71 100644
--- a/frontend/src/stories/variables.stories.tsx
+++ b/frontend/src/stories/variables.stories.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
import { VariableTable } from "@/components/variables/variables-table";
-import { CellId } from "@/core/cells/ids";
+import type { CellId } from "@/core/cells/ids";
const meta: Meta<typeof VariableTable> = {
title: "VariableTable",
diff --git a/frontend/src/stories/vega.stories.tsx b/frontend/src/stories/vega.stories.tsx
index 52b69b350c..de1558f508 100644
--- a/frontend/src/stories/vega.stories.tsx
+++ b/frontend/src/stories/vega.stories.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import VegaComponent from "@/plugins/impl/vega/vega-component";
-import { Meta } from "@storybook/react";
+import type { Meta } from "@storybook/react";
import {
AREA_CHART,
BAR_CHART,
@@ -16,7 +16,7 @@ import {
STACKED_BAR_CHART,
TICK_CHART,
} from "./__fixtures__/vega";
-import { VegaLiteSpec } from "@/plugins/impl/vega/types";
+import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
const meta: Meta = {
title: "Vega",
diff --git a/frontend/src/theme/ThemeProvider.tsx b/frontend/src/theme/ThemeProvider.tsx
index 93807bdc57..5bf706c6ca 100644
--- a/frontend/src/theme/ThemeProvider.tsx
+++ b/frontend/src/theme/ThemeProvider.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { PropsWithChildren, memo, useLayoutEffect } from "react";
+import { type PropsWithChildren, memo, useLayoutEffect } from "react";
import { useTheme } from "./useTheme";
/**
diff --git a/frontend/src/theme/namespace.tsx b/frontend/src/theme/namespace.tsx
index f911d16252..f990741588 100644
--- a/frontend/src/theme/namespace.tsx
+++ b/frontend/src/theme/namespace.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { PropsWithChildren } from "react";
+import React, { type PropsWithChildren } from "react";
const style = {
display: "contents",
diff --git a/frontend/src/utils/__tests__/time.test.ts b/frontend/src/utils/__tests__/time.test.ts
index 9b1e3a8383..991e4b01a4 100644
--- a/frontend/src/utils/__tests__/time.test.ts
+++ b/frontend/src/utils/__tests__/time.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, it } from "vitest";
-import { Milliseconds, Time, Seconds } from "../time";
+import { type Milliseconds, Time, type Seconds } from "../time";
describe("Time class", () => {
describe("fromMilliseconds", () => {
diff --git a/frontend/src/utils/assertNever.ts b/frontend/src/utils/assertNever.ts
index 5fdc6324ca..9900b48a80 100644
--- a/frontend/src/utils/assertNever.ts
+++ b/frontend/src/utils/assertNever.ts
@@ -14,5 +14,6 @@ export function assertNever(x: never): never {
*/
export function logNever(x: never): void {
Logger.warn(`Unexpected object: ${JSON.stringify(x)}`);
+ // biome-ignore lint/correctness/noVoidTypeReturn: <explanation>
return x;
}
diff --git a/frontend/src/utils/blob.ts b/frontend/src/utils/blob.ts
index 06349ec940..2102dd1b2c 100644
--- a/frontend/src/utils/blob.ts
+++ b/frontend/src/utils/blob.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataURLString } from "./json/base64";
+import type { DataURLString } from "./json/base64";
export function serializeBlob<T>(blob: Blob): Promise<DataURLString> {
return new Promise<DataURLString>((resolve, reject) => {
diff --git a/frontend/src/utils/cn.ts b/frontend/src/utils/cn.ts
index 818192d86c..52377f4508 100644
--- a/frontend/src/utils/cn.ts
+++ b/frontend/src/utils/cn.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ClassValue, clsx } from "clsx";
+import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
diff --git a/frontend/src/utils/dates.ts b/frontend/src/utils/dates.ts
index 0f537cffe5..20dc4f0438 100644
--- a/frontend/src/utils/dates.ts
+++ b/frontend/src/utils/dates.ts
@@ -44,21 +44,21 @@ export function timeAgo(value: string | number | null | undefined): string {
hour: "numeric",
minute: "numeric",
})}`;
- } else if (date.toDateString() === yesterday.toDateString()) {
+ }
+ if (date.toDateString() === yesterday.toDateString()) {
return `Yesterday at ${date.toLocaleTimeString(undefined, {
hour: "numeric",
minute: "numeric",
})}`;
- } else {
- return `${date.toLocaleDateString(undefined, {
- year: "numeric",
- month: "short",
- day: "numeric",
- })} at ${date.toLocaleTimeString(undefined, {
- hour: "numeric",
- minute: "numeric",
- })}`;
}
+ return `${date.toLocaleDateString(undefined, {
+ year: "numeric",
+ month: "short",
+ day: "numeric",
+ })} at ${date.toLocaleTimeString(undefined, {
+ hour: "numeric",
+ minute: "numeric",
+ })}`;
} catch (error) {
Logger.warn("Failed to parse date", error);
}
diff --git a/frontend/src/utils/json/__tests__/base64.test.ts b/frontend/src/utils/json/__tests__/base64.test.ts
index 8a20c7e826..5502627760 100644
--- a/frontend/src/utils/json/__tests__/base64.test.ts
+++ b/frontend/src/utils/json/__tests__/base64.test.ts
@@ -1,6 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { expect, describe, test } from "vitest";
-import { deserializeBase64, Base64String, JsonString } from "../base64";
+import {
+ deserializeBase64,
+ type Base64String,
+ type JsonString,
+} from "../base64";
describe("base64Utils", () => {
const testData = {
diff --git a/frontend/src/utils/json/json-parser.ts b/frontend/src/utils/json/json-parser.ts
index 0a63ed0456..c9e6b4083f 100644
--- a/frontend/src/utils/json/json-parser.ts
+++ b/frontend/src/utils/json/json-parser.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { JsonString } from "./base64";
+import type { JsonString } from "./base64";
/**
* Parse an attribute value as JSON.
diff --git a/frontend/src/utils/localStorage.ts b/frontend/src/utils/localStorage.ts
index 5d98aa554c..c660e80789 100644
--- a/frontend/src/utils/localStorage.ts
+++ b/frontend/src/utils/localStorage.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ZodType, ZodTypeDef } from "zod";
+import type { ZodType, ZodTypeDef } from "zod";
export class TypedLocalStorage<T> {
constructor(
diff --git a/frontend/src/utils/routes.ts b/frontend/src/utils/routes.ts
index fe62966017..7ac44e99ed 100644
--- a/frontend/src/utils/routes.ts
+++ b/frontend/src/utils/routes.ts
@@ -1,6 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { match, Match, MatchFunction, ParamData } from "path-to-regexp";
+import {
+ match,
+ type Match,
+ type MatchFunction,
+ type ParamData,
+} from "path-to-regexp";
export class TinyRouter {
private routes: Array<{
diff --git a/frontend/src/utils/scroll.ts b/frontend/src/utils/scroll.ts
index 0c7801ffde..0677ede283 100644
--- a/frontend/src/utils/scroll.ts
+++ b/frontend/src/utils/scroll.ts
@@ -19,7 +19,8 @@ export function smartScrollIntoView(
behavior: "smooth",
});
return;
- } else if (rect.bottom > window.innerHeight - bottomOffset) {
+ }
+ if (rect.bottom > window.innerHeight - bottomOffset) {
// Element is below the viewport, scroll to its bottom
body.scrollBy({
top: rect.bottom - window.innerHeight + bottomOffset,
diff --git a/frontend/src/utils/uuid.ts b/frontend/src/utils/uuid.ts
index a00436928f..1aeedd5b95 100644
--- a/frontend/src/utils/uuid.ts
+++ b/frontend/src/utils/uuid.ts
@@ -1,11 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
export function generateUUID() {
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(
- /[xy]/g,
- function (c) {
- const r = Math.trunc(Math.random() * 16);
- const v = c === "x" ? r : (r & 0x3) | 0x8;
- return v.toString(16);
- },
- );
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, (c) => {
+ const r = Math.trunc(Math.random() * 16);
+ const v = c === "x" ? r : (r & 0x3) | 0x8;
+ return v.toString(16);
+ });
}
diff --git a/frontend/src/utils/vitals.ts b/frontend/src/utils/vitals.ts
index 7f9c2028e1..86a67b5674 100644
--- a/frontend/src/utils/vitals.ts
+++ b/frontend/src/utils/vitals.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { onLCP, onFID, onCLS, Metric } from "web-vitals";
+import { onLCP, onFID, onCLS, type Metric } from "web-vitals";
import { Logger } from "./Logger";
export function reportVitals() {
diff --git a/lsp/index.ts b/lsp/index.ts
index bbb08e3352..209f80bfc0 100644
--- a/lsp/index.ts
+++ b/lsp/index.ts
@@ -7,16 +7,16 @@ import path from "path";
// Adapted from https://github.com/wylieconlon/jsonrpc-ws-proxy
-let argv = parseArgs(process.argv.slice(2));
+const argv = parseArgs(process.argv.slice(2));
if (argv.help) {
console.log(`Usage: index.js --port 3000`);
process.exit(1);
}
-let serverPort: number = parseInt(argv.port) || 3000;
+const serverPort: number = Number.parseInt(argv.port) || 3000;
-let languageServers: Record<string, string[]> = {
+const languageServers: Record<string, string[]> = {
copilot: [
"node",
path.join(__dirname, "copilot", "dist", "language-server.js"),