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: biome 2x (#5291)

Myles Scolnicke543a9b45dc8
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 69fb9e91d5..e4b481931b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -40,11 +40,11 @@ repos:
- id: ruff-format
- repo: https://github.com/biomejs/pre-commit
- rev: v1.9.4
+ rev: v2.0.0-beta.6
hooks:
- id: biome-check
- args: [--config-path, biome.json, --diagnostic-level, warn]
- additional_dependencies: ['@biomejs/[email protected]']
+ args: [--config-path, biome.jsonc, --diagnostic-level, warn]
+ additional_dependencies: ['@biomejs/[email protected]']
exclude: |
(?x)^(
docs/_static/.*|
diff --git a/biome.json b/biome.jsonc
similarity index 89%
rename from biome.json
rename to biome.jsonc
index 87087b61cb..23ca0b7731 100644
--- a/biome.json
+++ b/biome.jsonc
@@ -1,28 +1,26 @@
{
"$schema": "frontend/node_modules/@biomejs/biome/configuration_schema.json",
+ "files": {
+ "includes": ["frontend/src/**/*", "!*.json"]
+ },
"formatter": {
+ "indentStyle": "space",
"enabled": true,
"formatWithErrors": false,
- "indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
- "attributePosition": "auto",
- "ignore": ["pnpm-lock.yaml", "storybook-static", "package.json"]
- },
- "organizeImports": {
- "ignore": ["pnpm-lock.yaml", "storybook-static", "package.json"],
- "enabled": false
+ "attributePosition": "auto"
},
"linter": {
- "ignore": ["pnpm-lock.yaml", "storybook-static", "package.json"],
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noAutofocus": "off",
+ "noStaticElementInteractions": "off",
+ "useAriaPropsSupportedByRole": "off",
"noSvgWithoutTitle": "info",
- "noBlankTarget": "off",
"useButtonType": "info",
"useIframeTitle": "info",
"useKeyWithClickEvents": "off",
@@ -38,14 +36,18 @@
"correctness": {
"noInnerDeclarations": "error",
"noUnusedImports": "error",
+ "noUnusedFunctionParameters": "warn",
"useExhaustiveDependencies": "off",
"useHookAtTopLevel": "info"
},
+ "nursery": {
+ "useUniqueElementIds": "warn",
+ "noNestedComponentDefinitions": "off"
+ },
"security": {
"noDangerouslySetInnerHtml": "off"
},
"style": {
- "noCommaOperator": "error",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"noUnusedTemplateLiteral": "error",
@@ -89,7 +91,7 @@
"suspicious": {
"noArrayIndexKey": "off",
"noAssignInExpressions": "info",
- "noConsoleLog": "off",
+ "noConsole": "off",
"noDoubleEquals": "error",
"noEmptyBlockStatements": "info",
"noExplicitAny": "off",
diff --git a/frontend/package.json b/frontend/package.json
index 492daf7bed..218435965d 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -185,7 +185,7 @@
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.25.9",
"@babel/preset-typescript": "^7.25.9",
- "@biomejs/biome": "1.9.4",
+ "@biomejs/biome": "2.0.0-beta.6",
"@codecov/vite-plugin": "^1.9.1",
"@csstools/postcss-light-dark-function": "^2.0.8",
"@playwright/test": "^1.53.0",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 0a2e5530aa..459cdf42a8 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -452,8 +452,8 @@ importers:
specifier: ^7.25.9
version: 7.25.9(@babel/[email protected])
'@biomejs/biome':
- specifier: 1.9.4
- version: 1.9.4
+ specifier: 2.0.0-beta.6
+ version: 2.0.0-beta.6
'@codecov/vite-plugin':
specifier: ^1.9.1
@@ -882,55 +882,55 @@ packages:
resolution: {integrity: sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==}
engines: {node: '>=6.9.0'}
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-14vw9b5QJxrcP7WLkCeRiB/fft9wNZwx6yEiikBDxFbN7IAp39Xtvt/gJPq4ifhZ5IS25CnQEAkLLwfBIDMjsA==}
engines: {node: '>=14.21.3'}
hasBin: true
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-L7PBLJlGTz5anougOMJQvEbzgG9sT1wKIXvgjFhu0dIsDZ/px2caWFCnv7Q9L2K0+yF08EYRTTZVvoVO5D//sQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [darwin]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-ekhOOyhcVJ1ZRqHjq+eUOv8/3XMRKQ9Qf0URuO/PvHgopejv+PEoix0RIyxholYELKc049M4J3IJgsX4q2pZzw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [darwin]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-70WOWJI1/vZ97OUAt6r9HpiP5+vlL7yAdIoVQzVLjQy1TArfltN38KKqp9fnhgX173liUh0gry//MrWkKHYrIQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-pu+rCLI36ziPtwnJY53HRr154711uVeCt1i2KNXehvwNZZMK141wwg4yPkXkBdBvw7H7sez0HE/rCQR2fByJnQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [linux]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-G9ZIoaNs6q9+mOoMURoXvNRfCOs28jrS4R8+3/y0h9ttOXpd4VALPOAfjzBGPpMd/4RoEMHXw/1Ts4dKvrv9zw==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-emqZAuAyRw4Ug4B+CTgozIxVg1QLol28oZyIWuIjWEDr7eOo6Ek9zSZGeusmbwIEPu6r6qon8JAV6OdukxEwIg==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [linux]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-JijYVZC6R5qq94yLaElowLLzbZ4xR2qDiOVPQV8H1+ru3IqVOjQu5f/lIt4uuea1iRFbxS+mOaxOZM9tUl1pTQ==}
engines: {node: '>=14.21.3'}
cpu: [arm64]
os: [win32]
- '@biomejs/[email protected]':
- resolution: {integrity: sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA==}
+ '@biomejs/[email protected]':
+ resolution: {integrity: sha512-zs29t/nxon11dKV+ckQB1yUOmhYx17e2+cHGK8PCVamqVGSMbjrd5evjtlfbnVJXP0ar7nNKhcg4ZWYGJ6aR1w==}
engines: {node: '>=14.21.3'}
cpu: [x64]
os: [win32]
@@ -9559,39 +9559,39 @@ snapshots:
'@babel/helper-string-parser': 7.27.1
'@babel/helper-validator-identifier': 7.27.1
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optionalDependencies:
- '@biomejs/cli-darwin-arm64': 1.9.4
- '@biomejs/cli-darwin-x64': 1.9.4
- '@biomejs/cli-linux-arm64': 1.9.4
- '@biomejs/cli-linux-arm64-musl': 1.9.4
- '@biomejs/cli-linux-x64': 1.9.4
- '@biomejs/cli-linux-x64-musl': 1.9.4
- '@biomejs/cli-win32-arm64': 1.9.4
- '@biomejs/cli-win32-x64': 1.9.4
-
- '@biomejs/[email protected]':
+ '@biomejs/cli-darwin-arm64': 2.0.0-beta.6
+ '@biomejs/cli-darwin-x64': 2.0.0-beta.6
+ '@biomejs/cli-linux-arm64': 2.0.0-beta.6
+ '@biomejs/cli-linux-arm64-musl': 2.0.0-beta.6
+ '@biomejs/cli-linux-x64': 2.0.0-beta.6
+ '@biomejs/cli-linux-x64-musl': 2.0.0-beta.6
+ '@biomejs/cli-win32-arm64': 2.0.0-beta.6
+ '@biomejs/cli-win32-x64': 2.0.0-beta.6
+
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
- '@biomejs/[email protected]':
+ '@biomejs/[email protected]':
optional: true
'@braintree/[email protected]': {}
diff --git a/frontend/src/__tests__/CellStatus.test.tsx b/frontend/src/__tests__/CellStatus.test.tsx
index 274a483cca..8e47f0213c 100644
--- a/frontend/src/__tests__/CellStatus.test.tsx
+++ b/frontend/src/__tests__/CellStatus.test.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { render } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import type { Seconds } from "@/utils/time";
import {
CellStatusComponent,
ElapsedTime,
formatElapsedTime,
} from "../components/editor/cell/CellStatus";
-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
-import { render } from "@testing-library/react";
-import type { Seconds } from "@/utils/time";
-import { TooltipProvider } from "@/components/ui/tooltip";
// Mock date-fns to have consistent date formatting in tests
vi.mock("date-fns", () => ({
diff --git a/frontend/src/__tests__/lru.test.ts b/frontend/src/__tests__/lru.test.ts
index 51d32a2e35..c57341d4b4 100644
--- a/frontend/src/__tests__/lru.test.ts
+++ b/frontend/src/__tests__/lru.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import { LRUCache } from "../utils/lru";
describe("LRUCache", () => {
diff --git a/frontend/src/__tests__/main.test.tsx b/frontend/src/__tests__/main.test.tsx
index 752fb87610..dea1cd24bc 100644
--- a/frontend/src/__tests__/main.test.tsx
+++ b/frontend/src/__tests__/main.test.tsx
@@ -1,21 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
// @vitest-environment jsdom
-import { mount, visibleForTesting } from "../mount";
-import { store } from "../core/state/jotai";
-import { type AppMode, viewStateAtom } from "../core/mode";
-import { codeAtom, filenameAtom } from "../core/saving/file-state";
-import { showCodeInRunModeAtom, marimoVersionAtom } from "../core/meta/state";
-import {
- appConfigAtom,
- userConfigAtom,
- configOverridesAtom,
-} from "../core/config/config";
-import { describe, beforeEach, it, expect, vi } from "vitest";
+
+import { beforeEach, describe, expect, it, vi } from "vitest";
import {
type AppConfig,
parseAppConfig,
parseUserConfig,
} from "@/core/config/config-schema";
+import {
+ appConfigAtom,
+ configOverridesAtom,
+ userConfigAtom,
+} from "../core/config/config";
+import { marimoVersionAtom, showCodeInRunModeAtom } from "../core/meta/state";
+import { type AppMode, viewStateAtom } from "../core/mode";
+import { codeAtom, filenameAtom } from "../core/saving/file-state";
+import { store } from "../core/state/jotai";
+import { mount, visibleForTesting } from "../mount";
vi.mock("../utils/vitals", () => ({
reportVitals: vi.fn(),
diff --git a/frontend/src/__tests__/setup.ts b/frontend/src/__tests__/setup.ts
index a577d684de..8a1512f3d8 100644
--- a/frontend/src/__tests__/setup.ts
+++ b/frontend/src/__tests__/setup.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { afterEach } from "vitest";
+
import { cleanup } from "@testing-library/react";
+import { afterEach } from "vitest";
import "@testing-library/jest-dom/vitest";
import "blob-polyfill";
diff --git a/frontend/src/components/app-config/app-config-button.tsx b/frontend/src/components/app-config/app-config-button.tsx
index 377959ea03..0009a2a6f5 100644
--- a/frontend/src/components/app-config/app-config-button.tsx
+++ b/frontend/src/components/app-config/app-config-button.tsx
@@ -1,18 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtom } from "jotai";
+import { SettingsIcon } from "lucide-react";
+import { AppConfigForm } from "@/components/app-config/app-config-form";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { Button as EditorButton } from "../editor/inputs/Inputs";
-import { SettingsIcon } from "lucide-react";
-import { UserConfigForm } from "./user-config-form";
-import { Tooltip } from "../ui/tooltip";
-import { Dialog, DialogTrigger, DialogContent } from "../ui/dialog";
-import { AppConfigForm } from "@/components/app-config/app-config-form";
-import { useAtom } from "jotai";
import { Button } from "../ui/button";
+import { Dialog, DialogContent, DialogTrigger } from "../ui/dialog";
+import { Tooltip } from "../ui/tooltip";
import { settingDialogAtom } from "./state";
+import { UserConfigForm } from "./user-config-form";
interface Props {
showAppConfig?: boolean;
diff --git a/frontend/src/components/app-config/app-config-form.tsx b/frontend/src/components/app-config/app-config-form.tsx
index 898f43e8e8..e5939116c1 100644
--- a/frontend/src/components/app-config/app-config-form.tsx
+++ b/frontend/src/components/app-config/app-config-form.tsx
@@ -1,5 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { zodResolver } from "@hookform/resolvers/zod";
+import { useEffect } from "react";
import { useForm } from "react-hook-form";
import {
Form,
@@ -10,27 +11,26 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
+import { useAppConfig } from "@/core/config/config";
+import { getAppWidths } from "@/core/config/widths";
+import { saveAppConfig } from "@/core/network/requests";
+import { arrayToggle } from "@/utils/arrays";
import {
type AppConfig,
AppConfigSchema,
AppTitleSchema,
} from "../../core/config/config-schema";
-import { getAppWidths } from "@/core/config/widths";
+import { Checkbox } from "../ui/checkbox";
import { Input } from "../ui/input";
+import { Kbd } from "../ui/kbd";
+import { ExternalLink } from "../ui/links";
import { NativeSelect } from "../ui/native-select";
-import { useAppConfig } from "@/core/config/config";
-import { saveAppConfig } from "@/core/network/requests";
+import { toast } from "../ui/use-toast";
import {
- SettingTitle,
SettingDescription,
+ SettingTitle,
SQL_OUTPUT_SELECT_OPTIONS,
} from "./common";
-import { useEffect } from "react";
-import { Checkbox } from "../ui/checkbox";
-import { arrayToggle } from "@/utils/arrays";
-import { Kbd } from "../ui/kbd";
-import { ExternalLink } from "../ui/links";
-import { toast } from "../ui/use-toast";
export const AppConfigForm: React.FC = () => {
const [config, setConfig] = useAppConfig();
@@ -293,7 +293,10 @@ export const AppConfigForm: React.FC = () => {
const SettingSection = ({
title,
children,
-}: { title: string; children: React.ReactNode }) => {
+}: {
+ title: string;
+ children: React.ReactNode;
+}) => {
return (
<div className="flex flex-col gap-y-2">
<h3 className="text-base font-semibold mb-1">{title}</h3>
diff --git a/frontend/src/components/app-config/common.tsx b/frontend/src/components/app-config/common.tsx
index 642d65be91..2ff1063728 100644
--- a/frontend/src/components/app-config/common.tsx
+++ b/frontend/src/components/app-config/common.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
import type { HTMLProps, PropsWithChildren } from "react";
import type { SqlOutputType } from "@/core/config/config-schema";
+import { cn } from "@/utils/cn";
export const SettingTitle: React.FC<PropsWithChildren> = ({ children }) => {
return (
diff --git a/frontend/src/components/app-config/optional-features.tsx b/frontend/src/components/app-config/optional-features.tsx
index 4e0a426800..36589acd81 100644
--- a/frontend/src/components/app-config/optional-features.tsx
+++ b/frontend/src/components/app-config/optional-features.tsx
@@ -1,11 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { BoxIcon, CheckCircleIcon, XCircleIcon } from "lucide-react";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { useResolvedMarimoConfig } from "@/core/config/config";
-import { addPackage, getPackageList } from "@/core/network/requests";
-import { ErrorBanner } from "@/plugins/impl/common/error-banner";
+import React from "react";
import { Spinner } from "@/components/icons/spinner";
+import { Button } from "@/components/ui/button";
+import { Kbd } from "@/components/ui/kbd";
import {
Table,
TableBody,
@@ -15,11 +14,13 @@ import {
TableRow,
} from "@/components/ui/table";
import { toast } from "@/components/ui/use-toast";
-import { Kbd } from "@/components/ui/kbd";
-import { Button } from "@/components/ui/button";
+import { useResolvedMarimoConfig } from "@/core/config/config";
+import { addPackage, getPackageList } from "@/core/network/requests";
+import { isWasm } from "@/core/wasm/utils";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { ErrorBanner } from "@/plugins/impl/common/error-banner";
import { cn } from "@/utils/cn";
import { SettingSubtitle } from "./common";
-import { isWasm } from "@/core/wasm/utils";
interface Package {
name: string;
diff --git a/frontend/src/components/app-config/user-config-form.tsx b/frontend/src/components/app-config/user-config-form.tsx
index 3d8a5f3c2f..1376ea85c7 100644
--- a/frontend/src/components/app-config/user-config-form.tsx
+++ b/frontend/src/components/app-config/user-config-form.tsx
@@ -1,10 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SettingSubtitle, SQL_OUTPUT_SELECT_OPTIONS } from "./common";
-import React, { useRef } from "react";
-import { type FieldPath, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
+import { get } from "lodash-es";
+import {
+ BrainIcon,
+ CpuIcon,
+ EditIcon,
+ FlaskConicalIcon,
+ FolderCog2,
+ MonitorIcon,
+ PackageIcon,
+} from "lucide-react";
+import React, { useRef } from "react";
+import { type FieldPath, useForm } from "react-hook-form";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
import {
Form,
FormControl,
@@ -15,45 +26,34 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
-import { Checkbox } from "@/components/ui/checkbox";
-import { Button } from "@/components/ui/button";
+import { Kbd } from "@/components/ui/kbd";
import { NativeSelect } from "@/components/ui/native-select";
import { NumberField } from "@/components/ui/number-field";
-import { Kbd } from "@/components/ui/kbd";
+import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { CopilotConfig } from "@/core/codemirror/copilot/copilot-config";
import { KEYMAP_PRESETS } from "@/core/codemirror/keymaps/keymaps";
+import { capabilitiesAtom } from "@/core/config/capabilities";
import { configOverridesAtom, useUserConfig } from "@/core/config/config";
import {
- UserConfigSchema,
PackageManagerNames,
type UserConfig,
+ UserConfigSchema,
} from "@/core/config/config-schema";
import { getAppWidths } from "@/core/config/widths";
+import { marimoVersionAtom } from "@/core/meta/state";
import { saveUserConfig } from "@/core/network/requests";
import { isWasm } from "@/core/wasm/utils";
+import { Banner } from "@/plugins/impl/common/error-banner";
import { THEMES } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
import { keyboardShortcutsAtom } from "../editor/controls/keyboard-shortcuts";
-import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import {
- EditIcon,
- MonitorIcon,
- PackageIcon,
- CpuIcon,
- BrainIcon,
- FlaskConicalIcon,
- FolderCog2,
-} from "lucide-react";
+import { Badge } from "../ui/badge";
import { ExternalLink } from "../ui/links";
-import { cn } from "@/utils/cn";
-import { KNOWN_AI_MODELS, AWS_REGIONS } from "./constants";
import { Textarea } from "../ui/textarea";
-import { get } from "lodash-es";
import { Tooltip } from "../ui/tooltip";
-import { Badge } from "../ui/badge";
-import { capabilitiesAtom } from "@/core/config/capabilities";
-import { Banner } from "@/plugins/impl/common/error-banner";
+import { SettingSubtitle, SQL_OUTPUT_SELECT_OPTIONS } from "./common";
+import { AWS_REGIONS, KNOWN_AI_MODELS } from "./constants";
import { OptionalFeatures } from "./optional-features";
-import { marimoVersionAtom } from "@/core/meta/state";
const formItemClasses = "flex flex-row items-center space-x-1 space-y-0";
const categories = [
@@ -1529,7 +1529,10 @@ export const UserConfigForm: React.FC = () => {
const SettingGroup = ({
title,
children,
-}: { title: string; children: React.ReactNode }) => {
+}: {
+ title: string;
+ children: React.ReactNode;
+}) => {
return (
<div className="flex flex-col gap-4 pb-4">
<SettingSubtitle>{title}</SettingSubtitle>
diff --git a/frontend/src/components/audio/audio-recorder.tsx b/frontend/src/components/audio/audio-recorder.tsx
index d08b57e5ed..d7c18e05ef 100644
--- a/frontend/src/components/audio/audio-recorder.tsx
+++ b/frontend/src/components/audio/audio-recorder.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
-import React from "react";
-import { Button } from "../ui/button";
+
import { CircleIcon, SquareIcon } from "lucide-react";
+import React from "react";
import type { RecordingStatus } from "@/hooks/useAudioRecorder";
+import { cn } from "@/utils/cn";
+import { Button } from "../ui/button";
interface AudioRecorderProps {
onStart: () => void;
diff --git a/frontend/src/components/chat/chat-panel.tsx b/frontend/src/components/chat/chat-panel.tsx
index 96e432b925..f80c29d37a 100644
--- a/frontend/src/components/chat/chat-panel.tsx
+++ b/frontend/src/components/chat/chat-panel.tsx
@@ -1,12 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useChat } from "@ai-sdk/react";
+import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
+import type { Message } from "ai/react";
import { useAtom, useAtomValue } from "jotai";
-import { Button } from "@/components/ui/button";
-import { ScrollArea } from "@/components/ui/scroll-area";
-import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
import {
BotMessageSquareIcon,
ClockIcon,
@@ -14,41 +11,45 @@ import {
PlusIcon,
} from "lucide-react";
import {
- chatStateAtom,
- activeChatAtom,
- type Chat,
- type ChatState,
-} from "@/core/ai/state";
-import {
- useState,
- useRef,
- type SetStateAction,
type Dispatch,
memo,
+ type SetStateAction,
useEffect,
useMemo,
+ useRef,
+ useState,
} from "react";
-import { generateUUID } from "@/utils/uuid";
-import type { Message } from "ai/react";
-import { useChat } from "@ai-sdk/react";
-import { PromptInput } from "../editor/ai/add-cell-with-ai";
-import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
-import { Tooltip, TooltipProvider } from "../ui/tooltip";
-import { cn } from "@/utils/cn";
-import { MarkdownRenderer } from "./markdown-renderer";
-import { Logger } from "@/utils/Logger";
-import { getCodes } from "@/core/codemirror/copilot/getCodes";
-import { getAICompletionBody } from "../editor/ai/completion-utils";
+import { Button } from "@/components/ui/button";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { ScrollArea } from "@/components/ui/scroll-area";
import { addMessageToChat } from "@/core/ai/chat-utils";
+import {
+ activeChatAtom,
+ type Chat,
+ type ChatState,
+ chatStateAtom,
+} from "@/core/ai/state";
+import { getCodes } from "@/core/codemirror/copilot/getCodes";
+import { aiAtom, aiEnabledAtom } from "@/core/config/config";
+import { useRuntimeManager } from "@/core/runtime/config";
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
-import { aiAtom, aiEnabledAtom } from "@/core/config/config";
+import { cn } from "@/utils/cn";
+import { timeAgo } from "@/utils/dates";
+import { Logger } from "@/utils/Logger";
+import { generateUUID } from "@/utils/uuid";
import { useOpenSettingsToTab } from "../app-config/state";
+import { PromptInput } from "../editor/ai/add-cell-with-ai";
+import { getAICompletionBody } from "../editor/ai/completion-utils";
import { PanelEmptyState } from "../editor/chrome/panels/empty-state";
import { CopyClipboardIcon } from "../icons/copy-icon";
-import { timeAgo } from "@/utils/dates";
+import { Tooltip, TooltipProvider } from "../ui/tooltip";
+import { MarkdownRenderer } from "./markdown-renderer";
import { ReasoningAccordion } from "./reasoning-accordion";
-import { useRuntimeManager } from "@/core/runtime/config";
interface ChatHeaderProps {
onNewChat: () => void;
@@ -103,7 +104,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
/>
)}
{chats.map((chat) => (
- <div
+ <button
key={chat.id}
className={cn(
"p-3 rounded-md cursor-pointer hover:bg-accent",
@@ -117,7 +118,7 @@ const ChatHeader: React.FC<ChatHeaderProps> = ({
<div className="text-sm text-muted-foreground">
{timeAgo(chat.updatedAt)}
</div>
- </div>
+ </button>
))}
</div>
</ScrollArea>
@@ -184,12 +185,13 @@ const ChatMessage: React.FC<ChatMessageProps> = memo(
{message.parts?.map((part, i) => {
switch (part.type) {
case "text":
- return <MarkdownRenderer content={part.text} />;
+ return <MarkdownRenderer key={i} content={part.text} />;
case "reasoning":
return (
<ReasoningAccordion
reasoning={part.reasoning}
+ key={i}
index={i}
isStreaming={
index === totalMessages - 1 && isStreamingReasoning
diff --git a/frontend/src/components/chat/markdown-renderer.tsx b/frontend/src/components/chat/markdown-renderer.tsx
index 3b54b1b1a5..73b8342a23 100644
--- a/frontend/src/components/chat/markdown-renderer.tsx
+++ b/frontend/src/components/chat/markdown-renderer.tsx
@@ -1,20 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useTheme } from "@/theme/useTheme";
-import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
-import { useCellActions } from "@/core/cells/cells";
-import { Button, type ButtonProps } from "@/components/ui/button";
-import { BetweenHorizontalStartIcon } from "lucide-react";
+
import { EditorView } from "@codemirror/view";
+import { useAtomValue } from "jotai";
+import { BetweenHorizontalStartIcon } from "lucide-react";
+import { marked } from "marked";
+import { memo, useEffect, useMemo, useState } from "react";
import Markdown, { type Components } from "react-markdown";
-import { useEffect, useState, memo, useMemo } from "react";
+import { Button, type ButtonProps } from "@/components/ui/button";
+import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
+import { useCellActions } from "@/core/cells/cells";
import { useLastFocusedCellId } from "@/core/cells/focus";
-import { copyToClipboard } from "@/utils/copy";
+import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
-import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
-import { useAtomValue } from "jotai";
import { autoInstantiateAtom } from "@/core/config/config";
-import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { marked } from "marked";
+import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
+import { useTheme } from "@/theme/useTheme";
+import { copyToClipboard } from "@/utils/copy";
const extensions = [EditorView.lineWrapping];
diff --git a/frontend/src/components/chat/reasoning-accordion.tsx b/frontend/src/components/chat/reasoning-accordion.tsx
index 7f251d9591..c349665d6c 100644
--- a/frontend/src/components/chat/reasoning-accordion.tsx
+++ b/frontend/src/components/chat/reasoning-accordion.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { BotMessageSquareIcon } from "lucide-react";
+import React from "react";
import {
Accordion,
AccordionContent,
diff --git a/frontend/src/components/data-table/SearchBar.tsx b/frontend/src/components/data-table/SearchBar.tsx
index 92eb7543ad..26685d3554 100644
--- a/frontend/src/components/data-table/SearchBar.tsx
+++ b/frontend/src/components/data-table/SearchBar.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useState, useEffect } from "react";
-import { SearchIcon } from "lucide-react";
-import { Spinner } from "../icons/spinner";
-import { cn } from "@/utils/cn";
+
import { useDebounce } from "@uidotdev/usehooks";
+import { SearchIcon } from "lucide-react";
+import React, { useEffect, useState } from "react";
import useEvent from "react-use-event-hook";
+import { cn } from "@/utils/cn";
+import { Spinner } from "../icons/spinner";
interface SearchBarProps {
hidden: boolean;
diff --git a/frontend/src/components/data-table/TableActions.tsx b/frontend/src/components/data-table/TableActions.tsx
index 5d07b88456..e12c3b7354 100644
--- a/frontend/src/components/data-table/TableActions.tsx
+++ b/frontend/src/components/data-table/TableActions.tsx
@@ -1,23 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
-import React from "react";
-import { Tooltip } from "../ui/tooltip";
-import { Button } from "../ui/button";
+import type { RowSelectionState, Table } from "@tanstack/react-table";
import {
- SearchIcon,
ChartBarIcon,
- PanelRightIcon,
ChartColumnStacked,
+ PanelRightIcon,
+ SearchIcon,
} from "lucide-react";
-import { DataTablePagination } from "./pagination";
-import { DownloadAs, type DownloadActionProps } from "./download-actions";
-import type { Table, RowSelectionState } from "@tanstack/react-table";
-import type { DataTableSelection } from "./types";
+import React from "react";
import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
-import { toast } from "../ui/use-toast";
import { cn } from "@/utils/cn";
import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
+import { Button } from "../ui/button";
+import { Tooltip } from "../ui/tooltip";
+import { toast } from "../ui/use-toast";
+import { type DownloadActionProps, DownloadAs } from "./download-actions";
+import { DataTablePagination } from "./pagination";
+import type { DataTableSelection } from "./types";
interface TableActionsProps<TData> {
enableSearch: boolean;
diff --git a/frontend/src/components/data-table/__tests__/chart-spec-model.test.ts b/frontend/src/components/data-table/__tests__/chart-spec-model.test.ts
index b64885a213..a48215060b 100644
--- a/frontend/src/components/data-table/__tests__/chart-spec-model.test.ts
+++ b/frontend/src/components/data-table/__tests__/chart-spec-model.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import { ColumnChartSpecModel } from "../chart-spec-model";
import type { ColumnHeaderStats, ColumnName, FieldTypes } from "../types";
diff --git a/frontend/src/components/data-table/__tests__/column_formatting.test.ts b/frontend/src/components/data-table/__tests__/column_formatting.test.ts
index 946da43296..a3aafce81d 100644
--- a/frontend/src/components/data-table/__tests__/column_formatting.test.ts
+++ b/frontend/src/components/data-table/__tests__/column_formatting.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
-import { applyFormat } from "../column-formatting/feature";
import {
- prettyScientificNumber,
prettyEngineeringNumber,
+ prettyScientificNumber,
} from "@/utils/numbers";
+import { applyFormat } from "../column-formatting/feature";
describe("applyFormat", () => {
it("should return an empty string for null, undefined, or empty string values", () => {
diff --git a/frontend/src/components/data-table/__tests__/columns.test.tsx b/frontend/src/components/data-table/__tests__/columns.test.tsx
index cd776bfba3..cf2a72971d 100644
--- a/frontend/src/components/data-table/__tests__/columns.test.tsx
+++ b/frontend/src/components/data-table/__tests__/columns.test.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, test } from "vitest";
-import { uniformSample } from "../uniformSample";
-import { parseContent, UrlDetector } from "../url-detector";
+
import { render } from "@testing-library/react";
+import { describe, expect, it, test } from "vitest";
import { generateColumns, inferFieldTypes } from "../columns";
-import type { FieldTypesWithExternalType } from "../types";
import { getMimeValues, isMimeValue, MimeCell } from "../mime-cell";
+import type { FieldTypesWithExternalType } from "../types";
+import { uniformSample } from "../uniformSample";
+import { parseContent, UrlDetector } from "../url-detector";
test("uniformSample", () => {
const items = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J"];
diff --git a/frontend/src/components/data-table/__tests__/data-table.test.tsx b/frontend/src/components/data-table/__tests__/data-table.test.tsx
index 8e7e3afa56..b5986f3d14 100644
--- a/frontend/src/components/data-table/__tests__/data-table.test.tsx
+++ b/frontend/src/components/data-table/__tests__/data-table.test.tsx
@@ -1,11 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { ColumnDef, RowSelectionState } from "@tanstack/react-table";
import { render } from "@testing-library/react";
-import { DataTable } from "../data-table";
-import { describe, expect, it } from "vitest";
-import { vi } from "vitest";
-import type { ColumnDef } from "@tanstack/react-table";
-import type { RowSelectionState } from "@tanstack/react-table";
+import { describe, expect, it, vi } from "vitest";
import { TooltipProvider } from "@/components/ui/tooltip";
+import { DataTable } from "../data-table";
interface TestData {
id: number;
diff --git a/frontend/src/components/data-table/__tests__/pagination.test.tsx b/frontend/src/components/data-table/__tests__/pagination.test.tsx
index 71cd2b6483..db6f5d52d5 100644
--- a/frontend/src/components/data-table/__tests__/pagination.test.tsx
+++ b/frontend/src/components/data-table/__tests__/pagination.test.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, test } from "vitest";
+
import { render } from "@testing-library/react";
-import { PageSelector } from "../pagination";
+import { expect, test } from "vitest";
import { Functions } from "@/utils/functions";
+import { PageSelector } from "../pagination";
function getOptions(currentPage: number) {
const { container } = render(
diff --git a/frontend/src/components/data-table/__tests__/types.test.ts b/frontend/src/components/data-table/__tests__/types.test.ts
index 3c66fe3ae9..79aba20690 100644
--- a/frontend/src/components/data-table/__tests__/types.test.ts
+++ b/frontend/src/components/data-table/__tests__/types.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { extractTimezone } from "../types";
describe("extractTimezone", () => {
diff --git a/frontend/src/components/data-table/__tests__/url-detector.test.tsx b/frontend/src/components/data-table/__tests__/url-detector.test.tsx
index b1bd553a0f..b139810baf 100644
--- a/frontend/src/components/data-table/__tests__/url-detector.test.tsx
+++ b/frontend/src/components/data-table/__tests__/url-detector.test.tsx
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { render, screen, fireEvent } from "@testing-library/react";
-import { describe, it, expect, vi } from "vitest";
+import { fireEvent, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
import { parseContent, UrlDetector } from "../url-detector";
describe("parseContent", () => {
diff --git a/frontend/src/components/data-table/__tests__/useColumnPinning.test.ts b/frontend/src/components/data-table/__tests__/useColumnPinning.test.ts
index 9c25666ec2..9a80340a0a 100644
--- a/frontend/src/components/data-table/__tests__/useColumnPinning.test.ts
+++ b/frontend/src/components/data-table/__tests__/useColumnPinning.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SELECT_COLUMN_ID } from "../types";
-import { renderHook, act } from "@testing-library/react";
-import { describe, it, expect } from "vitest";
+
+import { act, renderHook } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
import { useColumnPinning } from "../hooks/use-column-pinning";
+import { SELECT_COLUMN_ID } from "../types";
describe("useColumnPinning", () => {
it("should initialize with correct default values", () => {
diff --git a/frontend/src/components/data-table/cell-selection/__tests__/feature.test.ts b/frontend/src/components/data-table/cell-selection/__tests__/feature.test.ts
index 184d3fce64..d45d50d9a4 100644
--- a/frontend/src/components/data-table/cell-selection/__tests__/feature.test.ts
+++ b/frontend/src/components/data-table/cell-selection/__tests__/feature.test.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { describe, it, expect, vi } from "vitest";
-import { CellSelectionFeature } from "../feature";
-import type { Table, Row, Cell, Column } from "@tanstack/react-table";
+
+import type { Cell, Column, Row, Table } from "@tanstack/react-table";
+import { describe, expect, it, vi } from "vitest";
import { INDEX_COLUMN_NAME } from "../../types";
+import { CellSelectionFeature } from "../feature";
import type { CellSelectionTableState } from "../types";
describe("CellSelectionFeature", () => {
diff --git a/frontend/src/components/data-table/cell-selection/feature.ts b/frontend/src/components/data-table/cell-selection/feature.ts
index e95d8b0ae9..c290460080 100644
--- a/frontend/src/components/data-table/cell-selection/feature.ts
+++ b/frontend/src/components/data-table/cell-selection/feature.ts
@@ -2,24 +2,23 @@
"use no memo";
import {
- type Table,
type Cell,
- type TableFeature,
+ type Column,
type InitialTableState,
- type RowData,
makeStateUpdater,
- type Column,
type Row,
+ type RowData,
+ type Table,
+ type TableFeature,
} from "@tanstack/react-table";
import { Functions } from "@/utils/functions";
-
+import { getStableRowId } from "../utils";
import type {
CellSelectionOptions,
CellSelectionState,
CellSelectionTableState,
} from "./types";
-import { getStableRowId } from "../utils";
function getRowId<TData>(row: Row<TData>): string {
return getStableRowId(row) ?? row.id;
diff --git a/frontend/src/components/data-table/cell-styling/feature.ts b/frontend/src/components/data-table/cell-styling/feature.ts
index c4f0aed729..e0e178d666 100644
--- a/frontend/src/components/data-table/cell-styling/feature.ts
+++ b/frontend/src/components/data-table/cell-styling/feature.ts
@@ -2,17 +2,16 @@
"use no memo";
import type {
- Table,
Cell,
Column,
+ InitialTableState,
Row,
RowData,
+ Table,
TableFeature,
- InitialTableState,
} from "@tanstack/react-table";
-
-import type { CellStyleState, CellStylingTableState } from "./types";
import { getStableRowId } from "../utils";
+import type { CellStyleState, CellStylingTableState } from "./types";
function getRowId<TData>(row: Row<TData>): string {
return getStableRowId(row) ?? row.id;
diff --git a/frontend/src/components/data-table/chart-spec-model.tsx b/frontend/src/components/data-table/chart-spec-model.tsx
index 77d0b25940..6b55bc3014 100644
--- a/frontend/src/components/data-table/chart-spec-model.tsx
+++ b/frontend/src/components/data-table/chart-spec-model.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
+
import { mint, orange, slate } from "@radix-ui/colors";
-import type { ColumnHeaderStats, FieldTypes, ColumnName } from "./types";
-import { parseCsvData } from "@/plugins/impl/vega/loader";
-import { logNever } from "@/utils/assertNever";
import type { TopLevelSpec } from "vega-lite";
import { asRemoteURL } from "@/core/runtime/config";
+import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
+import { parseCsvData } from "@/plugins/impl/vega/loader";
+import { logNever } from "@/utils/assertNever";
+import type { ColumnHeaderStats, ColumnName, FieldTypes } from "./types";
// We rely on vega's built-in binning to determine bar widths.
const MAX_BAR_HEIGHT = 20; // px
diff --git a/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts b/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts
index e967f5d1c9..d72ffd8d52 100644
--- a/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts
+++ b/frontend/src/components/data-table/charts/__tests__/altair-generator.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
+import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
import {
generateAltairChart,
generateAltairChartSnippet,
} from "../chart-spec/altair-generator";
-import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
function createSpec(spec: {
mark: string | Record<string, unknown>;
diff --git a/frontend/src/components/data-table/charts/__tests__/spec-snapshot.test.ts b/frontend/src/components/data-table/charts/__tests__/spec-snapshot.test.ts
index f70fa47ce8..b5e1d6488d 100644
--- a/frontend/src/components/data-table/charts/__tests__/spec-snapshot.test.ts
+++ b/frontend/src/components/data-table/charts/__tests__/spec-snapshot.test.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import type { TopLevelSpec } from "vega-lite/build/src/spec";
+import { describe, expect, it } from "vitest";
import {
- createSpecWithoutData,
augmentSpecWithData,
+ createSpecWithoutData,
X_AXIS_REQUIRED,
Y_AXIS_REQUIRED,
} from "../chart-spec/spec";
import type { ChartSchemaType } from "../schemas";
-import { NONE_AGGREGATION, ChartType } from "../types";
-import type { TopLevelSpec } from "vega-lite/build/src/spec";
+import { ChartType, NONE_AGGREGATION } from "../types";
describe("create vega spec", () => {
// Sample data for testing
diff --git a/frontend/src/components/data-table/charts/__tests__/spec.test.ts b/frontend/src/components/data-table/charts/__tests__/spec.test.ts
index 0caf35637a..2032836e5b 100644
--- a/frontend/src/components/data-table/charts/__tests__/spec.test.ts
+++ b/frontend/src/components/data-table/charts/__tests__/spec.test.ts
@@ -1,13 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { PositionDef } from "vega-lite/build/src/channeldef";
import { describe, expect, it } from "vitest";
import { getAxisEncoding } from "../chart-spec/spec";
-import { AGGREGATION_FNS, ChartType, STRING_AGGREGATION_FNS } from "../types";
-import { COUNT_FIELD } from "../constants";
-import { NONE_AGGREGATION } from "../types";
import { getTooltips } from "../chart-spec/tooltips";
+import { COUNT_FIELD } from "../constants";
import type { ChartSchemaType } from "../schemas";
-import type { PositionDef } from "vega-lite/build/src/channeldef";
+import {
+ AGGREGATION_FNS,
+ ChartType,
+ NONE_AGGREGATION,
+ STRING_AGGREGATION_FNS,
+} from "../types";
describe("getAxisEncoding", () => {
it("should return correct encoding for COUNT_FIELD", () => {
diff --git a/frontend/src/components/data-table/charts/__tests__/storage.test.ts b/frontend/src/components/data-table/charts/__tests__/storage.test.ts
index 7750920849..33e7d07c33 100644
--- a/frontend/src/components/data-table/charts/__tests__/storage.test.ts
+++ b/frontend/src/components/data-table/charts/__tests__/storage.test.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, beforeEach, vi } from "vitest";
import { getDefaultStore } from "jotai";
-import { tabsStorageAtom, KEY } from "../storage";
-import { ChartSchema } from "../schemas";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import type { CellId } from "@/core/cells/ids";
+import { ChartSchema } from "../schemas";
import type { TabName } from "../storage";
+import { KEY, tabsStorageAtom } from "../storage";
import { ChartType } from "../types";
// Mock localStorage
diff --git a/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts b/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts
index cf0ddb60e7..be2ca81665 100644
--- a/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts
+++ b/frontend/src/components/data-table/charts/chart-spec/altair-generator.ts
@@ -1,4 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
import {
FunctionCall,
Literal,
@@ -7,8 +9,6 @@ import {
VariableDeclaration,
} from "@/utils/python-poet/poet";
-import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
-
/**
* Generates Python code for an Altair chart.
*/
diff --git a/frontend/src/components/data-table/charts/chart-spec/encodings.ts b/frontend/src/components/data-table/charts/chart-spec/encodings.ts
index b6eb99d4e3..5770817abb 100644
--- a/frontend/src/components/data-table/charts/chart-spec/encodings.ts
+++ b/frontend/src/components/data-table/charts/chart-spec/encodings.ts
@@ -1,25 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { ColorScheme } from "vega";
+import type { Aggregate } from "vega-lite/build/src/aggregate";
+import type { BinParams } from "vega-lite/build/src/bin";
+import type { ColorDef, OffsetDef } from "vega-lite/build/src/channeldef";
+import type { Scale } from "vega-lite/build/src/scale";
import type { z } from "zod";
+import { COUNT_FIELD, DEFAULT_COLOR_SCHEME } from "../constants";
import type { BinSchema, ChartSchemaType } from "../schemas";
-
import {
type AggregationFn,
BIN_AGGREGATION,
ChartType,
NONE_AGGREGATION,
- STRING_AGGREGATION_FNS,
type SelectableDataType,
+ STRING_AGGREGATION_FNS,
} from "../types";
-
import { isFieldSet } from "./spec";
-import { COUNT_FIELD, DEFAULT_COLOR_SCHEME } from "../constants";
-import type { ColorDef, OffsetDef } from "vega-lite/build/src/channeldef";
import { convertDataTypeToVega } from "./types";
-import type { ColorScheme } from "vega";
-import type { Aggregate } from "vega-lite/build/src/aggregate";
-import type { BinParams } from "vega-lite/build/src/bin";
-import type { Scale } from "vega-lite/build/src/scale";
export function getBinEncoding(
chartType: ChartType,
diff --git a/frontend/src/components/data-table/charts/chart-spec/spec.ts b/frontend/src/components/data-table/charts/chart-spec/spec.ts
index 9df4864755..ba372149cb 100644
--- a/frontend/src/components/data-table/charts/chart-spec/spec.ts
+++ b/frontend/src/components/data-table/charts/chart-spec/spec.ts
@@ -1,35 +1,36 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { ExprRef, SignalRef } from "vega";
import type { TopLevelSpec } from "vega-lite";
-import type { ResolvedTheme } from "@/theme/useTheme";
-import type {
- AxisSchema,
- RowFacet,
- ColumnFacet,
- ChartSchemaType,
- BinSchema,
-} from "../schemas";
-import { ChartType } from "../types";
-import type { z } from "zod";
import type {
ColorDef,
Field,
PolarDef,
PositionDef,
} from "vega-lite/build/src/channeldef";
-import type { ExprRef, SignalRef } from "vega";
+import type { Resolve } from "vega-lite/build/src/resolve";
+import type { FacetFieldDef } from "vega-lite/build/src/spec/facet";
+import type { z } from "zod";
+import type { ResolvedTheme } from "@/theme/useTheme";
import type { TypedString } from "@/utils/typed";
import { COUNT_FIELD, EMPTY_VALUE } from "../constants";
-import type { FacetFieldDef } from "vega-lite/build/src/spec/facet";
+import type {
+ AxisSchema,
+ BinSchema,
+ ChartSchemaType,
+ ColumnFacet,
+ RowFacet,
+} from "../schemas";
+import { ChartType } from "../types";
import {
+ getAggregate,
getBinEncoding,
getColorEncoding,
getColorInScale,
getOffsetEncoding,
- getAggregate,
} from "./encodings";
-import { convertChartTypeToMark, convertDataTypeToVega } from "./types";
import { getTooltips } from "./tooltips";
-import type { Resolve } from "vega-lite/build/src/resolve";
+import { convertChartTypeToMark, convertDataTypeToVega } from "./types";
/**
* Convert marimo chart configuration to Vega-Lite specification.
diff --git a/frontend/src/components/data-table/charts/chart-spec/tooltips.ts b/frontend/src/components/data-table/charts/chart-spec/tooltips.ts
index 464fef0065..b6fde87bc4 100644
--- a/frontend/src/components/data-table/charts/chart-spec/tooltips.ts
+++ b/frontend/src/components/data-table/charts/chart-spec/tooltips.ts
@@ -5,8 +5,8 @@ import type {
PositionDef,
StringFieldDef,
} from "vega-lite/build/src/channeldef";
-import type { ChartSchemaType } from "../schemas";
import type { DataType } from "@/core/kernel/messages";
+import type { ChartSchemaType } from "../schemas";
import { isFieldSet } from "./spec";
function getTooltipFormat(dataType: DataType): string | undefined {
diff --git a/frontend/src/components/data-table/charts/chart-spec/types.ts b/frontend/src/components/data-table/charts/chart-spec/types.ts
index ebd0546a1c..631f93e10c 100644
--- a/frontend/src/components/data-table/charts/chart-spec/types.ts
+++ b/frontend/src/components/data-table/charts/chart-spec/types.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { DataType } from "@/core/kernel/messages";
-import { ChartType, type SelectableDataType } from "../types";
import type { StandardType } from "vega-lite/build/src/type";
-import { logNever } from "@/utils/assertNever";
+import type { DataType } from "@/core/kernel/messages";
import type { Mark } from "@/plugins/impl/vega/types";
+import { logNever } from "@/utils/assertNever";
+import { ChartType, type SelectableDataType } from "../types";
export function convertDataTypeToVega(
dataType: DataType | SelectableDataType,
diff --git a/frontend/src/components/data-table/charts/charts.tsx b/frontend/src/components/data-table/charts/charts.tsx
index c5174d87b9..007ad99a17 100644
--- a/frontend/src/components/data-table/charts/charts.tsx
+++ b/frontend/src/components/data-table/charts/charts.tsx
@@ -1,48 +1,48 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useState, useMemo } from "react";
-import { Button } from "@/components/ui/button";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { useAtom } from "jotai";
import {
- TableIcon,
- XIcon,
+ ChartColumnIcon,
+ CodeIcon,
DatabaseIcon,
PaintRollerIcon,
- CodeIcon,
- ChartColumnIcon,
+ TableIcon,
+ XIcon,
} from "lucide-react";
-import { Tabs, TabsTrigger, TabsList, TabsContent } from "@/components/ui/tabs";
-import { useForm, type UseFormReturn } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { ChartSchema, type ChartSchemaType } from "./schemas";
-import { Form } from "@/components/ui/form";
+import type { JSX } from "react";
+import React, { useMemo, useState } from "react";
+import { type UseFormReturn, useForm } from "react-hook-form";
+import { PythonIcon } from "@/components/editor/cell/code/icons";
import { getDefaults } from "@/components/forms/form-utils";
-import { useAtom } from "jotai";
+import { Button } from "@/components/ui/button";
+import { Form } from "@/components/ui/form";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import type { CellId } from "@/core/cells/ids";
-import { getChartTabName, type TabName, tabsStorageAtom } from "./storage";
-import type { FieldTypesWithExternalType } from "../types";
import { useAsyncData } from "@/hooks/useAsyncData";
-import { vegaLoadData } from "@/plugins/impl/vega/loader";
-import type { GetDataUrl } from "@/plugins/impl/DataTablePlugin";
-import type { Field } from "./components/form-fields";
import { useDebouncedCallback } from "@/hooks/useDebounce";
+import type { GetDataUrl } from "@/plugins/impl/DataTablePlugin";
+import { vegaLoadData } from "@/plugins/impl/vega/loader";
+import { useTheme } from "@/theme/useTheme";
import { inferFieldTypes } from "../columns";
-import { LazyChart } from "./lazy-chart";
+import type { FieldTypesWithExternalType } from "../types";
+import { generateAltairChartSnippet } from "./chart-spec/altair-generator";
+import { createSpecWithoutData } from "./chart-spec/spec";
import {
- ChartLoadingState,
ChartErrorState,
+ ChartLoadingState,
ChartTypeSelect,
} from "./components/chart-items";
-import { ChartType } from "./types";
-import { HeatmapForm } from "./forms/heatmap";
-import { PieForm } from "./forms/pie";
-import { CommonChartForm, StyleForm } from "./forms/common-chart";
+import type { Field } from "./components/form-fields";
import { CodeSnippet, TabContainer } from "./components/layouts";
import { ChartFormContext } from "./context";
-import { PythonIcon } from "@/components/editor/cell/code/icons";
-import { generateAltairChartSnippet } from "./chart-spec/altair-generator";
-import { createSpecWithoutData } from "./chart-spec/spec";
-import { useTheme } from "@/theme/useTheme";
-import type { JSX } from "react";
+import { CommonChartForm, StyleForm } from "./forms/common-chart";
+import { HeatmapForm } from "./forms/heatmap";
+import { PieForm } from "./forms/pie";
+import { LazyChart } from "./lazy-chart";
+import { ChartSchema, type ChartSchemaType } from "./schemas";
+import { getChartTabName, type TabName, tabsStorageAtom } from "./storage";
+import { ChartType } from "./types";
const NEW_CHART_TYPE = "bar" as ChartType;
const DEFAULT_TAB_NAME = "table" as TabName;
diff --git a/frontend/src/components/data-table/charts/components/chart-items.tsx b/frontend/src/components/data-table/charts/components/chart-items.tsx
index 9f334abde6..aae1e65569 100644
--- a/frontend/src/components/data-table/charts/components/chart-items.tsx
+++ b/frontend/src/components/data-table/charts/components/chart-items.tsx
@@ -1,46 +1,44 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ChevronDown, Loader2 } from "lucide-react";
-import { capitalize } from "lodash-es";
import * as SelectPrimitive from "@radix-ui/react-select";
+import { capitalize } from "lodash-es";
+import { ChevronDown, Loader2 } from "lucide-react";
+import React from "react";
+import { useFormContext, useWatch } from "react-hook-form";
+import type { z } from "zod";
+import { buttonVariants } from "@/components/ui/button";
import {
Select,
SelectContent,
SelectItem,
SelectValue,
} from "@/components/ui/select";
-import { CHART_TYPE_ICON, COUNT_FIELD, type EMPTY_VALUE } from "../constants";
+import type { DataType } from "@/core/kernel/messages";
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import { buttonVariants } from "@/components/ui/button";
-import { useFormContext, useWatch } from "react-hook-form";
-import type { z } from "zod";
-import type { ChartSchema } from "../schemas";
import { isFieldSet } from "../chart-spec/spec";
+import { convertDataTypeToSelectable } from "../chart-spec/types";
+import { CHART_TYPE_ICON, COUNT_FIELD, type EMPTY_VALUE } from "../constants";
+import { useChartFormContext } from "../context";
+import type { ChartSchema } from "../schemas";
+import { CHART_TYPES, type ChartType, type SelectableDataType } from "../types";
import {
- ColumnSelector,
AggregationSelect,
- DataTypeSelect,
- TimeUnitSelect,
- BooleanField,
- SortField,
- NumberField,
BinFields,
+ BooleanField,
+ ColumnSelector,
+ DataTypeSelect,
type FieldName,
+ NumberField,
+ SortField,
+ TimeUnitSelect,
} from "./form-fields";
-import { CHART_TYPES, type ChartType, type SelectableDataType } from "../types";
-import React from "react";
import { FieldSection, Title } from "./layouts";
-import { useChartFormContext } from "../context";
-import { convertDataTypeToSelectable } from "../chart-spec/types";
-import type { DataType } from "@/core/kernel/messages";
type SelectedDataType = SelectableDataType | typeof EMPTY_VALUE;
type FieldDataType = DataType | typeof EMPTY_VALUE;
// Utility functions for field type checking
-function isNonCountField(field?: {
- field?: string;
-}) {
+function isNonCountField(field?: { field?: string }) {
return isFieldSet(field?.field) && field?.field !== COUNT_FIELD;
}
diff --git a/frontend/src/components/data-table/charts/components/form-fields.tsx b/frontend/src/components/data-table/charts/components/form-fields.tsx
index 07b44b8aef..c57385809a 100644
--- a/frontend/src/components/data-table/charts/components/form-fields.tsx
+++ b/frontend/src/components/data-table/charts/components/form-fields.tsx
@@ -1,24 +1,27 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
import { capitalize } from "lodash-es";
import {
- XIcon,
+ ArrowDownWideNarrowIcon,
+ ArrowUpWideNarrowIcon,
PlusIcon,
SquareFunctionIcon,
- ArrowUpWideNarrowIcon,
- ArrowDownWideNarrowIcon,
+ XIcon,
} from "lucide-react";
+import React from "react";
import { type Path, useFormContext, useWatch } from "react-hook-form";
-
-import type { DataType } from "@/core/kernel/messages";
-
+import type { z } from "zod";
+import { DATA_TYPE_ICON } from "@/components/datasets/icons";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
import {
+ FormControl,
FormField,
FormItem,
FormLabel,
- FormControl,
} from "@/components/ui/form";
+import { DebouncedInput, DebouncedNumberInput } from "@/components/ui/input";
+import type { NumberFieldProps } from "@/components/ui/number-field";
import {
Select,
SelectContent,
@@ -29,15 +32,24 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { DATA_TYPE_ICON } from "@/components/datasets/icons";
-import { DebouncedInput, DebouncedNumberInput } from "@/components/ui/input";
-import { Checkbox } from "@/components/ui/checkbox";
-import { Button } from "@/components/ui/button";
-import { cn } from "@/utils/cn";
+import { Slider } from "@/components/ui/slider";
+import type { DataType } from "@/core/kernel/messages";
import { Multiselect } from "@/plugins/impl/MultiselectPlugin";
-
+import { cn } from "@/utils/cn";
+import { convertDataTypeToSelectable } from "../chart-spec/types";
+import {
+ AGGREGATION_TYPE_DESCRIPTIONS,
+ AGGREGATION_TYPE_ICON,
+ COUNT_FIELD,
+ EMPTY_VALUE,
+ SCALE_TYPE_DESCRIPTIONS,
+ TIME_UNIT_DESCRIPTIONS,
+} from "../constants";
+import { useChartFormContext } from "../context";
+import type { BinSchema, ChartSchema, ChartSchemaType } from "../schemas";
import {
AGGREGATION_FNS,
+ BIN_AGGREGATION,
COMBINED_TIME_UNITS,
NONE_AGGREGATION,
SELECTABLE_DATA_TYPES,
@@ -45,24 +57,9 @@ import {
SINGLE_TIME_UNITS,
SORT_TYPES,
STRING_AGGREGATION_FNS,
- BIN_AGGREGATION,
type TimeUnit,
} from "../types";
-import {
- AGGREGATION_TYPE_DESCRIPTIONS,
- AGGREGATION_TYPE_ICON,
- COUNT_FIELD,
- EMPTY_VALUE,
- SCALE_TYPE_DESCRIPTIONS,
- TIME_UNIT_DESCRIPTIONS,
-} from "../constants";
-import { Slider } from "@/components/ui/slider";
import { IconWithText } from "./layouts";
-import { useChartFormContext } from "../context";
-import type { NumberFieldProps } from "@/components/ui/number-field";
-import { convertDataTypeToSelectable } from "../chart-spec/types";
-import type { BinSchema, ChartSchema, ChartSchemaType } from "../schemas";
-import type { z } from "zod";
const CLEAR_VALUE = "__clear__";
diff --git a/frontend/src/components/data-table/charts/components/layouts.tsx b/frontend/src/components/data-table/charts/components/layouts.tsx
index 31214d4796..d3b04c18f9 100644
--- a/frontend/src/components/data-table/charts/components/layouts.tsx
+++ b/frontend/src/components/data-table/charts/components/layouts.tsx
@@ -1,10 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { LucideProps } from "lucide-react";
import { ReadonlyCode } from "@/components/editor/code/readonly-python-code";
-import { AccordionItem, AccordionTrigger } from "@/components/ui/accordion";
-import { AccordionContent } from "@/components/ui/accordion";
+import {
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion";
import { cn } from "@/utils/cn";
-import type { LucideProps } from "lucide-react";
export const Title: React.FC<{ text: string }> = ({ text }) => {
return <h2 className="font-semibold my-0">{text}</h2>;
diff --git a/frontend/src/components/data-table/charts/constants.ts b/frontend/src/components/data-table/charts/constants.ts
index 953378305a..b830c0a977 100644
--- a/frontend/src/components/data-table/charts/constants.ts
+++ b/frontend/src/components/data-table/charts/constants.ts
@@ -1,22 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- LineChartIcon,
- BarChartIcon,
- PieChartIcon,
- SigmaIcon,
- HashIcon,
- BaselineIcon,
AlignCenterVerticalIcon,
+ AreaChartIcon,
ArrowDownToLineIcon,
ArrowUpToLineIcon,
+ BarChartIcon,
+ BaselineIcon,
+ ChartColumn,
+ ChartNoAxesColumn,
ChartScatterIcon,
+ HashIcon,
+ LineChartIcon,
+ PieChartIcon,
+ RulerDimensionLine,
+ SigmaIcon,
SquareFunctionIcon,
TableIcon,
- AreaChartIcon,
- ChartNoAxesColumn,
- ChartColumn,
- RulerDimensionLine,
} from "lucide-react";
import type { ColorScheme } from "vega";
import type {
diff --git a/frontend/src/components/data-table/charts/context.ts b/frontend/src/components/data-table/charts/context.ts
index ea4066f8dd..9590477b4d 100644
--- a/frontend/src/components/data-table/charts/context.ts
+++ b/frontend/src/components/data-table/charts/context.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { createContext, use } from "react";
-import type { Field } from "./components/form-fields";
import { Functions } from "@/utils/functions";
+import type { Field } from "./components/form-fields";
export const ChartFormContext = createContext<{
fields: Field[];
diff --git a/frontend/src/components/data-table/charts/forms/common-chart.tsx b/frontend/src/components/data-table/charts/forms/common-chart.tsx
index 08a5819b87..3b91812b77 100644
--- a/frontend/src/components/data-table/charts/forms/common-chart.tsx
+++ b/frontend/src/components/data-table/charts/forms/common-chart.tsx
@@ -1,27 +1,27 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { XAxis, YAxis, ColorByAxis, Facet } from "../components/chart-items";
+import { capitalize } from "lodash-es";
+import { InfoIcon } from "lucide-react";
import { useFormContext, useWatch } from "react-hook-form";
+import { Accordion } from "@/components/ui/accordion";
import { isFieldSet } from "../chart-spec/spec";
+import { ColorByAxis, Facet, XAxis, YAxis } from "../components/chart-items";
import {
BooleanField,
+ ColorArrayField,
InputField,
- SliderField,
SelectField,
- ColorArrayField,
+ SliderField,
TooltipSelect,
} from "../components/form-fields";
-import { Accordion } from "@/components/ui/accordion";
-import { COLOR_SCHEMES, DEFAULT_COLOR_SCHEME } from "../constants";
-import { capitalize } from "lodash-es";
-import { InfoIcon } from "lucide-react";
import {
+ AccordionFormContent,
AccordionFormItem,
AccordionFormTrigger,
- AccordionFormContent,
- Title,
FormSectionHorizontalRule,
+ Title,
} from "../components/layouts";
+import { COLOR_SCHEMES, DEFAULT_COLOR_SCHEME } from "../constants";
import { useChartFormContext } from "../context";
import type { ChartSchemaType } from "../schemas";
diff --git a/frontend/src/components/data-table/charts/forms/heatmap.tsx b/frontend/src/components/data-table/charts/forms/heatmap.tsx
index 3cc06312a7..df8b4480df 100644
--- a/frontend/src/components/data-table/charts/forms/heatmap.tsx
+++ b/frontend/src/components/data-table/charts/forms/heatmap.tsx
@@ -2,11 +2,11 @@
import { useFormContext, useWatch } from "react-hook-form";
import { isFieldSet } from "../chart-spec/spec";
-import { NumberField } from "../components/form-fields";
import { ColorByAxis, XAxis, YAxis } from "../components/chart-items";
-import { OtherOptions } from "./common-chart";
+import { NumberField } from "../components/form-fields";
import { FormSectionHorizontalRule } from "../components/layouts";
import type { ChartSchemaType } from "../schemas";
+import { OtherOptions } from "./common-chart";
export const HeatmapForm: React.FC = () => {
const form = useFormContext<ChartSchemaType>();
diff --git a/frontend/src/components/data-table/charts/forms/pie.tsx b/frontend/src/components/data-table/charts/forms/pie.tsx
index a8dd6908eb..6e797d93bd 100644
--- a/frontend/src/components/data-table/charts/forms/pie.tsx
+++ b/frontend/src/components/data-table/charts/forms/pie.tsx
@@ -1,19 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ColumnSelector } from "../components/form-fields";
-import { FormSectionHorizontalRule, Title } from "../components/layouts";
import { useFormContext, useWatch } from "react-hook-form";
import { isFieldSet } from "../chart-spec/spec";
+import { convertDataTypeToSelectable } from "../chart-spec/types";
import {
- DataTypeSelect,
AggregationSelect,
+ ColumnSelector,
+ DataTypeSelect,
NumberField,
} from "../components/form-fields";
-import { useChartFormContext } from "../context";
-import { OtherOptions } from "./common-chart";
-import { convertDataTypeToSelectable } from "../chart-spec/types";
+import { FormSectionHorizontalRule, Title } from "../components/layouts";
import { EMPTY_VALUE } from "../constants";
+import { useChartFormContext } from "../context";
import type { ChartSchemaType } from "../schemas";
+import { OtherOptions } from "./common-chart";
export const PieForm: React.FC = () => {
const form = useFormContext<ChartSchemaType>();
diff --git a/frontend/src/components/data-table/charts/lazy-chart.tsx b/frontend/src/components/data-table/charts/lazy-chart.tsx
index 37f35b799b..ce07b7a0ba 100644
--- a/frontend/src/components/data-table/charts/lazy-chart.tsx
+++ b/frontend/src/components/data-table/charts/lazy-chart.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { ChartPieIcon } from "lucide-react";
import React from "react";
-import { useTheme } from "@/theme/useTheme";
import type { TopLevelSpec } from "vega-lite";
+import { useTheme } from "@/theme/useTheme";
import type { ErrorMessage } from "./chart-spec/spec";
-import { ChartPieIcon } from "lucide-react";
import { augmentSpecWithData } from "./chart-spec/spec";
const LazyVega = React.lazy(() =>
diff --git a/frontend/src/components/data-table/charts/schemas.ts b/frontend/src/components/data-table/charts/schemas.ts
index 943d7560cd..12a2a25a69 100644
--- a/frontend/src/components/data-table/charts/schemas.ts
+++ b/frontend/src/components/data-table/charts/schemas.ts
@@ -4,8 +4,9 @@
* Zod schema validation for marimo chart configuration.
*/
-import { DATA_TYPES } from "@/core/kernel/messages";
import { z } from "zod";
+import { DATA_TYPES } from "@/core/kernel/messages";
+import { DEFAULT_COLOR_SCHEME, EMPTY_VALUE } from "./constants";
import {
AGGREGATION_FNS,
NONE_AGGREGATION,
@@ -13,7 +14,6 @@ import {
SORT_TYPES,
TIME_UNITS,
} from "./types";
-import { DEFAULT_COLOR_SCHEME, EMPTY_VALUE } from "./constants";
export const BinSchema = z.object({
binned: z.boolean().optional(),
diff --git a/frontend/src/components/data-table/charts/storage.ts b/frontend/src/components/data-table/charts/storage.ts
index c107611937..5fb895c913 100644
--- a/frontend/src/components/data-table/charts/storage.ts
+++ b/frontend/src/components/data-table/charts/storage.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellId } from "@/core/cells/ids";
-import type { TypedString } from "@/utils/typed";
import { atomWithStorage } from "jotai/utils";
+import { capitalize } from "lodash-es";
import { z } from "zod";
-import { ChartSchema, type ChartSchemaType } from "./schemas";
+import type { CellId } from "@/core/cells/ids";
import { Logger } from "@/utils/Logger";
-import type { ChartType } from "./types";
import { NotebookScopedLocalStorage } from "@/utils/localStorage";
-import { capitalize } from "lodash-es";
+import type { TypedString } from "@/utils/typed";
+import { ChartSchema, type ChartSchemaType } from "./schemas";
+import type { ChartType } from "./types";
export type TabName = TypedString<"TabName">;
export const KEY = "marimo:charts:v2";
diff --git a/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx b/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
index b954d9ee1c..0096888d48 100644
--- a/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
+++ b/frontend/src/components/data-table/column-explorer-panel/column-explorer.tsx
@@ -1,26 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- Command,
- CommandEmpty,
- CommandInput,
- CommandItem,
- CommandList,
-} from "@/components/ui/command";
-import type { PreviewColumn } from "@/plugins/impl/DataTablePlugin";
-import {
- INDEX_COLUMN_NAME,
- SELECT_COLUMN_ID,
- type FieldTypesWithExternalType,
-} from "../types";
-import { NAMELESS_COLUMN_PREFIX } from "../columns";
-import { prettifyRowColumnCount } from "../pagination";
-import type { DataType } from "@/core/kernel/messages";
import { useState } from "react";
-import { Button } from "@/components/ui/button";
-import { Tooltip } from "@/components/ui/tooltip";
-import { CopyClipboardIcon } from "@/components/icons/copy-icon";
-import { useAsyncData } from "@/hooks/useAsyncData";
import {
AddDataframeChart,
renderChart,
@@ -28,14 +8,34 @@ import {
renderStats,
} from "@/components/datasources/column-preview";
import {
+ ColumnName,
ColumnPreviewContainer,
EmptyState,
ErrorState,
LoadingState,
} from "@/components/datasources/components";
-import { useTheme } from "@/theme/useTheme";
import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
-import { ColumnName } from "@/components/datasources/components";
+import { CopyClipboardIcon } from "@/components/icons/copy-icon";
+import { Button } from "@/components/ui/button";
+import {
+ Command,
+ CommandEmpty,
+ CommandInput,
+ CommandItem,
+ CommandList,
+} from "@/components/ui/command";
+import { Tooltip } from "@/components/ui/tooltip";
+import type { DataType } from "@/core/kernel/messages";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import type { PreviewColumn } from "@/plugins/impl/DataTablePlugin";
+import { useTheme } from "@/theme/useTheme";
+import { NAMELESS_COLUMN_PREFIX } from "../columns";
+import { prettifyRowColumnCount } from "../pagination";
+import {
+ type FieldTypesWithExternalType,
+ INDEX_COLUMN_NAME,
+ SELECT_COLUMN_ID,
+} from "../types";
interface ColumnExplorerPanelProps {
previewColumn: PreviewColumn;
diff --git a/frontend/src/components/data-table/column-formatting/feature.ts b/frontend/src/components/data-table/column-formatting/feature.ts
index 81ee71207b..81b1bcf8e9 100644
--- a/frontend/src/components/data-table/column-formatting/feature.ts
+++ b/frontend/src/components/data-table/column-formatting/feature.ts
@@ -2,26 +2,26 @@
"use no memo";
import {
- type TableFeature,
- type RowData,
+ type Column,
makeStateUpdater,
+ type RowData,
type Table,
- type Column,
+ type TableFeature,
type Updater,
} from "@tanstack/react-table";
-import type {
- ColumnFormattingTableState,
- ColumnFormattingOptions,
- ColumnFormattingState,
-} from "./types";
import type { DataType } from "@/core/kernel/messages";
-import type { FormatOption } from "./types";
+import { logNever } from "@/utils/assertNever";
import {
+ prettyEngineeringNumber,
prettyNumber,
prettyScientificNumber,
- prettyEngineeringNumber,
} from "@/utils/numbers";
-import { logNever } from "@/utils/assertNever";
+import type {
+ ColumnFormattingOptions,
+ ColumnFormattingState,
+ ColumnFormattingTableState,
+ FormatOption,
+} from "./types";
export const ColumnFormattingFeature: TableFeature = {
// define the column formatting's initial state
diff --git a/frontend/src/components/data-table/column-formatting/types.ts b/frontend/src/components/data-table/column-formatting/types.ts
index b65b305b51..dd6a49c993 100644
--- a/frontend/src/components/data-table/column-formatting/types.ts
+++ b/frontend/src/components/data-table/column-formatting/types.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-empty-interface */
-import type { DataType } from "@/core/kernel/messages";
+
import type { OnChangeFn, RowData } from "@tanstack/react-table";
+import type { DataType } from "@/core/kernel/messages";
// define all format options
export const formatOptions = {
diff --git a/frontend/src/components/data-table/column-header.tsx b/frontend/src/components/data-table/column-header.tsx
index b8119dd7ac..1c543d306e 100644
--- a/frontend/src/components/data-table/column-header.tsx
+++ b/frontend/src/components/data-table/column-header.tsx
@@ -3,8 +3,7 @@
import type { Column } from "@tanstack/react-table";
import { FilterIcon, MinusIcon, SearchIcon, XIcon } from "lucide-react";
-
-import { cn } from "@/utils/cn";
+import { useMemo, useRef, useState } from "react";
import {
DropdownMenu,
DropdownMenuContent,
@@ -16,30 +15,14 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Button } from "../ui/button";
-import { useMemo, useRef, useState } from "react";
-import { NumberField } from "../ui/number-field";
-import { Input } from "../ui/input";
-import { type ColumnFilterForType, Filter } from "./filters";
-import { logNever } from "@/utils/assertNever";
-import {
- renderColumnPinning,
- renderColumnWrapping,
- renderCopyColumn,
- renderDataType,
- renderFormatOptions,
- renderSortFilterIcon,
- renderSorts,
- FilterButtons,
- ClearFilterMenuItem,
- renderFilterByValues,
-} from "./header-items";
-import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
import { useAsyncData } from "@/hooks/useAsyncData";
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import { Spinner } from "../icons/spinner";
-import { PopoverClose } from "../ui/popover";
+import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
+import { logNever } from "@/utils/assertNever";
+import { cn } from "@/utils/cn";
import { Logger } from "@/utils/Logger";
+import { Spinner } from "../icons/spinner";
+import { Button } from "../ui/button";
import { Checkbox } from "../ui/checkbox";
import {
Command,
@@ -49,6 +32,22 @@ import {
CommandList,
} from "../ui/command";
import { DraggablePopover } from "../ui/draggable-popover";
+import { Input } from "../ui/input";
+import { NumberField } from "../ui/number-field";
+import { PopoverClose } from "../ui/popover";
+import { type ColumnFilterForType, Filter } from "./filters";
+import {
+ ClearFilterMenuItem,
+ FilterButtons,
+ renderColumnPinning,
+ renderColumnWrapping,
+ renderCopyColumn,
+ renderDataType,
+ renderFilterByValues,
+ renderFormatOptions,
+ renderSortFilterIcon,
+ renderSorts,
+} from "./header-items";
import { renderUnknownValue } from "./renderers";
const TOP_K_ROWS = 30;
diff --git a/frontend/src/components/data-table/column-summary.tsx b/frontend/src/components/data-table/column-summary.tsx
index b0926dc0db..ffac6fc007 100644
--- a/frontend/src/components/data-table/column-summary.tsx
+++ b/frontend/src/components/data-table/column-summary.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React from "react";
-import { ColumnChartSpecModel } from "./chart-spec-model";
+import { createBatchedLoader } from "@/plugins/impl/vega/batched";
import { useTheme } from "@/theme/useTheme";
-import { prettyNumber, prettyScientificNumber } from "@/utils/numbers";
+import { logNever } from "@/utils/assertNever";
import { prettyDate } from "@/utils/dates";
-import { DelayMount } from "../utils/delay-mount";
+import { prettyNumber, prettyScientificNumber } from "@/utils/numbers";
import { ChartSkeleton } from "../charts/chart-skeleton";
-import { logNever } from "@/utils/assertNever";
+import { DelayMount } from "../utils/delay-mount";
+import { ColumnChartSpecModel } from "./chart-spec-model";
import { DatePopover } from "./date-popover";
-import { createBatchedLoader } from "@/plugins/impl/vega/batched";
export const ColumnChartContext = React.createContext<
ColumnChartSpecModel<unknown>
diff --git a/frontend/src/components/data-table/column-wrapping/feature.ts b/frontend/src/components/data-table/column-wrapping/feature.ts
index b476a28d6b..6d42f71d12 100644
--- a/frontend/src/components/data-table/column-wrapping/feature.ts
+++ b/frontend/src/components/data-table/column-wrapping/feature.ts
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- type TableFeature,
- type RowData,
+ type Column,
makeStateUpdater,
+ type RowData,
type Table,
- type Column,
+ type TableFeature,
type Updater,
} from "@tanstack/react-table";
import type {
- ColumnWrappingTableState,
ColumnWrappingOptions,
ColumnWrappingState,
+ ColumnWrappingTableState,
} from "./types";
export const ColumnWrappingFeature: TableFeature = {
diff --git a/frontend/src/components/data-table/columns.tsx b/frontend/src/components/data-table/columns.tsx
index 577d702cc5..40a318f8c3 100644
--- a/frontend/src/components/data-table/columns.tsx
+++ b/frontend/src/components/data-table/columns.tsx
@@ -1,33 +1,33 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
+import { PopoverClose } from "@radix-ui/react-popover";
import type { Column, ColumnDef } from "@tanstack/react-table";
-import { DataTableColumnHeader } from "./column-header";
-import { Checkbox } from "../ui/checkbox";
-import { getMimeValues, MimeCell } from "./mime-cell";
import type { DataType } from "@/core/kernel/messages";
+import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
+import { cn } from "@/utils/cn";
+import { exactDateTime } from "@/utils/dates";
+import { Maps } from "@/utils/maps";
+import { Objects } from "@/utils/objects";
+import { EmotionCacheProvider } from "../editor/output/EmotionCacheProvider";
+import { JsonOutput } from "../editor/output/JsonOutput";
+import { Button } from "../ui/button";
+import { Checkbox } from "../ui/checkbox";
+import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
+import type { ColumnChartSpecModel } from "./chart-spec-model";
+import { DataTableColumnHeader } from "./column-header";
import { TableColumnSummary } from "./column-summary";
+import { DatePopover } from "./date-popover";
import type { FilterType } from "./filters";
+import { getMimeValues, MimeCell } from "./mime-cell";
import {
type DataTableSelection,
- INDEX_COLUMN_NAME,
- type FieldTypesWithExternalType,
extractTimezone,
+ type FieldTypesWithExternalType,
+ INDEX_COLUMN_NAME,
} from "./types";
-import { parseContent, UrlDetector } from "./url-detector";
-import { cn } from "@/utils/cn";
import { uniformSample } from "./uniformSample";
-import { DatePopover } from "./date-popover";
-import { Objects } from "@/utils/objects";
-import { Maps } from "@/utils/maps";
-import { exactDateTime } from "@/utils/dates";
-import { JsonOutput } from "../editor/output/JsonOutput";
-import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
-import { EmotionCacheProvider } from "../editor/output/EmotionCacheProvider";
-import { PopoverClose } from "@radix-ui/react-popover";
-import { Button } from "../ui/button";
-import type { ColumnChartSpecModel } from "./chart-spec-model";
-import type { CalculateTopKRows } from "@/plugins/impl/DataTablePlugin";
+import { parseContent, UrlDetector } from "./url-detector";
// Artificial limit to display long strings
const MAX_STRING_LENGTH = 50;
diff --git a/frontend/src/components/data-table/copy-column/feature.ts b/frontend/src/components/data-table/copy-column/feature.ts
index fcd913315b..7c3e1ca315 100644
--- a/frontend/src/components/data-table/copy-column/feature.ts
+++ b/frontend/src/components/data-table/copy-column/feature.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type {
- TableFeature,
+ Column,
RowData,
Table,
- Column,
+ TableFeature,
} from "@tanstack/react-table";
import type { CopyColumnOptions } from "./types";
diff --git a/frontend/src/components/data-table/data-table.tsx b/frontend/src/components/data-table/data-table.tsx
index cb17386f7d..31caf06203 100644
--- a/frontend/src/components/data-table/data-table.tsx
+++ b/frontend/src/components/data-table/data-table.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
+
// tanstack/table is not compatible with React compiler
// https://github.com/TanStack/table/issues/5567
-import React, { memo } from "react";
import {
type ColumnDef,
type ColumnFiltersState,
@@ -18,27 +18,28 @@ import {
type SortingState,
useReactTable,
} from "@tanstack/react-table";
+import React, { memo } from "react";
import { Table } from "@/components/ui/table";
-import type { DownloadActionProps } from "./download-actions";
+import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
import { cn } from "@/utils/cn";
-import { FilterPills } from "./filter-pills";
-import { useColumnPinning } from "./hooks/use-column-pinning";
-import { renderTableHeader, renderTableBody } from "./renderers";
-import { SearchBar } from "./SearchBar";
-import { TableActions } from "./TableActions";
-import { ColumnFormattingFeature } from "./column-formatting/feature";
-import { ColumnWrappingFeature } from "./column-wrapping/feature";
-import type { DataTableSelection, TooManyRows } from "./types";
+import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
import { CellSelectionFeature } from "./cell-selection/feature";
import type { CellSelectionState } from "./cell-selection/types";
-import type { GetRowIds } from "@/plugins/impl/DataTablePlugin";
import { CellStylingFeature } from "./cell-styling/feature";
import type { CellStyleState } from "./cell-styling/types";
+import { ColumnFormattingFeature } from "./column-formatting/feature";
+import { ColumnWrappingFeature } from "./column-wrapping/feature";
import { CopyColumnFeature } from "./copy-column/feature";
+import type { DownloadActionProps } from "./download-actions";
+import { FilterPills } from "./filter-pills";
import { FocusRowFeature } from "./focus-row/feature";
+import { useColumnPinning } from "./hooks/use-column-pinning";
+import { renderTableBody, renderTableHeader } from "./renderers";
+import { SearchBar } from "./SearchBar";
+import { TableActions } from "./TableActions";
+import type { DataTableSelection, TooManyRows } from "./types";
import { getStableRowId } from "./utils";
-import type { PanelType } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
interface DataTableProps<TData> extends Partial<DownloadActionProps> {
wrapperClassName?: string;
diff --git a/frontend/src/components/data-table/download-actions.tsx b/frontend/src/components/data-table/download-actions.tsx
index 9e708e0fdd..ab7e624bae 100644
--- a/frontend/src/components/data-table/download-actions.tsx
+++ b/frontend/src/components/data-table/download-actions.tsx
@@ -1,28 +1,29 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import {
+ BracesIcon,
+ BrickWallIcon,
+ ChevronDownIcon,
+ ClipboardListIcon,
+ TableIcon,
+} from "lucide-react";
import React from "react";
+import { logNever } from "@/utils/assertNever";
+import { copyToClipboard } from "@/utils/copy";
+import { downloadByURL } from "@/utils/download";
+import { jsonToTSV } from "@/utils/json/json-parser";
import { Button } from "../ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
- DropdownMenuSeparator,
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
import { toast } from "../ui/use-toast";
-import { downloadByURL } from "@/utils/download";
-import {
- BracesIcon,
- BrickWallIcon,
- ChevronDownIcon,
- ClipboardListIcon,
- TableIcon,
-} from "lucide-react";
-import { jsonToTSV } from "@/utils/json/json-parser";
-import { copyToClipboard } from "@/utils/copy";
-import { logNever } from "@/utils/assertNever";
type DownloadFormat = "csv" | "json" | "parquet";
diff --git a/frontend/src/components/data-table/filter-pills.tsx b/frontend/src/components/data-table/filter-pills.tsx
index c7e1c929cf..a95b95c761 100644
--- a/frontend/src/components/data-table/filter-pills.tsx
+++ b/frontend/src/components/data-table/filter-pills.tsx
@@ -6,10 +6,10 @@ import type {
ColumnFiltersState,
Table,
} from "@tanstack/react-table";
+import { XIcon } from "lucide-react";
+import { logNever } from "@/utils/assertNever";
import { Badge } from "../ui/badge";
import type { ColumnFilterValue } from "./filters";
-import { logNever } from "@/utils/assertNever";
-import { XIcon } from "lucide-react";
import { renderUnknownValue } from "./renderers";
interface Props<TData> {
diff --git a/frontend/src/components/data-table/filters.ts b/frontend/src/components/data-table/filters.ts
index d9930ecc43..268aab2be0 100644
--- a/frontend/src/components/data-table/filters.ts
+++ b/frontend/src/components/data-table/filters.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
+import type { RowData } from "@tanstack/react-table";
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 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/focus-row/feature.ts b/frontend/src/components/data-table/focus-row/feature.ts
index a5594ee65f..ef683ad3cd 100644
--- a/frontend/src/components/data-table/focus-row/feature.ts
+++ b/frontend/src/components/data-table/focus-row/feature.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- type Table,
- type RowData,
- type TableFeature,
makeStateUpdater,
type Row,
+ type RowData,
+ type Table,
+ type TableFeature,
} from "@tanstack/react-table";
import type { FocusRowOptions, FocusRowTableState } from "./types";
diff --git a/frontend/src/components/data-table/header-items.tsx b/frontend/src/components/data-table/header-items.tsx
index b6de1d4d3d..0b69b9865f 100644
--- a/frontend/src/components/data-table/header-items.tsx
+++ b/frontend/src/components/data-table/header-items.tsx
@@ -1,5 +1,20 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
+import { PinLeftIcon, PinRightIcon } from "@radix-ui/react-icons";
+import type { Column } from "@tanstack/react-table";
+import {
+ AlignJustifyIcon,
+ ArrowDownWideNarrowIcon,
+ ArrowUpNarrowWideIcon,
+ ChevronsUpDown,
+ CopyIcon,
+ FilterX,
+ FunnelPlusIcon,
+ ListFilterIcon,
+ ListFilterPlusIcon,
+ PinOffIcon,
+ WrapTextIcon,
+} from "lucide-react";
import {
DropdownMenuItem,
DropdownMenuPortal,
@@ -8,28 +23,14 @@ import {
DropdownMenuSubContent,
DropdownMenuSubTrigger,
} from "@/components/ui/dropdown-menu";
+import type { DataType } from "@/core/kernel/messages";
+import { cn } from "@/utils/cn";
+import { copyToClipboard } from "@/utils/copy";
import { DATA_TYPE_ICON } from "../datasets/icons";
+import { Button } from "../ui/button";
import { formattingExample } from "./column-formatting/feature";
import { formatOptions } from "./column-formatting/types";
-import type { Column } from "@tanstack/react-table";
-import type { DataType } from "@/core/kernel/messages";
-import { PinLeftIcon, PinRightIcon } from "@radix-ui/react-icons";
-import {
- AlignJustifyIcon,
- WrapTextIcon,
- PinOffIcon,
- CopyIcon,
- ChevronsUpDown,
- ArrowDownWideNarrowIcon,
- FilterX,
- ArrowUpNarrowWideIcon,
- ListFilterPlusIcon,
- FunnelPlusIcon,
- ListFilterIcon,
-} from "lucide-react";
-import { copyToClipboard } from "@/utils/copy";
import { NAMELESS_COLUMN_PREFIX } from "./columns";
-import { Button } from "../ui/button";
export function renderFormatOptions<TData, TValue>(
column: Column<TData, TValue>,
diff --git a/frontend/src/components/data-table/hooks/use-column-pinning.ts b/frontend/src/components/data-table/hooks/use-column-pinning.ts
index 1df25f6423..a46ed11aa9 100644
--- a/frontend/src/components/data-table/hooks/use-column-pinning.ts
+++ b/frontend/src/components/data-table/hooks/use-column-pinning.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
-import React from "react";
-import { SELECT_COLUMN_ID } from "../types";
import type { ColumnPinningState } from "@tanstack/react-table";
-import { useInternalStateWithSync } from "@/hooks/useInternalStateWithSync";
import { isEqual } from "lodash-es";
+import React from "react";
+import { useInternalStateWithSync } from "@/hooks/useInternalStateWithSync";
+import { SELECT_COLUMN_ID } from "../types";
interface UseColumnPinningResult {
columnPinning: ColumnPinningState;
diff --git a/frontend/src/components/data-table/hooks/use-panel-ownership.ts b/frontend/src/components/data-table/hooks/use-panel-ownership.ts
index 987b645d4e..b655a5e524 100644
--- a/frontend/src/components/data-table/hooks/use-panel-ownership.ts
+++ b/frontend/src/components/data-table/hooks/use-panel-ownership.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useAtom, useAtomValue } from "jotai";
-import { Logger } from "@/utils/Logger";
-import type { CellId } from "@/core/cells/ids";
import {
contextAwarePanelOpen,
contextAwarePanelOwner,
contextAwarePanelType,
isCellAwareAtom,
} from "@/components/editor/chrome/panels/context-aware-panel/atoms";
-import { lastFocusedCellIdAtom } from "@/core/cells/focus";
import type { PanelType } from "@/components/editor/chrome/panels/context-aware-panel/context-aware-panel";
+import { lastFocusedCellIdAtom } from "@/core/cells/focus";
+import type { CellId } from "@/core/cells/ids";
+import { Logger } from "@/utils/Logger";
interface PanelOwnershipResult {
isPanelOpen: (panelType: PanelType) => boolean;
diff --git a/frontend/src/components/data-table/mime-cell.tsx b/frontend/src/components/data-table/mime-cell.tsx
index d4db695f6c..ab891bf631 100644
--- a/frontend/src/components/data-table/mime-cell.tsx
+++ b/frontend/src/components/data-table/mime-cell.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { OutputMessage } from "@/core/kernel/messages";
import { cn } from "@/utils/cn";
import { OutputRenderer } from "../editor/Output";
-import type { OutputMessage } from "@/core/kernel/messages";
interface MimeCellProps {
value: MimeValue;
diff --git a/frontend/src/components/data-table/pagination.tsx b/frontend/src/components/data-table/pagination.tsx
index f913e789cd..86e4e55a2f 100644
--- a/frontend/src/components/data-table/pagination.tsx
+++ b/frontend/src/components/data-table/pagination.tsx
@@ -2,17 +2,15 @@
"use no memo";
import type { Table } from "@tanstack/react-table";
+import { range } from "lodash-es";
import {
ChevronLeft,
ChevronRight,
ChevronsLeft,
ChevronsRight,
} from "lucide-react";
-
import { Button } from "@/components/ui/button";
import { PluralWord } from "@/utils/pluralize";
-import { range } from "lodash-es";
-import type { DataTableSelection } from "./types";
import {
Select,
SelectContent,
@@ -22,6 +20,7 @@ import {
SelectTrigger,
SelectValue,
} from "../ui/select";
+import type { DataTableSelection } from "./types";
interface DataTablePaginationProps<TData> {
table: Table<TData>;
diff --git a/frontend/src/components/data-table/renderers.tsx b/frontend/src/components/data-table/renderers.tsx
index b88b64fc59..ad4f28e098 100644
--- a/frontend/src/components/data-table/renderers.tsx
+++ b/frontend/src/components/data-table/renderers.tsx
@@ -2,24 +2,24 @@
"use no memo";
import {
- TableHeader,
- TableHead,
- TableBody,
- TableRow,
- TableCell,
-} from "@/components/ui/table";
-import {
- flexRender,
- type Table,
+ type Cell,
+ type Column,
type ColumnDef,
+ flexRender,
+ type HeaderGroup,
type Row,
- type Column,
+ type Table,
type Table as TanStackTable,
- type HeaderGroup,
- type Cell,
} from "@tanstack/react-table";
-import { cn } from "@/utils/cn";
import type { JSX } from "react";
+import {
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table";
+import { cn } from "@/utils/cn";
export function renderTableHeader<TData>(
table: Table<TData>,
diff --git a/frontend/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx b/frontend/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx
index e99862fa94..4d9bd09383 100644
--- a/frontend/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx
+++ b/frontend/src/components/data-table/row-viewer-panel/__tests__/row-viewer.test.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, vi } from "vitest";
import { render, screen } from "@testing-library/react";
-import { RowViewerPanel } from "../row-viewer";
import { Provider } from "jotai";
+import { describe, expect, it, vi } from "vitest";
import { TooltipProvider } from "@/components/ui/tooltip";
import type { GetRowResult } from "@/plugins/impl/DataTablePlugin";
import type { FieldTypesWithExternalType } from "../../types";
+import { RowViewerPanel } from "../row-viewer";
const renderWithProviders = (component: React.ReactNode) => {
return render(
diff --git a/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx b/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
index d61583b61b..ba18c5f566 100644
--- a/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
+++ b/frontend/src/components/data-table/row-viewer-panel/row-viewer.tsx
@@ -1,15 +1,25 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type {
+ Column,
+ OnChangeFn,
+ RowSelectionState,
+} from "@tanstack/react-table";
import {
+ AlertTriangle,
ChevronLeft,
ChevronRight,
- SearchIcon,
ChevronsLeft,
ChevronsRight,
- AlertTriangle,
Info,
+ SearchIcon,
} from "lucide-react";
+import { useRef, useState } from "react";
+import { ColumnName } from "@/components/datasources/components";
+import { CopyClipboardIcon } from "@/components/icons/copy-icon";
+import { KeyboardHotkeys } from "@/components/shortcuts/renderShortcut";
import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
import {
Table,
TableBody,
@@ -18,30 +28,19 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
-import { Input } from "@/components/ui/input";
-import { CopyClipboardIcon } from "@/components/icons/copy-icon";
-import { useState, useRef } from "react";
import { useAsyncData } from "@/hooks/useAsyncData";
+import { useKeydownOnElement } from "@/hooks/useHotkey";
+import { Banner, ErrorBanner } from "@/plugins/impl/common/error-banner";
+import type { GetRowResult } from "@/plugins/impl/DataTablePlugin";
+import { NAMELESS_COLUMN_PREFIX, renderCellValue } from "../columns";
+import { prettifyRowCount } from "../pagination";
import {
+ type FieldTypesWithExternalType,
INDEX_COLUMN_NAME,
SELECT_COLUMN_ID,
TOO_MANY_ROWS,
type TooManyRows,
- type FieldTypesWithExternalType,
} from "../types";
-import { prettifyRowCount } from "../pagination";
-import type { GetRowResult } from "@/plugins/impl/DataTablePlugin";
-import { NAMELESS_COLUMN_PREFIX } from "../columns";
-import { Banner, ErrorBanner } from "@/plugins/impl/common/error-banner";
-import type {
- Column,
- RowSelectionState,
- OnChangeFn,
-} from "@tanstack/react-table";
-import { renderCellValue } from "../columns";
-import { useKeydownOnElement } from "@/hooks/useHotkey";
-import { ColumnName } from "@/components/datasources/components";
-import { KeyboardHotkeys } from "@/components/shortcuts/renderShortcut";
export interface RowViewerPanelProps {
rowIdx: number;
diff --git a/frontend/src/components/data-table/url-detector.tsx b/frontend/src/components/data-table/url-detector.tsx
index 426edf1969..f7b9d32a78 100644
--- a/frontend/src/components/data-table/url-detector.tsx
+++ b/frontend/src/components/data-table/url-detector.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Events } from "@/utils/events";
+
+import { useState } from "react";
import {
Popover,
- PopoverTrigger,
PopoverContent,
+ PopoverTrigger,
} from "@/components/ui/popover";
-import { useState } from "react";
+import { Events } from "@/utils/events";
const urlRegex = /(https?:\/\/\S+)/;
const imageRegex = /\.(png|jpe?g|gif|webp|svg|ico)(\?.*)?$/i;
diff --git a/frontend/src/components/databases/icon.tsx b/frontend/src/components/databases/icon.tsx
index 7cbd782faa..e78883584b 100644
--- a/frontend/src/components/databases/icon.tsx
+++ b/frontend/src/components/databases/icon.tsx
@@ -1,22 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { DatabaseIcon } from "lucide-react";
import type { FC } from "react";
-import SQLiteIcon from "./icons/sqlite.svg";
+import { cn } from "@/utils/cn";
+import ClickhouseIcon from "./icons/clickhouse.svg";
+import DatabricksIcon from "./icons/databricks.svg";
+import DataFusionIcon from "./icons/datafusion.png";
import DuckDBIcon from "./icons/duckdb.svg";
+import GoogleBigQueryIcon from "./icons/googlebigquery.svg";
+import IcebergIcon from "./icons/iceberg.png";
import MotherDuckIcon from "./icons/motherduck.svg";
-import PostgresQLIcon from "./icons/postgresql.svg";
import MySQLIcon from "./icons/mysql.svg";
+import PostgresQLIcon from "./icons/postgresql.svg";
+import RedshiftIcon from "./icons/redshift.svg";
import SnowflakeIcon from "./icons/snowflake.svg";
-import DatabricksIcon from "./icons/databricks.svg";
-import ClickhouseIcon from "./icons/clickhouse.svg";
+import PySparkIcon from "./icons/spark.svg";
+import SQLiteIcon from "./icons/sqlite.svg";
import TimeplusIcon from "./icons/timeplus.svg";
-import GoogleBigQueryIcon from "./icons/googlebigquery.svg";
import TrinoIcon from "./icons/trino.svg";
-import IcebergIcon from "./icons/iceberg.png";
-import DataFusionIcon from "./icons/datafusion.png";
-import PySparkIcon from "./icons/spark.svg";
-import RedshiftIcon from "./icons/redshift.svg";
-import { cn } from "@/utils/cn";
-import { DatabaseIcon } from "lucide-react";
export type DBLogoName =
| "sqlite"
diff --git a/frontend/src/components/datasets/icons.tsx b/frontend/src/components/datasets/icons.tsx
index 836909d1f2..e3248182c9 100644
--- a/frontend/src/components/datasets/icons.tsx
+++ b/frontend/src/components/datasets/icons.tsx
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { DataType } from "@/core/kernel/messages";
import {
- ToggleLeftIcon,
- CalendarIcon,
- HashIcon,
- TypeIcon,
- type LucideIcon,
CalendarClockIcon,
+ CalendarIcon,
ClockIcon,
CurlyBracesIcon,
+ HashIcon,
+ type LucideIcon,
+ ToggleLeftIcon,
+ TypeIcon,
} from "lucide-react";
+import type { DataType } from "@/core/kernel/messages";
import type { SelectableDataType } from "../data-table/charts/types";
/**
diff --git a/frontend/src/components/datasources/__tests__/install-package-button.test.tsx b/frontend/src/components/datasources/__tests__/install-package-button.test.tsx
index 9345a712be..34b7a75dff 100644
--- a/frontend/src/components/datasources/__tests__/install-package-button.test.tsx
+++ b/frontend/src/components/datasources/__tests__/install-package-button.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach } from "vitest";
-import { render, screen, fireEvent } from "@testing-library/react";
+
+import { fireEvent, render, screen } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import { InstallPackageButton } from "../install-package-button";
const mockOpenApplication = vi.fn();
diff --git a/frontend/src/components/datasources/__tests__/utils.test.ts b/frontend/src/components/datasources/__tests__/utils.test.ts
index c2e32bc6c1..b3be5889ab 100644
--- a/frontend/src/components/datasources/__tests__/utils.test.ts
+++ b/frontend/src/components/datasources/__tests__/utils.test.ts
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { describe, expect, it } from "vitest";
import {
DUCKDB_ENGINE,
type SQLTableContext,
} from "@/core/datasets/data-source-connections";
import type { DataTable, DataTableColumn } from "@/core/kernel/messages";
-import { describe, it, expect } from "vitest";
import { sqlCode } from "../utils";
describe("sqlCode", () => {
diff --git a/frontend/src/components/datasources/column-preview.tsx b/frontend/src/components/datasources/column-preview.tsx
index b80832807d..b3507bf9d3 100644
--- a/frontend/src/components/datasources/column-preview.tsx
+++ b/frontend/src/components/datasources/column-preview.tsx
@@ -1,32 +1,32 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { useAtomValue } from "jotai";
+import { PlusSquareIcon } from "lucide-react";
+import React, { Suspense } from "react";
+import { maybeAddAltairImport } from "@/core/cells/add-missing-import";
+import { useCellActions } from "@/core/cells/cells";
+import { useLastFocusedCellId } from "@/core/cells/focus";
+import { autoInstantiateAtom } from "@/core/config/config";
import type { SQLTableContext } from "@/core/datasets/data-source-connections";
-import { useOnMount } from "@/hooks/useLifecycle";
import type {
DataColumnPreview,
DataTable,
DataTableColumn,
DataType,
} from "@/core/kernel/messages";
+import { previewDatasetColumn } from "@/core/network/requests";
+import { useOnMount } from "@/hooks/useLifecycle";
+import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
import { type Theme, useTheme } from "@/theme/useTheme";
import { Events } from "@/utils/events";
-import React, { Suspense } from "react";
-import { previewDatasetColumn } from "@/core/network/requests";
+import { prettyNumber } from "@/utils/numbers";
+import { CopyClipboardIcon } from "../icons/copy-icon";
+import { Spinner } from "../icons/spinner";
import { Button } from "../ui/button";
-import { convertStatsName, sqlCode } from "./utils";
-import { PlusSquareIcon } from "lucide-react";
-import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
import { Tooltip } from "../ui/tooltip";
import { ColumnPreviewContainer } from "./components";
import { InstallPackageButton } from "./install-package-button";
-import { CopyClipboardIcon } from "../icons/copy-icon";
-import { maybeAddAltairImport } from "@/core/cells/add-missing-import";
-import { useCellActions } from "@/core/cells/cells";
-import { useLastFocusedCellId } from "@/core/cells/focus";
-import { autoInstantiateAtom } from "@/core/config/config";
-import { prettyNumber } from "@/utils/numbers";
-import { useAtomValue } from "jotai";
-import { Spinner } from "../icons/spinner";
+import { convertStatsName, sqlCode } from "./utils";
const LazyVegaLite = React.lazy(() =>
import("react-vega").then((m) => ({ default: m.VegaLite })),
diff --git a/frontend/src/components/datasources/components.tsx b/frontend/src/components/datasources/components.tsx
index fbcb41ce68..1cfd181524 100644
--- a/frontend/src/components/datasources/components.tsx
+++ b/frontend/src/components/datasources/components.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { ChevronRightIcon, LoaderCircle, XIcon } from "lucide-react";
import type { DataType } from "@/core/kernel/messages";
import { cn } from "@/utils/cn";
import { DATA_TYPE_COLOR, DATA_TYPE_ICON } from "../datasets/icons";
-import { ChevronRightIcon, LoaderCircle, XIcon } from "lucide-react";
export const RotatingChevron: React.FC<{ isExpanded: boolean }> = ({
isExpanded,
diff --git a/frontend/src/components/datasources/datasources.tsx b/frontend/src/components/datasources/datasources.tsx
index 50c6d5436b..56e1b88e18 100644
--- a/frontend/src/components/datasources/datasources.tsx
+++ b/frontend/src/components/datasources/datasources.tsx
@@ -1,40 +1,50 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
+import { CommandList } from "cmdk";
+import { atom, useAtomValue, useSetAtom } from "jotai";
+import { sortBy } from "lodash-es";
import {
DatabaseIcon,
- PlusIcon,
+ EyeIcon,
PaintRollerIcon,
+ PlusIcon,
PlusSquareIcon,
- XIcon,
- Table2Icon,
- EyeIcon,
RefreshCwIcon,
+ Table2Icon,
+ XIcon,
} from "lucide-react";
-import { Command, CommandInput, CommandItem } from "@/components/ui/command";
-import { CommandList } from "cmdk";
-
-import { cn } from "@/utils/cn";
-import {
- closeAllColumnsAtom,
- datasetTablesAtom,
- expandedColumnsAtom,
- useDatasets,
-} from "@/core/datasets/state";
+import React from "react";
+import { dbDisplayName } from "@/components/databases/display";
+import { EngineVariable } from "@/components/databases/engine-variable";
+import { DatabaseLogo } from "@/components/databases/icon";
+import { CopyClipboardIcon } from "@/components/icons/copy-icon";
import { Button } from "@/components/ui/button";
-import { cellIdsAtom, useCellActions } from "@/core/cells/cells";
-import { useLastFocusedCellId } from "@/core/cells/focus";
-import { atom, useAtomValue, useSetAtom } from "jotai";
+import { Command, CommandInput, CommandItem } from "@/components/ui/command";
import { Tooltip } from "@/components/ui/tooltip";
-import { PanelEmptyState } from "../editor/chrome/panels/empty-state";
-import { previewDataSourceConnection } from "@/core/network/requests";
-import { Events } from "@/utils/events";
-import { CopyClipboardIcon } from "@/components/icons/copy-icon";
-import { ErrorBoundary } from "../editor/boundary/ErrorBoundary";
import {
maybeAddAltairImport,
maybeAddMarimoImport,
} from "@/core/cells/add-missing-import";
+import { cellIdsAtom, useCellActions } from "@/core/cells/cells";
+import { useLastFocusedCellId } from "@/core/cells/focus";
import { autoInstantiateAtom } from "@/core/config/config";
+import {
+ DUCKDB_ENGINE,
+ dataConnectionsMapAtom,
+ INTERNAL_SQL_ENGINES,
+ type SQLTableContext,
+ useDataSourceActions,
+} from "@/core/datasets/data-source-connections";
+import {
+ PreviewSQLTable,
+ PreviewSQLTableList,
+} from "@/core/datasets/request-registry";
+import {
+ closeAllColumnsAtom,
+ datasetTablesAtom,
+ expandedColumnsAtom,
+ useDatasets,
+} from "@/core/datasets/state";
import type {
Database,
DatabaseSchema,
@@ -42,23 +52,18 @@ import type {
DataTable,
DataTableColumn,
} from "@/core/kernel/messages";
+import { previewDataSourceConnection } from "@/core/network/requests";
import { variablesAtom } from "@/core/variables/state";
-import { sortBy } from "lodash-es";
-import { logNever } from "@/utils/assertNever";
-import { DatabaseLogo } from "@/components/databases/icon";
-import { EngineVariable } from "@/components/databases/engine-variable";
import type { VariableName } from "@/core/variables/types";
-import { dbDisplayName } from "@/components/databases/display";
-import { AddDatabaseDialog } from "../editor/database/add-database-form";
-import {
- dataConnectionsMapAtom,
- DUCKDB_ENGINE,
- INTERNAL_SQL_ENGINES,
- type SQLTableContext,
- useDataSourceActions,
-} from "@/core/datasets/data-source-connections";
-import { PythonIcon } from "../editor/cell/code/icons";
import { useAsyncData } from "@/hooks/useAsyncData";
+import { logNever } from "@/utils/assertNever";
+import { cn } from "@/utils/cn";
+import { Events } from "@/utils/events";
+import { ErrorBoundary } from "../editor/boundary/ErrorBoundary";
+import { PythonIcon } from "../editor/cell/code/icons";
+import { PanelEmptyState } from "../editor/chrome/panels/empty-state";
+import { AddDatabaseDialog } from "../editor/database/add-database-form";
+import { DatasetColumnPreview } from "./column-preview";
import {
ColumnName,
DatasourceLabel,
@@ -68,11 +73,6 @@ import {
RotatingChevron,
} from "./components";
import { isSchemaless, sqlCode } from "./utils";
-import {
- PreviewSQLTableList,
- PreviewSQLTable,
-} from "@/core/datasets/request-registry";
-import { DatasetColumnPreview } from "./column-preview";
const sortedTablesAtom = atom((get) => {
const tables = get(datasetTablesAtom);
diff --git a/frontend/src/components/datasources/install-package-button.tsx b/frontend/src/components/datasources/install-package-button.tsx
index 55993a7b50..a32d46bc75 100644
--- a/frontend/src/components/datasources/install-package-button.tsx
+++ b/frontend/src/components/datasources/install-package-button.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useSetAtom } from "jotai";
import React from "react";
-import { Button } from "@/components/ui/button";
-import { useChromeActions } from "@/components/editor/chrome/state";
import { packagesToInstallAtom } from "@/components/editor/chrome/panels/packages-state";
-import { useSetAtom } from "jotai";
+import { useChromeActions } from "@/components/editor/chrome/state";
+import { Button } from "@/components/ui/button";
import { cn } from "@/utils/cn";
interface InstallPackageButtonProps {
diff --git a/frontend/src/components/datasources/utils.ts b/frontend/src/components/datasources/utils.ts
index e72cd348af..27e34afaf9 100644
--- a/frontend/src/components/datasources/utils.ts
+++ b/frontend/src/components/datasources/utils.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- type SQLTableContext,
DUCKDB_ENGINE,
+ type SQLTableContext,
} from "@/core/datasets/data-source-connections";
import type { DataTable, DataType } from "@/core/kernel/messages";
import type { ColumnHeaderStatsKey } from "../data-table/types";
diff --git a/frontend/src/components/debugger/debugger-code.tsx b/frontend/src/components/debugger/debugger-code.tsx
index 164d32d5db..68d960262f 100644
--- a/frontend/src/components/debugger/debugger-code.tsx
+++ b/frontend/src/components/debugger/debugger-code.tsx
@@ -2,12 +2,10 @@
import { langs } from "@uiw/codemirror-extensions-langs";
import ReactCodeMirror, {
EditorView,
+ keymap,
Prec,
type ReactCodeMirrorRef,
- keymap,
} from "@uiw/react-codemirror";
-import React, { memo } from "react";
-import { Tooltip } from "../ui/tooltip";
import {
HelpCircleIcon,
LayersIcon,
@@ -15,8 +13,10 @@ import {
SkipForwardIcon,
TrashIcon,
} from "lucide-react";
-import { Button } from "../ui/button";
+import React, { memo } from "react";
import { cn } from "@/utils/cn";
+import { Button } from "../ui/button";
+import { Tooltip } from "../ui/tooltip";
import "./debugger-code.css";
import { useKeydownOnElement } from "@/hooks/useHotkey";
import { Functions } from "@/utils/functions";
diff --git a/frontend/src/components/dependency-graph/custom-node.tsx b/frontend/src/components/dependency-graph/custom-node.tsx
index d9617f4789..076a82053d 100644
--- a/frontend/src/components/dependency-graph/custom-node.tsx
+++ b/frontend/src/components/dependency-graph/custom-node.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TinyCode } from "@/components/editor/cell/TinyCode";
-import { cn } from "@/utils/cn";
+
import { useAtomValue } from "jotai";
import React, { memo, use } from "react";
import { Handle, Position, useStore } from "reactflow";
-import { type CustomNodeProps, getNodeHeight } from "./elements";
-import { displayCellName } from "@/core/cells/names";
+import { TinyCode } from "@/components/editor/cell/TinyCode";
import { useCellIds } from "@/core/cells/cells";
+import { displayCellName } from "@/core/cells/names";
+import { cn } from "@/utils/cn";
+import { type CustomNodeProps, getNodeHeight } from "./elements";
import type { LayoutDirection } from "./types";
function getWidth(canvasWidth: number) {
diff --git a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
index 724ef0f37f..93fd4bc6ea 100644
--- a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx
@@ -1,13 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import ReactFlow, {
- type Node,
- type Edge,
- useEdgesState,
- useNodesState,
- PanOnScrollMode,
- useStore,
- type CoordinateExtent,
-} from "reactflow";
+
+import type { Atom } from "jotai";
import React, {
type PropsWithChildren,
@@ -16,15 +9,22 @@ import React, {
useRef,
useState,
} from "react";
+import useEvent from "react-use-event-hook";
+import ReactFlow, {
+ type CoordinateExtent,
+ type Edge,
+ type Node,
+ PanOnScrollMode,
+ useEdgesState,
+ useNodesState,
+ useStore,
+} from "reactflow";
import { nodeTypes } from "@/components/dependency-graph/custom-node";
-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 { type NodeData, VerticalElementsBuilder } from "./elements";
-import useEvent from "react-use-event-hook";
+import type { Variables } from "@/core/variables/types";
import { scrollAndHighlightCell } from "../editor/links/cell-link";
+import { type NodeData, VerticalElementsBuilder } from "./elements";
import { GraphSelectionPanel } from "./panels";
import { useFitToViewOnDimensionChange } from "./utils/useFitToViewOnDimensionChange";
diff --git a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx b/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
index fb3a376d84..13d3736bd0 100644
--- a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph-tree.tsx
@@ -1,38 +1,37 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Atom } from "jotai";
+import { MapPinIcon } from "lucide-react";
+import React, { type PropsWithChildren, useEffect, useState } from "react";
+import useEvent from "react-use-event-hook";
import ReactFlow, {
- useEdgesState,
- useNodesState,
- Controls,
Background,
BackgroundVariant,
- type Node,
- type Edge,
ControlButton,
+ Controls,
+ type Edge,
+ type Node,
+ useEdgesState,
+ useNodesState,
useReactFlow,
} from "reactflow";
-
-import React, { type PropsWithChildren, useEffect, useState } from "react";
import {
EdgeMarkerContext,
nodeTypes,
} from "@/components/dependency-graph/custom-node";
-import type { Variables } from "@/core/variables/types";
+import { lastFocusedCellIdAtom } from "@/core/cells/focus";
import type { CellId } from "@/core/cells/ids";
import type { CellData } from "@/core/cells/types";
-import type { Atom } from "jotai";
-
-import { type NodeData, TreeElementsBuilder } from "./elements";
-import { layoutElements } from "./utils/layout";
-import type { GraphSelection, GraphSettings, LayoutDirection } from "./types";
-import useEvent from "react-use-event-hook";
+import { store } from "@/core/state/jotai";
+import type { Variables } from "@/core/variables/types";
+import { Events } from "@/utils/events";
import { scrollAndHighlightCell } from "../editor/links/cell-link";
+import { Tooltip } from "../ui/tooltip";
+import { type NodeData, TreeElementsBuilder } from "./elements";
import { GraphSelectionPanel } from "./panels";
+import type { GraphSelection, GraphSettings, LayoutDirection } from "./types";
+import { layoutElements } from "./utils/layout";
import { useFitToViewOnDimensionChange } from "./utils/useFitToViewOnDimensionChange";
-import { MapPinIcon } from "lucide-react";
-import { store } from "@/core/state/jotai";
-import { lastFocusedCellIdAtom } from "@/core/cells/focus";
-import { Tooltip } from "../ui/tooltip";
-import { Events } from "@/utils/events";
interface Props {
cellIds: CellId[];
diff --git a/frontend/src/components/dependency-graph/dependency-graph.tsx b/frontend/src/components/dependency-graph/dependency-graph.tsx
index 32527f003c..db0afa6825 100644
--- a/frontend/src/components/dependency-graph/dependency-graph.tsx
+++ b/frontend/src/components/dependency-graph/dependency-graph.tsx
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ReactFlowProvider } from "reactflow";
+
+import { type Atom, atom, useAtom } from "jotai";
import React from "react";
-import type { Variables } from "@/core/variables/types";
+import { ReactFlowProvider } from "reactflow";
import type { CellId } from "@/core/cells/ids";
import type { CellData } from "@/core/cells/types";
-import { type Atom, atom, useAtom } from "jotai";
-
-import type { GraphLayoutView, GraphSettings } from "./types";
+import type { Variables } from "@/core/variables/types";
import { DependencyGraphMinimap } from "./dependency-graph-minimap";
-import { GraphToolbar } from "./panels";
import { DependencyGraphTree } from "./dependency-graph-tree";
+import { GraphToolbar } from "./panels";
+import type { GraphLayoutView, GraphSettings } from "./types";
import "reactflow/dist/style.css";
import "./dependency-graph.css";
diff --git a/frontend/src/components/dependency-graph/elements.ts b/frontend/src/components/dependency-graph/elements.ts
index e844221037..c8bbd8bf28 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 type { CellData } from "@/core/cells/types";
+import type { Atom } from "jotai";
+import { type Edge, MarkerType, type Node, type NodeProps } from "reactflow";
import type { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
import { store } from "@/core/state/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/panels.tsx b/frontend/src/components/dependency-graph/panels.tsx
index e2a7d04212..6594da891e 100644
--- a/frontend/src/components/dependency-graph/panels.tsx
+++ b/frontend/src/components/dependency-graph/panels.tsx
@@ -1,31 +1,32 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { memo } from "react";
-import { type Edge, Panel } from "reactflow";
-import { Button } from "../ui/button";
+
import {
- Rows3Icon,
- NetworkIcon,
ArrowRightFromLineIcon,
ArrowRightIcon,
ArrowRightToLineIcon,
- WorkflowIcon,
- SquareFunction,
- SettingsIcon,
MoreVerticalIcon,
+ NetworkIcon,
+ Rows3Icon,
+ SettingsIcon,
+ SquareFunction,
+ WorkflowIcon,
XIcon,
} from "lucide-react";
-import type { GraphLayoutView, GraphSelection, GraphSettings } from "./types";
+import React, { memo } from "react";
+import { type Edge, Panel } from "reactflow";
+import { getCellEditorView } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import { goToVariableDefinition } from "@/core/codemirror/go-to-definition/commands";
+import type { Variable, Variables } from "@/core/variables/types";
+import { ConnectionCellActionsDropdown } from "../editor/cell/cell-actions";
import { CellLink } from "../editor/links/cell-link";
import { CellLinkList } from "../editor/links/cell-link-list";
-import { VariableName } from "../variables/common";
-import type { Variable, Variables } from "@/core/variables/types";
-import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
+import { Button } from "../ui/button";
import { Checkbox } from "../ui/checkbox";
import { Label } from "../ui/label";
-import { ConnectionCellActionsDropdown } from "../editor/cell/cell-actions";
-import { getCellEditorView } from "@/core/cells/cells";
-import type { CellId } from "@/core/cells/ids";
-import { goToVariableDefinition } from "@/core/codemirror/go-to-definition/commands";
+import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
+import { VariableName } from "../variables/common";
+import type { GraphLayoutView, GraphSelection, GraphSettings } from "./types";
interface Props {
view: GraphLayoutView;
diff --git a/frontend/src/components/dependency-graph/utils/changes.ts b/frontend/src/components/dependency-graph/utils/changes.ts
index 4572195fff..4c8af99aa2 100644
--- a/frontend/src/components/dependency-graph/utils/changes.ts
+++ b/frontend/src/components/dependency-graph/utils/changes.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type {
- Node,
- NodeAddChange,
- NodeRemoveChange,
Edge,
EdgeAddChange,
EdgeRemoveChange,
+ Node,
+ NodeAddChange,
+ NodeRemoveChange,
} from "reactflow";
export function getNodeChanges(
diff --git a/frontend/src/components/dependency-graph/utils/useFitToViewOnDimensionChange.ts b/frontend/src/components/dependency-graph/utils/useFitToViewOnDimensionChange.ts
index 50604f5a70..470c25ff68 100644
--- a/frontend/src/components/dependency-graph/utils/useFitToViewOnDimensionChange.ts
+++ b/frontend/src/components/dependency-graph/utils/useFitToViewOnDimensionChange.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useDebouncedCallback } from "@/hooks/useDebounce";
+
import { useEffect } from "react";
import { useReactFlow, useStore } from "reactflow";
+import { useDebouncedCallback } from "@/hooks/useDebounce";
/**
* Call fitToView whenever the dimensions changes
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsx
index eecc0d091b..66b8b3ea03 100644
--- a/frontend/src/components/editor/Cell.tsx
+++ b/frontend/src/components/editor/Cell.tsx
@@ -1,74 +1,74 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { closeCompletion, completionStatus } from "@codemirror/autocomplete";
import type { EditorView } from "@codemirror/view";
+import clsx from "clsx";
+import { useSetAtom } from "jotai";
+import {
+ HelpCircleIcon,
+ MoreHorizontalIcon,
+ SquareFunctionIcon,
+} from "lucide-react";
import {
- memo,
type FocusEvent,
- type KeyboardEvent,
forwardRef,
+ type KeyboardEvent,
+ memo,
useCallback,
useImperativeHandle,
useRef,
useState,
} from "react";
-import { saveCellConfig, sendStdin } from "@/core/network/requests";
+import useEvent from "react-use-event-hook";
+import { StopButton } from "@/components/editor/cell/StopButton";
+import { Toolbar, ToolbarItem } from "@/components/editor/cell/toolbar";
+import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { aiCompletionCellAtom } from "@/core/ai/state";
+import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
+import { isOutputEmpty } from "@/core/cells/outputs";
import { autocompletionKeymap } from "@/core/codemirror/cm";
-import type { UserConfig } from "../../core/config/config-schema";
+import type { LanguageAdapterType } from "@/core/codemirror/language/types";
+import { canCollapseOutline } from "@/core/dom/outline";
+import { isErrorMime } from "@/core/mime";
+import type { AppMode } from "@/core/mode";
+import { saveCellConfig, sendStdin } from "@/core/network/requests";
+import type { CellConfig, RuntimeState } from "@/core/network/types";
+import { useHotkeysOnElement, useKeydownOnElement } from "@/hooks/useHotkey";
+import { useResizeObserver } from "@/hooks/useResizeObserver";
+import { cn } from "@/utils/cn";
+import { Events } from "@/utils/events";
+import type { Milliseconds, Seconds } from "@/utils/time";
+import { type CellActions, SETUP_CELL_ID } from "../../core/cells/cells";
+import { type CellId, HTMLCellId } from "../../core/cells/ids";
import type { CellData, CellRuntimeState } from "../../core/cells/types";
-import { SETUP_CELL_ID, type CellActions } from "../../core/cells/cells";
import { isUninstantiated } from "../../core/cells/utils";
-import { derefNotNull } from "../../utils/dereference";
-import { OutputArea } from "./Output";
-import { ConsoleOutput } from "./output/ConsoleOutput";
-import { CreateCellButton } from "./cell/CreateCellButton";
-import { RunButton } from "./cell/RunButton";
-import { DeleteButton } from "./cell/DeleteButton";
-import { CellStatusComponent } from "./cell/CellStatus";
-import clsx from "clsx";
-import { renderShortcut } from "../shortcuts/renderShortcut";
+import type { UserConfig } from "../../core/config/config-schema";
+import {
+ isAppConnected,
+ isAppInteractionDisabled,
+} from "../../core/websocket/connection-utils";
+import type { WebSocketState } from "../../core/websocket/types";
import { useCellRenderCount } from "../../hooks/useCellRenderCount";
+import type { Theme } from "../../theme/useTheme";
+import { derefNotNull } from "../../utils/dereference";
import { Functions } from "../../utils/functions";
import { Logger } from "../../utils/Logger";
-import { CellDragHandle, SortableCell } from "./SortableCell";
-import { type CellId, HTMLCellId } from "../../core/cells/ids";
-import type { Theme } from "../../theme/useTheme";
+import { renderShortcut } from "../shortcuts/renderShortcut";
+import { CellStatusComponent } from "./cell/CellStatus";
+import { CreateCellButton } from "./cell/CreateCellButton";
import {
CellActionsDropdown,
type CellActionsDropdownHandle,
} from "./cell/cell-actions";
import { CellActionsContextMenu } from "./cell/cell-context-menu";
-import type { AppMode } from "@/core/mode";
-import useEvent from "react-use-event-hook";
import { CellEditor } from "./cell/code/cell-editor";
-import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
-import { isOutputEmpty } from "@/core/cells/outputs";
-import { useHotkeysOnElement, useKeydownOnElement } from "@/hooks/useHotkey";
-import { useSetAtom } from "jotai";
-import { aiCompletionCellAtom } from "@/core/ai/state";
import { CollapsedCellBanner, CollapseToggle } from "./cell/collapse";
-import { canCollapseOutline } from "@/core/dom/outline";
-import { StopButton } from "@/components/editor/cell/StopButton";
-import type { CellConfig, RuntimeState } from "@/core/network/types";
-import {
- HelpCircleIcon,
- MoreHorizontalIcon,
- SquareFunctionIcon,
-} from "lucide-react";
-import { Toolbar, ToolbarItem } from "@/components/editor/cell/toolbar";
-import { cn } from "@/utils/cn";
-import { isErrorMime } from "@/core/mime";
-import { HideCodeButton } from "./code/readonly-python-code";
-import { useResizeObserver } from "@/hooks/useResizeObserver";
-import type { LanguageAdapterType } from "@/core/codemirror/language/types";
-import { Events } from "@/utils/events";
-import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { DeleteButton } from "./cell/DeleteButton";
+import { RunButton } from "./cell/RunButton";
import { useRunCell } from "./cell/useRunCells";
-import type { Milliseconds, Seconds } from "@/utils/time";
-import {
- isAppConnected,
- isAppInteractionDisabled,
-} from "../../core/websocket/connection-utils";
-import type { WebSocketState } from "../../core/websocket/types";
+import { HideCodeButton } from "./code/readonly-python-code";
+import { OutputArea } from "./Output";
+import { ConsoleOutput } from "./output/ConsoleOutput";
+import { CellDragHandle, SortableCell } from "./SortableCell";
/**
* Hook for handling cell completion logic
@@ -871,6 +871,7 @@ const EditableCellComponent = ({
href="https://links.marimo.app/reusable-definitions"
target="_blank"
className="hover:underline py-1 px-2 flex items-center justify-end gap-2 last:rounded-b"
+ rel="noopener"
>
{isToplevel && (
<span className="text-muted-foreground text-xs font-bold">
diff --git a/frontend/src/components/editor/Disconnected.tsx b/frontend/src/components/editor/Disconnected.tsx
index 1caac09d91..031e2541a1 100644
--- a/frontend/src/components/editor/Disconnected.tsx
+++ b/frontend/src/components/editor/Disconnected.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { ArrowRightSquareIcon } from "lucide-react";
import { API } from "@/core/network/api";
-import { Button } from "../ui/button";
-import { toast } from "../ui/use-toast";
+import { Banner } from "@/plugins/impl/common/error-banner";
import { prettyError } from "@/utils/errors";
import { reloadSafe } from "@/utils/reload-safe";
-import { ArrowRightSquareIcon } from "lucide-react";
-import { Banner } from "@/plugins/impl/common/error-banner";
+import { Button } from "../ui/button";
+import { toast } from "../ui/use-toast";
interface DisconnectedProps {
reason: string;
diff --git a/frontend/src/components/editor/Output.tsx b/frontend/src/components/editor/Output.tsx
index af9371881b..32c7a3a417 100644
--- a/frontend/src/components/editor/Output.tsx
+++ b/frontend/src/components/editor/Output.tsx
@@ -1,40 +1,37 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
-import { memo, useEffect, useMemo, useRef, useState } from "react";
-
+import React, { memo, useEffect, useMemo, useRef, useState } from "react";
+import { type CellId, CellOutputId } from "@/core/cells/ids";
import type { OutputMessage } from "@/core/kernel/messages";
-
+import { cn } from "@/utils/cn";
import { logNever } from "../../utils/assertNever";
-import { JsonOutput } from "./output/JsonOutput";
+import { ErrorBoundary } from "./boundary/ErrorBoundary";
import { HtmlOutput } from "./output/HtmlOutput";
import { ImageOutput } from "./output/ImageOutput";
+import { JsonOutput } from "./output/JsonOutput";
import { MarimoErrorOutput } from "./output/MarimoErrorOutput";
import { TextOutput } from "./output/TextOutput";
import { VideoOutput } from "./output/VideoOutput";
-import { CellOutputId, type CellId } from "@/core/cells/ids";
-import { cn } from "@/utils/cn";
-import { ErrorBoundary } from "./boundary/ErrorBoundary";
import "./output/Outputs.css";
-import { Button } from "../ui/button";
import {
ChevronsDownUpIcon,
ChevronsUpDownIcon,
ExpandIcon,
} from "lucide-react";
-import { Tooltip } from "../ui/tooltip";
import { useExpandedOutput } from "@/core/cells/outputs";
-import { invariant } from "@/utils/invariant";
-import { CsvViewer } from "./file-tree/renderers";
-import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
-import { MarimoTracebackOutput } from "./output/MarimoTracebackOutput";
-import { useTheme } from "@/theme/useTheme";
import { renderHTML } from "@/plugins/core/RenderHTML";
+import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
import type { TopLevelFacetedUnitSpec } from "@/plugins/impl/data-explorer/queries/types";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
+import { useTheme } from "@/theme/useTheme";
+import { Events } from "@/utils/events";
+import { invariant } from "@/utils/invariant";
import { Objects } from "@/utils/objects";
+import { Button } from "../ui/button";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../ui/tabs";
+import { Tooltip } from "../ui/tooltip";
+import { CsvViewer } from "./file-tree/renderers";
+import { MarimoTracebackOutput } from "./output/MarimoTracebackOutput";
import { renderMimeIcon } from "./renderMimeIcon";
-import { Events } from "@/utils/events";
const LazyVegaLite = React.lazy(() =>
import("react-vega").then((m) => ({ default: m.VegaLite })),
diff --git a/frontend/src/components/editor/RecoveryButton.tsx b/frontend/src/components/editor/RecoveryButton.tsx
index b0481c8a60..d5c5e4eb5f 100644
--- a/frontend/src/components/editor/RecoveryButton.tsx
+++ b/frontend/src/components/editor/RecoveryButton.tsx
@@ -1,25 +1,26 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Button as EditorButton } from "@/components/editor/inputs/Inputs";
+
+import type { Notebook } from "@marimo-team/marimo-api";
import { Button } from "components/ui/button";
-import { useHotkey } from "../../hooks/useHotkey";
import { SaveIcon } from "lucide-react";
-import { Tooltip } from "../ui/tooltip";
-import { renderShortcut } from "../shortcuts/renderShortcut";
+import type { JSX } from "react";
+import { Button as EditorButton } from "@/components/editor/inputs/Inputs";
+import { getNotebook } from "@/core/cells/cells";
+import { notebookCells } from "@/core/cells/utils";
+import { getMarimoVersion } from "@/core/meta/globals";
+import { useEvent } from "@/hooks/useEvent";
+import { downloadBlob } from "@/utils/download";
+import { Paths } from "@/utils/paths";
+import { useHotkey } from "../../hooks/useHotkey";
import { useImperativeModal } from "../modal/ImperativeModal";
+import { renderShortcut } from "../shortcuts/renderShortcut";
import {
DialogContent,
DialogDescription,
DialogFooter,
DialogTitle,
} from "../ui/dialog";
-import { downloadBlob } from "@/utils/download";
-import { useEvent } from "@/hooks/useEvent";
-import { getNotebook } from "@/core/cells/cells";
-import { notebookCells } from "@/core/cells/utils";
-import type { Notebook } from "@marimo-team/marimo-api";
-import { getMarimoVersion } from "@/core/meta/globals";
-import { Paths } from "@/utils/paths";
-import type { JSX } from "react";
+import { Tooltip } from "../ui/tooltip";
const RecoveryModal = (props: {
proposedName: string;
diff --git a/frontend/src/components/editor/SortableCell.tsx b/frontend/src/components/editor/SortableCell.tsx
index 32c4ec9135..b8a8e33710 100644
--- a/frontend/src/components/editor/SortableCell.tsx
+++ b/frontend/src/components/editor/SortableCell.tsx
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { memo, use } from "react";
+
+import type { DraggableAttributes } from "@dnd-kit/core";
+import type { SyntheticListenerMap } from "@dnd-kit/core/dist/hooks/utilities";
import { useSortable } from "@dnd-kit/sortable";
import { CSS, type Transform } from "@dnd-kit/utilities";
import { GripVerticalIcon } from "lucide-react";
+import React, { memo, use } from "react";
import type { CellId } from "@/core/cells/ids";
import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
import { mergeRefs } from "@/utils/mergeRefs";
-import type { SyntheticListenerMap } from "@dnd-kit/core/dist/hooks/utilities";
-import type { DraggableAttributes } from "@dnd-kit/core";
interface Props extends React.HTMLAttributes<HTMLDivElement> {
children: React.ReactNode;
diff --git a/frontend/src/components/editor/__tests__/data-attributes.test.tsx b/frontend/src/components/editor/__tests__/data-attributes.test.tsx
index 98936f6093..055d3a2b04 100644
--- a/frontend/src/components/editor/__tests__/data-attributes.test.tsx
+++ b/frontend/src/components/editor/__tests__/data-attributes.test.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { render } from "@testing-library/react";
import { beforeAll, describe, expect, it } from "vitest";
-import { Cell, type CellComponentActions } from "../Cell";
-import { OutputArea } from "../Output";
+import { TooltipProvider } from "@/components/ui/tooltip";
import type { CellId } from "@/core/cells/ids";
-import type { OutputMessage } from "@/core/kernel/messages";
import type { UserConfig } from "@/core/config/config-schema";
-import { TooltipProvider } from "@/components/ui/tooltip";
+import type { OutputMessage } from "@/core/kernel/messages";
import type { AppMode } from "@/core/mode";
-import { Functions } from "@/utils/functions";
import { WebSocketState } from "@/core/websocket/types";
+import { Functions } from "@/utils/functions";
+import { Cell, type CellComponentActions } from "../Cell";
+import { OutputArea } from "../Output";
beforeAll(() => {
global.ResizeObserver = class ResizeObserver {
diff --git a/frontend/src/components/editor/__tests__/dynamic-favicon.test.tsx b/frontend/src/components/editor/__tests__/dynamic-favicon.test.tsx
index 5e95a0c34c..f907cc75bb 100644
--- a/frontend/src/components/editor/__tests__/dynamic-favicon.test.tsx
+++ b/frontend/src/components/editor/__tests__/dynamic-favicon.test.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
import { render } from "@testing-library/react";
-import { DynamicFavicon } from "../dynamic-favicon";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useCellErrors } from "@/core/cells/cells";
+import { DynamicFavicon } from "../dynamic-favicon";
// Mock useCellErrors hook
vi.mock("@/core/cells/cells", () => ({
diff --git a/frontend/src/components/editor/actions/name-cell-input.tsx b/frontend/src/components/editor/actions/name-cell-input.tsx
index 551f96ebd9..c4245a7667 100644
--- a/frontend/src/components/editor/actions/name-cell-input.tsx
+++ b/frontend/src/components/editor/actions/name-cell-input.tsx
@@ -1,17 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import React, { useRef, useState } from "react";
import { Input } from "@/components/ui/input";
import { Tooltip } from "@/components/ui/tooltip";
import { getCellNames, useCellActions } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
import {
- normalizeName,
getValidName,
isInternalCellName,
+ normalizeName,
} from "@/core/cells/names";
import { useOnMount } from "@/hooks/useLifecycle";
import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
-import React, { useRef, useState } from "react";
interface Props
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange"> {
diff --git a/frontend/src/components/editor/actions/useCellActionButton.tsx b/frontend/src/components/editor/actions/useCellActionButton.tsx
index e148d42dc8..77081e3661 100644
--- a/frontend/src/components/editor/actions/useCellActionButton.tsx
+++ b/frontend/src/components/editor/actions/useCellActionButton.tsx
@@ -1,65 +1,66 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { downloadCellOutput } from "@/components/export/export-output-button";
-import { Switch } from "@/components/ui/switch";
-import { formatEditorViews } from "@/core/codemirror/format";
-import { toggleToLanguage } from "@/core/codemirror/language/commands";
-import { hasOnlyOneCellAtom, useCellActions } from "@/core/cells/cells";
+
+import type { EditorView } from "@codemirror/view";
+import { useAtomValue, useSetAtom } from "jotai";
import {
- ImageIcon,
- Code2Icon,
- ZapIcon,
- PlusCircleIcon,
- ChevronUpIcon,
ChevronDownIcon,
- ChevronsUpIcon,
+ ChevronLeftIcon,
+ ChevronRightIcon,
ChevronsDownIcon,
- Trash2Icon,
- ZapOffIcon,
- PlayIcon,
- TextCursorInputIcon,
+ ChevronsUpIcon,
+ ChevronUpIcon,
+ Code2Icon,
+ Columns2Icon,
+ DatabaseIcon,
EyeIcon,
EyeOffIcon,
+ ImageIcon,
+ LinkIcon,
+ PlayIcon,
+ PlusCircleIcon,
+ ScissorsIcon,
SparklesIcon,
- DatabaseIcon,
- Columns2Icon,
+ TextCursorInputIcon,
+ Trash2Icon,
XCircleIcon,
- ChevronLeftIcon,
- ChevronRightIcon,
- ScissorsIcon,
- LinkIcon,
+ ZapIcon,
+ ZapOffIcon,
} from "lucide-react";
-import type { ActionButton } from "./types";
+import { downloadCellOutput } from "@/components/export/export-output-button";
import { MultiIcon } from "@/components/icons/multi-icon";
-import type { CellData } from "@/core/cells/types";
-import type { CellId } from "@/core/cells/ids";
-import { saveCellConfig } from "@/core/network/requests";
-import type { EditorView } from "@codemirror/view";
-import { useRunCell } from "../cell/useRunCells";
-import { NameCellInput } from "./name-cell-input";
-import { useAtomValue, useSetAtom } from "jotai";
-import { aiCompletionCellAtom } from "@/core/ai/state";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import {
DialogContent,
- DialogTitle,
DialogHeader,
+ DialogTitle,
} from "@/components/ui/dialog";
import { Label } from "@/components/ui/label";
-import { MarkdownIcon, PythonIcon } from "../cell/code/icons";
+import { Switch } from "@/components/ui/switch";
+import { toast } from "@/components/ui/use-toast";
+import { aiCompletionCellAtom } from "@/core/ai/state";
+import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
+import { hasOnlyOneCellAtom, useCellActions } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import type { CellData } from "@/core/cells/types";
+import { formatEditorViews } from "@/core/codemirror/format";
+import { toggleToLanguage } from "@/core/codemirror/language/commands";
+import { switchLanguage } from "@/core/codemirror/language/extension";
import {
aiEnabledAtom,
appWidthAtom,
autoInstantiateAtom,
} from "@/core/config/config";
-import { useDeleteCellCallback } from "../cell/useDeleteCell";
-import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
-import type { CellConfig, RuntimeState } from "@/core/network/types";
import { kioskModeAtom } from "@/core/mode";
-import { switchLanguage } from "@/core/codemirror/language/extension";
-import { useSplitCellCallback } from "../cell/useSplitCell";
+import { saveCellConfig } from "@/core/network/requests";
+import type { CellConfig, RuntimeState } from "@/core/network/types";
import { canLinkToCell, createCellLink } from "@/utils/cell-urls";
import { copyToClipboard } from "@/utils/copy";
-import { toast } from "@/components/ui/use-toast";
+import { MarkdownIcon, PythonIcon } from "../cell/code/icons";
+import { useDeleteCellCallback } from "../cell/useDeleteCell";
+import { useRunCell } from "../cell/useRunCells";
+import { useSplitCellCallback } from "../cell/useSplitCell";
+import { NameCellInput } from "./name-cell-input";
+import type { ActionButton } from "./types";
export interface CellActionButtonProps
extends Pick<CellData, "name" | "config"> {
diff --git a/frontend/src/components/editor/actions/useConfigActions.tsx b/frontend/src/components/editor/actions/useConfigActions.tsx
index 465f23a314..8596f2af5a 100644
--- a/frontend/src/components/editor/actions/useConfigActions.tsx
+++ b/frontend/src/components/editor/actions/useConfigActions.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { saveAppConfig, saveUserConfig } from "@/core/network/requests";
-import type { ActionButton } from "./types";
+
+import { useAppConfig, useResolvedMarimoConfig } from "@/core/config/config";
import type { AppConfig, UserConfig } from "@/core/config/config-schema";
import { getAppWidths } from "@/core/config/widths";
-import { useAppConfig, useResolvedMarimoConfig } from "@/core/config/config";
+import { saveAppConfig, saveUserConfig } from "@/core/network/requests";
import { useTheme } from "@/theme/useTheme";
+import type { ActionButton } from "./types";
export function useConfigActions() {
const { theme } = useTheme();
diff --git a/frontend/src/components/editor/actions/useHideAllMarkdownCode.ts b/frontend/src/components/editor/actions/useHideAllMarkdownCode.ts
index d3e5f0e3b8..6178c6a5e3 100644
--- a/frontend/src/components/editor/actions/useHideAllMarkdownCode.ts
+++ b/frontend/src/components/editor/actions/useHideAllMarkdownCode.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useCellActions } from "@/core/cells/cells";
-import { getNotebook } from "@/core/cells/cells";
-import { saveCellConfig } from "@/core/network/requests";
-import { useCallback } from "react";
-import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
+
+import { useCallback } from "react"; /* Copyright 2024 Marimo. All rights reserved. */
+import { getNotebook, useCellActions } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
+import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
+import { saveCellConfig } from "@/core/network/requests";
import type { CellConfig } from "@/core/network/types";
import { Objects } from "@/utils/objects";
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsx
index 4331050bb4..ac270e3e49 100644
--- a/frontend/src/components/editor/actions/useNotebookActions.tsx
+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx
@@ -1,47 +1,52 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { kioskModeAtom, viewStateAtom } from "@/core/mode";
-import { downloadBlob, downloadHTMLAsImage } from "@/utils/download";
+
import { useAtom, useAtomValue, useSetAtom } from "jotai";
+import { startCase } from "lodash-es";
import {
- ImageIcon,
- CommandIcon,
- ZapIcon,
- ZapOffIcon,
BookMarkedIcon,
- FolderDownIcon,
+ CheckIcon,
+ ChevronDownCircleIcon,
+ ChevronRightCircleIcon,
ClipboardCopyIcon,
- Share2Icon,
- PowerSquareIcon,
- GlobeIcon,
- LinkIcon,
- DownloadIcon,
CodeIcon,
- PanelLeftIcon,
- CheckIcon,
- KeyboardIcon,
- Undo2Icon,
- FileIcon,
- Home,
- PresentationIcon,
- EditIcon,
- LayoutTemplateIcon,
- Files,
- SettingsIcon,
- XCircleIcon,
- FilePlus2Icon,
- FastForwardIcon,
+ CommandIcon,
DatabaseIcon,
- EyeOffIcon,
+ DiamondPlusIcon,
+ DownloadIcon,
+ EditIcon,
ExternalLinkIcon,
+ EyeOffIcon,
+ FastForwardIcon,
+ FileIcon,
+ FilePlus2Icon,
+ Files,
FileTextIcon,
+ FolderDownIcon,
GithubIcon,
+ GlobeIcon,
+ Home,
+ ImageIcon,
+ KeyboardIcon,
+ LayoutTemplateIcon,
+ LinkIcon,
MessagesSquareIcon,
+ PanelLeftIcon,
+ PowerSquareIcon,
+ PresentationIcon,
+ SettingsIcon,
+ Share2Icon,
+ Undo2Icon,
+ XCircleIcon,
YoutubeIcon,
- DiamondPlusIcon,
- ChevronDownCircleIcon,
- ChevronRightCircleIcon,
+ ZapIcon,
+ ZapOffIcon,
} from "lucide-react";
-import { commandPaletteAtom } from "../controls/command-palette";
+import { settingDialogAtom } from "@/components/app-config/state";
+import { MarkdownIcon } from "@/components/editor/cell/code/icons";
+import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { renderShortcut } from "@/components/shortcuts/renderShortcut";
+import { ShareStaticNotebookModal } from "@/components/static-html/share-modal";
+import { toast } from "@/components/ui/use-toast";
import {
canUndoDeletesAtom,
getNotebook,
@@ -50,40 +55,36 @@ import {
useCellActions,
} from "@/core/cells/cells";
import { disabledCellIds, enabledCellIds } from "@/core/cells/utils";
+import { Constants } from "@/core/constants";
+import { useLayoutActions, useLayoutState } from "@/core/layout/layout";
+import { useTogglePresenting } from "@/core/layout/useTogglePresenting";
+import { kioskModeAtom, viewStateAtom } from "@/core/mode";
import {
exportAsMarkdown,
readCode,
saveCellConfig,
} from "@/core/network/requests";
-import { Objects } from "@/utils/objects";
-import type { ActionButton } from "./types";
-import { downloadAsHTML } from "@/core/static/download-html";
-import { toast } from "@/components/ui/use-toast";
import { useFilename } from "@/core/saving/filename";
-import { useImperativeModal } from "@/components/modal/ImperativeModal";
-import { ShareStaticNotebookModal } from "@/components/static-html/share-modal";
-import { useRestartKernel } from "./useRestartKernel";
+import { downloadAsHTML } from "@/core/static/download-html";
import { createShareableLink } from "@/core/wasm/share";
-import { useChromeActions, useChromeState } from "../chrome/state";
-import { PANELS } from "../chrome/types";
-import { startCase } from "lodash-es";
-import { keyboardShortcutsAtom } from "../controls/keyboard-shortcuts";
-import { MarkdownIcon } from "@/components/editor/cell/code/icons";
-import { Filenames } from "@/utils/filenames";
-import { LAYOUT_TYPES } from "../renderers/types";
-import { displayLayoutName, getLayoutIcon } from "../renderers/layout-select";
-import { useLayoutState, useLayoutActions } from "@/core/layout/layout";
-import { useTogglePresenting } from "@/core/layout/useTogglePresenting";
-import { useCopyNotebook } from "./useCopyNotebook";
import { isWasm } from "@/core/wasm/utils";
-import { renderShortcut } from "@/components/shortcuts/renderShortcut";
import { copyToClipboard } from "@/utils/copy";
+import { downloadBlob, downloadHTMLAsImage } from "@/utils/download";
+import { Filenames } from "@/utils/filenames";
+import { Objects } from "@/utils/objects";
import { newNotebookURL } from "@/utils/urls";
import { useRunAllCells } from "../cell/useRunCells";
-import { settingDialogAtom } from "@/components/app-config/state";
+import { useChromeActions, useChromeState } from "../chrome/state";
+import { PANELS } from "../chrome/types";
+import { commandPaletteAtom } from "../controls/command-palette";
+import { keyboardShortcutsAtom } from "../controls/keyboard-shortcuts";
import { AddDatabaseDialogContent } from "../database/add-database-form";
+import { displayLayoutName, getLayoutIcon } from "../renderers/layout-select";
+import { LAYOUT_TYPES } from "../renderers/types";
+import type { ActionButton } from "./types";
+import { useCopyNotebook } from "./useCopyNotebook";
import { useHideAllMarkdownCode } from "./useHideAllMarkdownCode";
-import { Constants } from "@/core/constants";
+import { useRestartKernel } from "./useRestartKernel";
const NOOP_HANDLER = (event?: Event) => {
event?.preventDefault();
diff --git a/frontend/src/components/editor/actions/useRestartKernel.tsx b/frontend/src/components/editor/actions/useRestartKernel.tsx
index 8aaa9d723c..3ca2143a58 100644
--- a/frontend/src/components/editor/actions/useRestartKernel.tsx
+++ b/frontend/src/components/editor/actions/useRestartKernel.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useSetAtom } from "jotai";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import { AlertDialogDestructiveAction } from "@/components/ui/alert-dialog";
import { connectionAtom } from "@/core/network/connection";
import { sendRestart } from "@/core/network/requests";
import { WebSocketState } from "@/core/websocket/types";
import { reloadSafe } from "@/utils/reload-safe";
-import { useSetAtom } from "jotai";
export function useRestartKernel() {
const { openConfirm } = useImperativeModal();
diff --git a/frontend/src/components/editor/ai/__tests__/completion-utils.test.ts b/frontend/src/components/editor/ai/__tests__/completion-utils.test.ts
index 779beeaa78..61d1473df3 100644
--- a/frontend/src/components/editor/ai/__tests__/completion-utils.test.ts
+++ b/frontend/src/components/editor/ai/__tests__/completion-utils.test.ts
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, beforeEach, it, expect, vi, type Mock } from "vitest";
-import { getAICompletionBody } from "../completion-utils";
+import { beforeEach, describe, expect, it, type Mock, vi } from "vitest";
import { getCodes } from "@/core/codemirror/copilot/getCodes";
-import { datasetsAtom } from "@/core/datasets/state";
-import { store } from "@/core/state/jotai";
-import type { DatasetsState } from "@/core/datasets/types";
import {
- dataSourceConnectionsAtom,
DUCKDB_ENGINE,
+ dataSourceConnectionsAtom,
} from "@/core/datasets/data-source-connections";
+import { datasetsAtom } from "@/core/datasets/state";
+import type { DatasetsState } from "@/core/datasets/types";
+import { store } from "@/core/state/jotai";
import { variablesAtom } from "@/core/variables/state";
import type { Variable, VariableName } from "@/core/variables/types";
+import { getAICompletionBody } from "../completion-utils";
// Mock getCodes function
vi.mock("@/core/codemirror/copilot/getCodes", () => ({
diff --git a/frontend/src/components/editor/ai/add-cell-with-ai.tsx b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
index 1bcf03dca1..fdb3e9fcfa 100644
--- a/frontend/src/components/editor/ai/add-cell-with-ai.tsx
+++ b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
@@ -1,49 +1,50 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useCellActions } from "../../../core/cells/cells";
-import { cn } from "@/utils/cn";
-import { Button } from "@/components/ui/button";
-import { ChevronsUpDown, Loader2Icon, SparklesIcon, XIcon } from "lucide-react";
-import { toast } from "@/components/ui/use-toast";
-import { prettyError } from "@/utils/errors";
-import { useCompletion } from "ai/react";
+
+import {
+ autocompletion,
+ type Completion,
+ type CompletionContext,
+ type CompletionSource,
+} from "@codemirror/autocomplete";
+import { sql } from "@codemirror/lang-sql";
+import { Prec } from "@codemirror/state";
import ReactCodeMirror, {
EditorView,
keymap,
minimalSetup,
type ReactCodeMirrorRef,
} from "@uiw/react-codemirror";
-import { Prec } from "@codemirror/state";
-import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
-import { useMemo, useState } from "react";
+import { useCompletion } from "ai/react";
import { useAtom, useAtomValue } from "jotai";
-import {
- autocompletion,
- type Completion,
- type CompletionContext,
- type CompletionSource,
-} from "@codemirror/autocomplete";
+import { atomWithStorage } from "jotai/utils";
+import { ChevronsUpDown, Loader2Icon, SparklesIcon, XIcon } from "lucide-react";
+import { useMemo, useState } from "react";
+import useEvent from "react-use-event-hook";
+import { Button } from "@/components/ui/button";
import {
DropdownMenu,
- DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { sql } from "@codemirror/lang-sql";
+import { toast } from "@/components/ui/use-toast";
+import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
-import { atomWithStorage } from "jotai/utils";
+import { allTablesAtom } from "@/core/datasets/data-source-connections";
+import { useRuntimeManager } from "@/core/runtime/config";
+import { variablesAtom } from "@/core/variables/state";
import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { prettyError } from "@/utils/errors";
+import { useCellActions } from "../../../core/cells/cells";
import {
getAICompletionBody,
mentionsCompletionSource,
} from "./completion-utils";
-import { allTablesAtom } from "@/core/datasets/data-source-connections";
-import { variablesAtom } from "@/core/variables/state";
import {
getTableMentionCompletions,
getVariableMentionCompletions,
} from "./completions";
-import useEvent from "react-use-event-hook";
-import { useRuntimeManager } from "@/core/runtime/config";
const pythonExtensions = [
customPythonLanguageSupport(),
diff --git a/frontend/src/components/editor/ai/ai-completion-editor.tsx b/frontend/src/components/editor/ai/ai-completion-editor.tsx
index e9d38ccaaa..5cf7cf408f 100644
--- a/frontend/src/components/editor/ai/ai-completion-editor.tsx
+++ b/frontend/src/components/editor/ai/ai-completion-editor.tsx
@@ -1,29 +1,30 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useEffect, useState } from "react";
-import CodeMirrorMerge from "react-codemirror-merge";
+
import { useCompletion } from "@ai-sdk/react";
import { EditorView } from "@codemirror/view";
-import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
-import { Button } from "@/components/ui/button";
import { Loader2Icon, SparklesIcon, XIcon } from "lucide-react";
+import React, { useEffect, useState } from "react";
+import CodeMirrorMerge from "react-codemirror-merge";
+import { Button } from "@/components/ui/button";
+import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
import "./merge-editor.css";
-import { cn } from "@/utils/cn";
-import { toast } from "@/components/ui/use-toast";
-import { prettyError } from "@/utils/errors";
+import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
+import { useAtom } from "jotai";
+import { Checkbox } from "@/components/ui/checkbox";
import { Label } from "@/components/ui/label";
import { Tooltip } from "@/components/ui/tooltip";
-import { useAtom } from "jotai";
+import { toast } from "@/components/ui/use-toast";
import { includeOtherCellsAtom } from "@/core/ai/state";
-import { Checkbox } from "@/components/ui/checkbox";
import { getCodes } from "@/core/codemirror/copilot/getCodes";
-import { useTheme } from "@/theme/useTheme";
import type { LanguageAdapterType } from "@/core/codemirror/language/types";
-import { PromptInput } from "./add-cell-with-ai";
-import { getAICompletionBody } from "./completion-utils";
-import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
import { selectAllText } from "@/core/codemirror/utils";
import { useRuntimeManager } from "@/core/runtime/config";
+import { useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { prettyError } from "@/utils/errors";
+import { PromptInput } from "./add-cell-with-ai";
+import { getAICompletionBody } from "./completion-utils";
const Original = CodeMirrorMerge.Original;
const Modified = CodeMirrorMerge.Modified;
diff --git a/frontend/src/components/editor/ai/completion-utils.ts b/frontend/src/components/editor/ai/completion-utils.ts
index d4c297de5d..3f70f75b8f 100644
--- a/frontend/src/components/editor/ai/completion-utils.ts
+++ b/frontend/src/components/editor/ai/completion-utils.ts
@@ -1,4 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type {
+ Completion,
+ CompletionContext,
+ CompletionSource,
+} from "@codemirror/autocomplete";
import { getCodes } from "@/core/codemirror/copilot/getCodes";
import { allTablesAtom } from "@/core/datasets/data-source-connections";
import type { DataTable } from "@/core/kernel/messages";
@@ -7,21 +13,15 @@ import { store } from "@/core/state/jotai";
import { variablesAtom } from "@/core/variables/state";
import type { Variable, VariableName } from "@/core/variables/types";
import { Logger } from "@/utils/Logger";
-import type {
- CompletionSource,
- Completion,
- CompletionContext,
-} from "@codemirror/autocomplete";
/**
* Gets the request body for the AI completion API.
*/
export function getAICompletionBody({
input,
-}: { input: string }): Omit<
- AiCompletionRequest,
- "language" | "prompt" | "code"
-> {
+}: {
+ input: string;
+}): Omit<AiCompletionRequest, "language" | "prompt" | "code"> {
const { datasets, variables } = extractDatasetsAndVariables(input);
Logger.debug("Included datasets", datasets);
Logger.debug("Included variables", variables);
diff --git a/frontend/src/components/editor/ai/completions.ts b/frontend/src/components/editor/ai/completions.ts
index e946a63a93..6a21b45094 100644
--- a/frontend/src/components/editor/ai/completions.ts
+++ b/frontend/src/components/editor/ai/completions.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { Completion } from "@codemirror/autocomplete";
import { getVariableCompletions } from "@/core/codemirror/completion/variable-completions";
import type { DatasetTablesMap } from "@/core/datasets/data-source-connections";
import type { DataTable } from "@/core/kernel/messages";
import type { Variables } from "@/core/variables/types";
-import type { Completion } from "@codemirror/autocomplete";
const Boosts = {
LOCAL_TABLE: 5,
diff --git a/frontend/src/components/editor/alerts/connecting-alert.tsx b/frontend/src/components/editor/alerts/connecting-alert.tsx
index 7e8a8f763d..9d6b8fdbbf 100644
--- a/frontend/src/components/editor/alerts/connecting-alert.tsx
+++ b/frontend/src/components/editor/alerts/connecting-alert.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useAtomValue } from "jotai";
-import { FloatingAlert } from "./floating-alert";
-import { isConnectingAtom } from "@/core/network/connection";
import { Spinner } from "@/components/icons/spinner";
+import { isConnectingAtom } from "@/core/network/connection";
+import { FloatingAlert } from "./floating-alert";
const DELAY_MS = 1000; // 1 second
diff --git a/frontend/src/components/editor/alerts/floating-alert.tsx b/frontend/src/components/editor/alerts/floating-alert.tsx
index e6599dc45b..cba667e092 100644
--- a/frontend/src/components/editor/alerts/floating-alert.tsx
+++ b/frontend/src/components/editor/alerts/floating-alert.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { ReactNode } from "react";
import { Banner } from "@/plugins/impl/common/error-banner";
import { DelayMount } from "../../utils/delay-mount";
-import type { ReactNode } from "react";
interface FloatingAlertProps {
title: string;
diff --git a/frontend/src/components/editor/alerts/stdin-blocking-alert.tsx b/frontend/src/components/editor/alerts/stdin-blocking-alert.tsx
index 1279118507..7f7ac66c22 100644
--- a/frontend/src/components/editor/alerts/stdin-blocking-alert.tsx
+++ b/frontend/src/components/editor/alerts/stdin-blocking-alert.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Button } from "../../ui/button";
-import { notebookAtom } from "@/core/cells/cells";
import { atom, useAtomValue } from "jotai";
+import { notebookAtom } from "@/core/cells/cells";
import { Logger } from "@/utils/Logger";
+import { Button } from "../../ui/button";
import { Kbd } from "../../ui/kbd";
import { FloatingAlert } from "./floating-alert";
diff --git a/frontend/src/components/editor/app-container.tsx b/frontend/src/components/editor/app-container.tsx
index 5f36c3488f..4b68d3a6dd 100644
--- a/frontend/src/components/editor/app-container.tsx
+++ b/frontend/src/components/editor/app-container.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
-import { cn } from "@/utils/cn";
+
import type React from "react";
import type { PropsWithChildren } from "react";
-import { StatusOverlay } from "./header/status";
import type { AppConfig } from "@/core/config/config-schema";
-import { WrappedWithSidebar } from "./renderers/vertical-layout/sidebar/wrapped-with-sidebar";
import { PyodideLoader } from "@/core/wasm/PyodideLoader";
+import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
+import { cn } from "@/utils/cn";
import { DynamicFavicon } from "./dynamic-favicon";
+import { StatusOverlay } from "./header/status";
+import { WrappedWithSidebar } from "./renderers/vertical-layout/sidebar/wrapped-with-sidebar";
interface Props {
connection: ConnectionStatus;
diff --git a/frontend/src/components/editor/boundary/ErrorBoundary.tsx b/frontend/src/components/editor/boundary/ErrorBoundary.tsx
index 75f0a226e0..983d93a43b 100644
--- a/frontend/src/components/editor/boundary/ErrorBoundary.tsx
+++ b/frontend/src/components/editor/boundary/ErrorBoundary.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PropsWithChildren } from "react";
import {
- ErrorBoundary as ReactErrorBoundary,
type FallbackProps,
+ ErrorBoundary as ReactErrorBoundary,
} from "react-error-boundary";
-import { Button } from "../../ui/button";
import { Constants } from "@/core/constants";
+import { Button } from "../../ui/button";
export const ErrorBoundary: React.FC<PropsWithChildren> = (props) => {
return (
diff --git a/frontend/src/components/editor/cell/CellStatus.tsx b/frontend/src/components/editor/cell/CellStatus.tsx
index db40ad2fbd..2a8b230a71 100644
--- a/frontend/src/components/editor/cell/CellStatus.tsx
+++ b/frontend/src/components/editor/cell/CellStatus.tsx
@@ -2,18 +2,18 @@
import {
BanIcon,
MoreHorizontalIcon,
- WorkflowIcon,
RefreshCwIcon,
+ WorkflowIcon,
} from "lucide-react";
-import { Tooltip } from "../../ui/tooltip";
+import { MultiIcon } from "@/components/icons/multi-icon";
+import { Logger } from "@/utils/Logger";
import type { CellRuntimeState } from "../../../core/cells/types";
import { useElapsedTime } from "../../../hooks/useElapsedTime";
-import { Logger } from "@/utils/Logger";
-import { MultiIcon } from "@/components/icons/multi-icon";
+import { Tooltip } from "../../ui/tooltip";
import "./cell-status.css";
-import { Time } from "@/utils/time";
import { formatDistanceToNow } from "date-fns";
+import { Time } from "@/utils/time";
export interface CellStatusComponentProps
extends Pick<
diff --git a/frontend/src/components/editor/cell/CreateCellButton.tsx b/frontend/src/components/editor/cell/CreateCellButton.tsx
index bc38da3255..1d2cd7f1ef 100644
--- a/frontend/src/components/editor/cell/CreateCellButton.tsx
+++ b/frontend/src/components/editor/cell/CreateCellButton.tsx
@@ -1,23 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { DatabaseIcon, PlusIcon } from "lucide-react";
import { Button } from "@/components/editor/inputs/Inputs";
-import { Tooltip } from "../../ui/tooltip";
import {
ContextMenu,
- ContextMenuTrigger,
ContextMenuContent,
ContextMenuItem,
+ ContextMenuTrigger,
} from "@/components/ui/context-menu";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { MarkdownIcon, PythonIcon } from "./code/icons";
import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
-import { cn } from "@/utils/cn";
-import { Events } from "@/utils/events";
-import type { WebSocketState } from "@/core/websocket/types";
import {
- isAppInteractionDisabled,
getConnectionTooltip,
+ isAppInteractionDisabled,
} from "@/core/websocket/connection-utils";
+import type { WebSocketState } from "@/core/websocket/types";
+import { cn } from "@/utils/cn";
+import { Events } from "@/utils/events";
+import { Tooltip } from "../../ui/tooltip";
+import { MarkdownIcon, PythonIcon } from "./code/icons";
export const CreateCellButton = ({
connectionState,
diff --git a/frontend/src/components/editor/cell/DeleteButton.tsx b/frontend/src/components/editor/cell/DeleteButton.tsx
index f15abadc48..78c7ecd7e9 100644
--- a/frontend/src/components/editor/cell/DeleteButton.tsx
+++ b/frontend/src/components/editor/cell/DeleteButton.tsx
@@ -1,18 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Trash2Icon } from "lucide-react";
-
+import type { JSX } from "react";
import type { RuntimeState } from "@/core/network/types";
-import { Tooltip } from "../../ui/tooltip";
-import { Button } from "../../ui/button";
-import { cn } from "@/utils/cn";
-import { Events } from "@/utils/events";
-import type { WebSocketState } from "@/core/websocket/types";
import {
- isAppInteractionDisabled,
getConnectionTooltip,
+ isAppInteractionDisabled,
} from "@/core/websocket/connection-utils";
-
-import type { JSX } from "react";
+import type { WebSocketState } from "@/core/websocket/types";
+import { cn } from "@/utils/cn";
+import { Events } from "@/utils/events";
+import { Button } from "../../ui/button";
+import { Tooltip } from "../../ui/tooltip";
export const DeleteButton = (props: {
status: RuntimeState;
diff --git a/frontend/src/components/editor/cell/RunButton.tsx b/frontend/src/components/editor/cell/RunButton.tsx
index dcc12973ea..eed00544d0 100644
--- a/frontend/src/components/editor/cell/RunButton.tsx
+++ b/frontend/src/components/editor/cell/RunButton.tsx
@@ -1,15 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { HardDriveDownloadIcon, PlayIcon } from "lucide-react";
-import { renderShortcut } from "../../shortcuts/renderShortcut";
-import type { RuntimeState, CellConfig } from "@/core/network/types";
-import { ToolbarItem } from "./toolbar";
-import type { WebSocketState } from "@/core/websocket/types";
+import type { JSX } from "react";
+import type { CellConfig, RuntimeState } from "@/core/network/types";
import {
- isAppInteractionDisabled,
getConnectionTooltip,
+ isAppInteractionDisabled,
} from "@/core/websocket/connection-utils";
-
-import type { JSX } from "react";
+import type { WebSocketState } from "@/core/websocket/types";
+import { renderShortcut } from "../../shortcuts/renderShortcut";
+import { ToolbarItem } from "./toolbar";
function computeColor(
connectionState: WebSocketState,
diff --git a/frontend/src/components/editor/cell/StopButton.tsx b/frontend/src/components/editor/cell/StopButton.tsx
index 6d85eeff7d..53b945dd67 100644
--- a/frontend/src/components/editor/cell/StopButton.tsx
+++ b/frontend/src/components/editor/cell/StopButton.tsx
@@ -1,15 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { SquareIcon } from "lucide-react";
-import { renderShortcut } from "../../shortcuts/renderShortcut";
+import type { JSX } from "react";
import { sendInterrupt } from "@/core/network/requests";
-import { useShouldShowInterrupt } from "./useShouldShowInterrupt";
import type { RuntimeState } from "@/core/network/types";
+import { isAppInteractionDisabled } from "@/core/websocket/connection-utils";
+import type { WebSocketState } from "@/core/websocket/types";
import { Functions } from "@/utils/functions";
+import { renderShortcut } from "../../shortcuts/renderShortcut";
import { ToolbarItem } from "./toolbar";
-import type { WebSocketState } from "@/core/websocket/types";
-import { isAppInteractionDisabled } from "@/core/websocket/connection-utils";
-
-import type { JSX } from "react";
+import { useShouldShowInterrupt } from "./useShouldShowInterrupt";
export const StopButton = (props: {
status: RuntimeState;
diff --git a/frontend/src/components/editor/cell/TinyCode.tsx b/frontend/src/components/editor/cell/TinyCode.tsx
index 64da99b73b..ea099fd912 100644
--- a/frontend/src/components/editor/cell/TinyCode.tsx
+++ b/frontend/src/components/editor/cell/TinyCode.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { memo } from "react";
-import CodeMirror, { minimalSetup } from "@uiw/react-codemirror";
+
import { python } from "@codemirror/lang-python";
+import CodeMirror, { minimalSetup } from "@uiw/react-codemirror";
+import React, { memo } from "react";
import "./TinyCode.css";
import { useTheme } from "@/theme/useTheme";
diff --git a/frontend/src/components/editor/cell/cell-actions.tsx b/frontend/src/components/editor/cell/cell-actions.tsx
index 3b51de40aa..e984d4d733 100644
--- a/frontend/src/components/editor/cell/cell-actions.tsx
+++ b/frontend/src/components/editor/cell/cell-actions.tsx
@@ -1,12 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
+
+import { CommandList } from "cmdk";
+import { useAtomValue } from "jotai";
+/* Copyright 2024 Marimo. All rights reserved. */
+import React, {
Fragment,
type PropsWithChildren,
useImperativeHandle,
useMemo,
useState,
} from "react";
-
+import {
+ renderMinimalShortcut,
+ renderShortcut,
+} from "@/components/shortcuts/renderShortcut";
import {
Command,
CommandEmpty,
@@ -26,21 +33,15 @@ import {
TooltipRoot,
TooltipTrigger,
} from "@/components/ui/tooltip";
-import {
- renderMinimalShortcut,
- renderShortcut,
-} from "@/components/shortcuts/renderShortcut";
-import React from "react";
-import {
- 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 type { CellId } from "@/core/cells/ids";
-import { CommandList } from "cmdk";
import { cn } from "@/utils/cn";
+import {
+ type CellActionButtonProps,
+ useCellActionButtons,
+} from "../actions/useCellActionButton";
+
interface Props extends CellActionButtonProps {
children: React.ReactNode;
showTooltip?: boolean;
diff --git a/frontend/src/components/editor/cell/cell-context-menu.tsx b/frontend/src/components/editor/cell/cell-context-menu.tsx
index c7bdf76b6c..df30b18ab1 100644
--- a/frontend/src/components/editor/cell/cell-context-menu.tsx
+++ b/frontend/src/components/editor/cell/cell-context-menu.tsx
@@ -1,18 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { Fragment } from "react";
-import {
- type CellActionButtonProps,
- useCellActionButtons,
-} from "../actions/useCellActionButton";
-import {
- ContextMenu,
- ContextMenuTrigger,
- ContextMenuContent,
- ContextMenuItem,
- ContextMenuSeparator,
-} from "@/components/ui/context-menu";
-import { renderMinimalShortcut } from "@/components/shortcuts/renderShortcut";
-import type { ActionButton } from "../actions/types";
+
import {
ClipboardCopyIcon,
ClipboardPasteIcon,
@@ -21,13 +8,27 @@ import {
ScissorsIcon,
SearchIcon,
} from "lucide-react";
-import { goToDefinitionAtCursorPosition } from "@/core/codemirror/go-to-definition/utils";
-import { CellOutputId } from "@/core/cells/ids";
-import { Logger } from "@/utils/Logger";
-import { copyToClipboard } from "@/utils/copy";
+import React, { Fragment } from "react";
+import { renderMinimalShortcut } from "@/components/shortcuts/renderShortcut";
+import {
+ ContextMenu,
+ ContextMenuContent,
+ ContextMenuItem,
+ ContextMenuSeparator,
+ ContextMenuTrigger,
+} from "@/components/ui/context-menu";
+import { Tooltip } from "@/components/ui/tooltip";
import { toast } from "@/components/ui/use-toast";
+import { CellOutputId } from "@/core/cells/ids";
+import { goToDefinitionAtCursorPosition } from "@/core/codemirror/go-to-definition/utils";
import { sendToPanelManager } from "@/core/vscode/vscode-bindings";
-import { Tooltip } from "@/components/ui/tooltip";
+import { copyToClipboard } from "@/utils/copy";
+import { Logger } from "@/utils/Logger";
+import type { ActionButton } from "../actions/types";
+import {
+ type CellActionButtonProps,
+ useCellActionButtons,
+} from "../actions/useCellActionButton";
interface Props extends CellActionButtonProps {
children: React.ReactNode;
diff --git a/frontend/src/components/editor/cell/code/cell-editor.tsx b/frontend/src/components/editor/cell/code/cell-editor.tsx
index 2dc8ba357c..51630e6215 100644
--- a/frontend/src/components/editor/cell/code/cell-editor.tsx
+++ b/frontend/src/components/editor/cell/code/cell-editor.tsx
@@ -2,47 +2,46 @@
import { historyField } from "@codemirror/commands";
import { EditorState, StateEffect } from "@codemirror/state";
import { EditorView, ViewPlugin } from "@codemirror/view";
-import React, { memo, useEffect, useRef, useMemo } from "react";
-
-import { setupCodeMirror } from "@/core/codemirror/cm";
+import { useAtom, useAtomValue } from "jotai";
+import React, { memo, useEffect, useMemo, useRef } from "react";
import useEvent from "react-use-event-hook";
+import { Button } from "@/components/ui/button";
+import { DelayMount } from "@/components/utils/delay-mount";
+import { aiCompletionCellAtom } from "@/core/ai/state";
+import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
import { notebookAtom, useCellActions } from "@/core/cells/cells";
-import type { CellRuntimeState, CellData } from "@/core/cells/types";
-import type { UserConfig } from "@/core/config/config-schema";
-import type { Theme } from "@/theme/useTheme";
+import { useSetLastFocusedCellId } from "@/core/cells/focus";
+import type { CellData, CellRuntimeState } from "@/core/cells/types";
+import { setupCodeMirror } from "@/core/codemirror/cm";
import {
getInitialLanguageAdapter,
languageAdapterState,
reconfigureLanguageEffect,
switchLanguage,
} from "@/core/codemirror/language/extension";
-import { LanguageToggles } from "./language-toggle";
-import { cn } from "@/utils/cn";
-import { saveCellConfig } from "@/core/network/requests";
-import { HideCodeButton } from "../../code/readonly-python-code";
-import { AiCompletionEditor } from "../../ai/ai-completion-editor";
-import { useAtom, useAtomValue } from "jotai";
-import { aiCompletionCellAtom } from "@/core/ai/state";
-import { mergeRefs } from "@/utils/mergeRefs";
-import { useSetLastFocusedCellId } from "@/core/cells/focus";
import type { LanguageAdapterType } from "@/core/codemirror/language/types";
-import { autoInstantiateAtom, isAiEnabled } from "@/core/config/config";
-import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
-import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { useSplitCellCallback } from "../useSplitCell";
-import { invariant } from "@/utils/invariant";
-import { connectionAtom } from "@/core/network/connection";
-import { WebSocketState } from "@/core/websocket/types";
import {
connectedDocAtom,
realTimeCollaboration,
} from "@/core/codemirror/rtc/extension";
+import { autoInstantiateAtom, isAiEnabled } from "@/core/config/config";
+import type { UserConfig } from "@/core/config/config-schema";
+import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { connectionAtom } from "@/core/network/connection";
+import { saveCellConfig } from "@/core/network/requests";
+import { isRtcEnabled } from "@/core/rtc/state";
+import { useSaveNotebook } from "@/core/saving/save-component";
import { store } from "@/core/state/jotai";
+import { WebSocketState } from "@/core/websocket/types";
+import type { Theme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { invariant } from "@/utils/invariant";
+import { mergeRefs } from "@/utils/mergeRefs";
+import { AiCompletionEditor } from "../../ai/ai-completion-editor";
+import { HideCodeButton } from "../../code/readonly-python-code";
import { useDeleteCellCallback } from "../useDeleteCell";
-import { useSaveNotebook } from "@/core/saving/save-component";
-import { DelayMount } from "@/components/utils/delay-mount";
-import { Button } from "@/components/ui/button";
-import { isRtcEnabled } from "@/core/rtc/state";
+import { useSplitCellCallback } from "../useSplitCell";
+import { LanguageToggles } from "./language-toggle";
export interface CellEditorProps
extends Pick<CellRuntimeState, "status">,
@@ -518,6 +517,7 @@ CellCodeMirrorEditor.displayName = "CellCodeMirrorEditor";
function WithWaitUntilConnected<T extends {}>(
Component: React.ComponentType<T>,
) {
+ // biome-ignore lint/nursery/noNestedComponentDefinitions: this is evaluated top-level
const WaitUntilConnectedComponent = (props: T) => {
const connection = useAtomValue(connectionAtom);
const [rtcDoc, setRtcDoc] = useAtom(connectedDocAtom);
diff --git a/frontend/src/components/editor/cell/code/language-toggle.tsx b/frontend/src/components/editor/cell/code/language-toggle.tsx
index 8c8795091a..40dcb8b816 100644
--- a/frontend/src/components/editor/cell/code/language-toggle.tsx
+++ b/frontend/src/components/editor/cell/code/language-toggle.tsx
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { switchLanguage } from "@/core/codemirror/language/extension";
+
import type { EditorView } from "@codemirror/view";
+import { DatabaseIcon } from "lucide-react";
import type React from "react";
-import { MarkdownIcon, PythonIcon } from "./icons";
+import { useMemo } from "react";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
-import type { LanguageAdapter } from "@/core/codemirror/language/types";
-import { DatabaseIcon } from "lucide-react";
-import { useMemo } from "react";
+import { switchLanguage } from "@/core/codemirror/language/extension";
import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import type { LanguageAdapter } from "@/core/codemirror/language/types";
import { Functions } from "@/utils/functions";
+import { MarkdownIcon, PythonIcon } from "./icons";
interface LanguageTogglesProps {
editorView: EditorView | null;
diff --git a/frontend/src/components/editor/cell/collapse.tsx b/frontend/src/components/editor/cell/collapse.tsx
index a48c52b594..39c46d4d72 100644
--- a/frontend/src/components/editor/cell/collapse.tsx
+++ b/frontend/src/components/editor/cell/collapse.tsx
@@ -1,11 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-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 type { CellId } from "@/core/cells/ids";
-import { getDescendantsStatus } from "@/core/cells/utils";
-import { cn } from "@/utils/cn";
+
import {
AlertOctagonIcon,
ChevronDownIcon,
@@ -16,6 +10,13 @@ import {
} from "lucide-react";
import type React from "react";
import { memo } from "react";
+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 type { CellId } from "@/core/cells/ids";
+import { getDescendantsStatus } from "@/core/cells/utils";
+import { cn } from "@/utils/cn";
interface Props {
isCollapsed: boolean;
diff --git a/frontend/src/components/editor/cell/toolbar.tsx b/frontend/src/components/editor/cell/toolbar.tsx
index ca45ac2bc3..717b9825e5 100644
--- a/frontend/src/components/editor/cell/toolbar.tsx
+++ b/frontend/src/components/editor/cell/toolbar.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { cva, type VariantProps } from "class-variance-authority";
import React from "react";
+import { Toolbar as ReactAriaToolbar } from "react-aria-components";
import { Tooltip } from "@/components/ui/tooltip";
import { cn } from "@/utils/cn";
-import { Toolbar as ReactAriaToolbar } from "react-aria-components";
-import { cva, type VariantProps } from "class-variance-authority";
import { Events } from "@/utils/events";
const toolbarItemVariants = cva(
diff --git a/frontend/src/components/editor/cell/useDeleteCell.tsx b/frontend/src/components/editor/cell/useDeleteCell.tsx
index cc3b43a864..1411645fbd 100644
--- a/frontend/src/components/editor/cell/useDeleteCell.tsx
+++ b/frontend/src/components/editor/cell/useDeleteCell.tsx
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import useEvent from "react-use-event-hook";
import { UndoButton } from "@/components/buttons/undo-button";
import { toast } from "@/components/ui/use-toast";
import {
- notebookAtom,
hasOnlyOneCellAtom,
+ notebookAtom,
useCellActions,
} from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
import { sendDeleteCell } from "@/core/network/requests";
import { store } from "@/core/state/jotai";
-import useEvent from "react-use-event-hook";
export function useDeleteCellCallback() {
const { deleteCell, undoDeleteCell } = useCellActions();
diff --git a/frontend/src/components/editor/cell/useRunCells.ts b/frontend/src/components/editor/cell/useRunCells.ts
index d51a79dba7..58483c1e22 100644
--- a/frontend/src/components/editor/cell/useRunCells.ts
+++ b/frontend/src/components/editor/cell/useRunCells.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellId } from "@/core/cells/ids";
-import { sendRun } from "@/core/network/requests";
-import { getNotebook, useCellActions } from "@/core/cells/cells";
+
+import { closeCompletion } from "@codemirror/autocomplete";
import useEvent from "react-use-event-hook";
-import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
-import { Logger } from "@/utils/Logger";
+import { getNotebook, useCellActions } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
import { enabledCellIds, staleCellIds } from "@/core/cells/utils";
import { getCurrentLanguageAdapter } from "@/core/codemirror/language/commands";
-import { closeCompletion } from "@codemirror/autocomplete";
+import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
+import { sendRun } from "@/core/network/requests";
+import { Logger } from "@/utils/Logger";
/**
* Creates a function that runs all cells that have been edited or interrupted.
diff --git a/frontend/src/components/editor/cell/useShouldShowInterrupt.ts b/frontend/src/components/editor/cell/useShouldShowInterrupt.ts
index 53a61ebec8..1637d95381 100644
--- a/frontend/src/components/editor/cell/useShouldShowInterrupt.ts
+++ b/frontend/src/components/editor/cell/useShouldShowInterrupt.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState, useEffect } from "react";
+import { useEffect, useState } from "react";
const DELAY_MS = 200;
diff --git a/frontend/src/components/editor/cell/useSplitCell.tsx b/frontend/src/components/editor/cell/useSplitCell.tsx
index 8c2636b93e..b7a3dc4a6d 100644
--- a/frontend/src/components/editor/cell/useSplitCell.tsx
+++ b/frontend/src/components/editor/cell/useSplitCell.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import useEvent from "react-use-event-hook";
import { UndoButton } from "@/components/buttons/undo-button";
import { toast } from "@/components/ui/use-toast";
import { getCellEditorView, useCellActions } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
import { getEditorCodeAsPython } from "@/core/codemirror/language/utils";
-import useEvent from "react-use-event-hook";
export function useSplitCellCallback() {
const { splitCell, undoSplitCell } = useCellActions();
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 58974bbf18..8c5adf4bb8 100644
--- a/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx
+++ b/frontend/src/components/editor/chrome/components/contribute-snippet-button.tsx
@@ -1,23 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { EditorView } from "@codemirror/view";
+import { Slot } from "@radix-ui/react-slot";
+import React, { type PropsWithChildren, useState } from "react";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { Button } from "@/components/ui/button";
import {
- DialogFooter,
DialogContent,
+ DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
- DialogDescription,
} from "@/components/ui/dialog";
-import { Slot } from "@radix-ui/react-slot";
-import React, { type PropsWithChildren } from "react";
-import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
import { Constants } from "@/core/constants";
-import { Input } from "@/components/ui/input";
-import { EditorView } from "@codemirror/view";
-import { useState } from "react";
-import { useTheme } from "@/theme/useTheme";
import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
+import { useTheme } from "@/theme/useTheme";
export const ContributeSnippetButton: React.FC<PropsWithChildren> = ({
children,
diff --git a/frontend/src/components/editor/chrome/components/feedback-button.tsx b/frontend/src/components/editor/chrome/components/feedback-button.tsx
index 94458c095f..93ca06a92e 100644
--- a/frontend/src/components/editor/chrome/components/feedback-button.tsx
+++ b/frontend/src/components/editor/chrome/components/feedback-button.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Slot } from "@radix-ui/react-slot";
+import React, { type PropsWithChildren } from "react";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import {
DialogContent,
+ DialogDescription,
DialogHeader,
DialogTitle,
- DialogDescription,
} from "@/components/ui/dialog";
-import { Slot } from "@radix-ui/react-slot";
-import React, { type PropsWithChildren } from "react";
import { toast } from "@/components/ui/use-toast";
import { Constants } from "@/core/constants";
diff --git a/frontend/src/components/editor/chrome/panels/__tests__/write-secret-modal.test.ts b/frontend/src/components/editor/chrome/panels/__tests__/write-secret-modal.test.ts
index 2022f9968e..f9b5f73a93 100644
--- a/frontend/src/components/editor/chrome/panels/__tests__/write-secret-modal.test.ts
+++ b/frontend/src/components/editor/chrome/panels/__tests__/write-secret-modal.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { replaceInvalid } from "../write-secret-modal";
describe("replaceInvalid", () => {
diff --git a/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx b/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
index 1006624148..8e9f95c5dc 100644
--- a/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx
@@ -1,24 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SlotNames } from "@/core/slots/slots";
import { Fill, Slot, useSlot } from "@marimo-team/react-slotz";
import { useAtom } from "jotai";
+import { CrosshairIcon, PinIcon, PinOffIcon, XIcon } from "lucide-react";
import type { PropsWithChildren } from "react";
-import { PanelResizeHandle, Panel } from "react-resizable-panels";
-import { handleDragging } from "../../wrapper/utils";
-import { useResizeHandle } from "@/hooks/useResizeHandle";
-
-import { PinIcon, PinOffIcon, XIcon, CrosshairIcon } from "lucide-react";
-import { Tooltip } from "@/components/ui/tooltip";
+import { Panel, PanelResizeHandle } from "react-resizable-panels";
import { Button } from "@/components/ui/button";
import { Toggle } from "@/components/ui/toggle";
-import { ErrorBoundary } from "../../../boundary/ErrorBoundary";
+import { Tooltip } from "@/components/ui/tooltip";
+import { SlotNames } from "@/core/slots/slots";
+import { useResizeHandle } from "@/hooks/useResizeHandle";
import { cn } from "@/utils/cn";
+import { ErrorBoundary } from "../../../boundary/ErrorBoundary";
+import { handleDragging } from "../../wrapper/utils";
import {
+ contextAwarePanelOpen,
contextAwarePanelOwner,
isCellAwareAtom,
isPinnedAtom,
- contextAwarePanelOpen,
} from "./atoms";
export type PanelType = "row-viewer" | "column-explorer";
diff --git a/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx b/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
index e1358973ec..8d05b057a0 100644
--- a/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/dependency-graph-panel.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type React from "react";
import { useCellDataAtoms, useCellIds } from "@/core/cells/cells";
import { useVariables } from "@/core/variables/state";
-import type React from "react";
-import { DependencyGraph } from "../../../dependency-graph/dependency-graph";
import { cn } from "@/utils/cn";
+import { DependencyGraph } from "../../../dependency-graph/dependency-graph";
export const DependencyGraphPanel: React.FC = () => {
const variables = useVariables();
diff --git a/frontend/src/components/editor/chrome/panels/documentation-panel.tsx b/frontend/src/components/editor/chrome/panels/documentation-panel.tsx
index 5b18815fc9..3a0e3f6ec7 100644
--- a/frontend/src/components/editor/chrome/panels/documentation-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/documentation-panel.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { documentationAtom } from "@/core/documentation/state";
-import { renderHTML } from "@/plugins/core/RenderHTML";
+
import { useAtomValue } from "jotai";
import React from "react";
+import { documentationAtom } from "@/core/documentation/state";
+import { renderHTML } from "@/plugins/core/RenderHTML";
import "../../documentation.css";
import { TextSearchIcon } from "lucide-react";
import { PanelEmptyState } from "./empty-state";
diff --git a/frontend/src/components/editor/chrome/panels/error-panel.tsx b/frontend/src/components/editor/chrome/panels/error-panel.tsx
index d87f82f149..c85d7a445e 100644
--- a/frontend/src/components/editor/chrome/panels/error-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/error-panel.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { PartyPopperIcon } from "lucide-react";
import React from "react";
+import { CellLinkError } from "@/components/editor/links/cell-link";
import { useCellErrors } from "../../../../core/cells/cells";
import { MarimoErrorOutput } from "../../output/MarimoErrorOutput";
-import { CellLinkError } from "@/components/editor/links/cell-link";
-import { PartyPopperIcon } from "lucide-react";
import { PanelEmptyState } from "./empty-state";
export const ErrorsPanel: React.FC = () => {
diff --git a/frontend/src/components/editor/chrome/panels/file-explorer-panel.tsx b/frontend/src/components/editor/chrome/panels/file-explorer-panel.tsx
index 48713200a8..e375113ae2 100644
--- a/frontend/src/components/editor/chrome/panels/file-explorer-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/file-explorer-panel.tsx
@@ -2,8 +2,8 @@
import React from "react";
import useResizeObserver from "use-resize-observer";
-import { FileExplorer } from "../../file-tree/file-explorer";
import { cn } from "@/utils/cn";
+import { FileExplorer } from "../../file-tree/file-explorer";
import { useFileExplorerUpload } from "../../file-tree/upload";
export const FileExplorerPanel: React.FC = () => {
diff --git a/frontend/src/components/editor/chrome/panels/logs-panel.tsx b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
index 40be0b1bdf..bee3b968b7 100644
--- a/frontend/src/components/editor/chrome/panels/logs-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/logs-panel.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { FileTextIcon } from "lucide-react";
+import React from "react";
+import { ClearButton } from "@/components/buttons/clear-button";
import { useCellActions, useCellLogs } from "@/core/cells/cells";
import { type CellLog, formatLogTimestamp } from "@/core/cells/logs";
import { cn } from "@/utils/cn";
-import React from "react";
-import { FileTextIcon } from "lucide-react";
import { CellLink } from "../../links/cell-link";
import { PanelEmptyState } from "./empty-state";
-import { ClearButton } from "@/components/buttons/clear-button";
interface Props {
className?: string;
diff --git a/frontend/src/components/editor/chrome/panels/outline-panel.tsx b/frontend/src/components/editor/chrome/panels/outline-panel.tsx
index 6337a0c98d..1d989ae5e2 100644
--- a/frontend/src/components/editor/chrome/panels/outline-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline-panel.tsx
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useMemo } from "react";
-import { notebookOutline } from "../../../../core/cells/cells";
+
import { useAtomValue } from "jotai";
import { ScrollTextIcon } from "lucide-react";
+import React, { useMemo } from "react";
+import { notebookOutline } from "../../../../core/cells/cells";
import { PanelEmptyState } from "./empty-state";
import "./outline-panel.css";
+import { OutlineList } from "./outline/floating-outline";
import {
findOutlineElements,
useActiveOutline,
} from "./outline/useActiveOutline";
-import { OutlineList } from "./outline/floating-outline";
export const OutlinePanel: React.FC = () => {
const { items } = useAtomValue(notebookOutline);
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 a052355bfe..f11fc710b5 100644
--- a/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline/floating-outline.tsx
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { notebookOutline } from "@/core/cells/cells";
-import { cn } from "@/utils/cn";
+
import { useAtomValue } from "jotai";
import React from "react";
+import { notebookOutline } from "@/core/cells/cells";
+import type { OutlineItem } from "@/core/cells/outline";
+import { cn } from "@/utils/cn";
import {
- useActiveOutline,
- scrollToOutlineItem,
findOutlineElements,
+ scrollToOutlineItem,
+ useActiveOutline,
} from "./useActiveOutline";
-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 e3e45b3b6c..7ea5bb7510 100644
--- a/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx
+++ b/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useEffect, useRef, useState } from "react";
import type { OutlineItem } from "@/core/cells/outline";
import { headingToIdentifier } from "@/core/dom/outline";
import { getInitialAppMode } from "@/core/mode";
import { Logger } from "@/utils/Logger";
-import { useEffect, useRef, useState } from "react";
function getRootScrollableElement() {
// HACK: this is a bit leaky
diff --git a/frontend/src/components/editor/chrome/panels/packages-panel.tsx b/frontend/src/components/editor/chrome/panels/packages-panel.tsx
index 4986679bdf..d3f1a1fae8 100644
--- a/frontend/src/components/editor/chrome/panels/packages-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/packages-panel.tsx
@@ -1,17 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
-import { BoxIcon, HelpCircleIcon } from "lucide-react";
-import { PanelEmptyState } from "./empty-state";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { useResolvedMarimoConfig } from "@/core/config/config";
-import {
- addPackage,
- getPackageList,
- removePackage,
-} from "@/core/network/requests";
-import { ErrorBanner } from "@/plugins/impl/common/error-banner";
+import { useAtomValue, useSetAtom } from "jotai";
+import { BoxIcon, HelpCircleIcon } from "lucide-react";
+import React from "react";
+import { useOpenSettingsToTab } from "@/components/app-config/state";
import { Spinner } from "@/components/icons/spinner";
+import { SearchInput } from "@/components/ui/input";
+import { Kbd } from "@/components/ui/kbd";
import {
Table,
TableBody,
@@ -20,18 +15,23 @@ import {
TableHeader,
TableRow,
} from "@/components/ui/table";
-import { SearchInput } from "@/components/ui/input";
-import { toast } from "@/components/ui/use-toast";
import { Tooltip } from "@/components/ui/tooltip";
+import { toast } from "@/components/ui/use-toast";
+import { useResolvedMarimoConfig } from "@/core/config/config";
+import {
+ addPackage,
+ getPackageList,
+ removePackage,
+} from "@/core/network/requests";
+import { isWasm } from "@/core/wasm/utils";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { ErrorBanner } from "@/plugins/impl/common/error-banner";
import { cn } from "@/utils/cn";
-import { Kbd } from "@/components/ui/kbd";
-import { Events } from "@/utils/events";
import { copyToClipboard } from "@/utils/copy";
+import { Events } from "@/utils/events";
import { PACKAGES_INPUT_ID } from "./constants";
-import { useOpenSettingsToTab } from "@/components/app-config/state";
+import { PanelEmptyState } from "./empty-state";
import { packagesToInstallAtom } from "./packages-state";
-import { useAtomValue, useSetAtom } from "jotai";
-import { isWasm } from "@/core/wasm/utils";
const showAddPackageToast = (packageName: string, error?: string | null) => {
if (error) {
diff --git a/frontend/src/components/editor/chrome/panels/scratchpad-panel.tsx b/frontend/src/components/editor/chrome/panels/scratchpad-panel.tsx
index 30351ae536..179f4745db 100644
--- a/frontend/src/components/editor/chrome/panels/scratchpad-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/scratchpad-panel.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ScratchPad } from "@/components/scratchpad/scratchpad";
+
import type React from "react";
+import { ScratchPad } from "@/components/scratchpad/scratchpad";
export const ScratchpadPanel: React.FC = () => {
return <ScratchPad />;
diff --git a/frontend/src/components/editor/chrome/panels/secrets-panel.tsx b/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
index c9bde3a1a6..a4b7d27ba6 100644
--- a/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/secrets-panel.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { CheckIcon, CopyIcon, KeyIcon, PlusIcon } from "lucide-react";
-import { useAsyncData } from "@/hooks/useAsyncData";
+import React from "react";
import { Spinner } from "@/components/icons/spinner";
-import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import { PanelEmptyState } from "./empty-state";
+import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { Badge } from "@/components/ui/badge";
import {
Table,
TableBody,
@@ -14,11 +14,12 @@ import {
TableRow,
} from "@/components/ui/table";
import { toast } from "@/components/ui/use-toast";
-import { copyToClipboard } from "@/utils/copy";
-import { cn } from "@/utils/cn";
import { SECRETS_REGISTRY } from "@/core/secrets/request-registry";
-import { Badge } from "@/components/ui/badge";
-import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { ErrorBanner } from "@/plugins/impl/common/error-banner";
+import { cn } from "@/utils/cn";
+import { copyToClipboard } from "@/utils/copy";
+import { PanelEmptyState } from "./empty-state";
import { sortProviders, WriteSecretModal } from "./write-secret-modal";
export const SecretsPanel: React.FC = () => {
diff --git a/frontend/src/components/editor/chrome/panels/snippets-panel.tsx b/frontend/src/components/editor/chrome/panels/snippets-panel.tsx
index 898296db9d..68ad75fcb1 100644
--- a/frontend/src/components/editor/chrome/panels/snippets-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/snippets-panel.tsx
@@ -1,33 +1,34 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
+import { CommandList } from "cmdk";
import { BetweenHorizontalStartIcon, PlusIcon } from "lucide-react";
-import { PanelEmptyState } from "./empty-state";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import type { Snippet } from "@/core/network/types";
-import { renderHTML } from "@/plugins/core/RenderHTML";
-import { readSnippets } from "@/core/network/requests";
+import React from "react";
import {
Command,
CommandEmpty,
CommandInput,
CommandItem,
} from "@/components/ui/command";
-import { CommandList } from "cmdk";
+import { readSnippets } from "@/core/network/requests";
+import type { Snippet } from "@/core/network/types";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { renderHTML } from "@/plugins/core/RenderHTML";
+import { ErrorBanner } from "@/plugins/impl/common/error-banner";
+import { PanelEmptyState } from "./empty-state";
import "./snippets-panel.css";
-import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
-import { useTheme } from "@/theme/useTheme";
import { EditorView } from "@codemirror/view";
import { Suspense } from "react";
+import { Spinner } from "@/components/icons/spinner";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
-import { useLastFocusedCellId } from "@/core/cells/focus";
import { useCellActions } from "@/core/cells/cells";
+import { useLastFocusedCellId } from "@/core/cells/focus";
+import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
+import { useTheme } from "@/theme/useTheme";
import { cn } from "@/utils/cn";
-import { ContributeSnippetButton } from "../components/contribute-snippet-button";
-import { Spinner } from "@/components/icons/spinner";
import { HideInKioskMode } from "../../kiosk-mode";
+import { ContributeSnippetButton } from "../components/contribute-snippet-button";
const extensions = [EditorView.lineWrapping];
diff --git a/frontend/src/components/editor/chrome/panels/tracing-panel.tsx b/frontend/src/components/editor/chrome/panels/tracing-panel.tsx
index c8812d2178..8d84135e64 100644
--- a/frontend/src/components/editor/chrome/panels/tracing-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/tracing-panel.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Spinner } from "@/components/icons/spinner";
+
import React from "react";
+import { Spinner } from "@/components/icons/spinner";
const LazyTracing = React.lazy(() =>
import("@/components/tracing/tracing").then((module) => {
diff --git a/frontend/src/components/editor/chrome/panels/variable-panel.tsx b/frontend/src/components/editor/chrome/panels/variable-panel.tsx
index c62ac0cf59..d777250258 100644
--- a/frontend/src/components/editor/chrome/panels/variable-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/variable-panel.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { FunctionSquareIcon } from "lucide-react";
+import type React from "react";
import { VariableTable } from "@/components/variables/variables-table";
import { useCellIds } from "@/core/cells/cells";
import { useVariables } from "@/core/variables/state";
-import type React from "react";
import { PanelEmptyState } from "./empty-state";
-import { FunctionSquareIcon } from "lucide-react";
export const VariablePanel: React.FC = () => {
const variables = useVariables();
diff --git a/frontend/src/components/editor/chrome/panels/write-secret-modal.tsx b/frontend/src/components/editor/chrome/panels/write-secret-modal.tsx
index eef0d5f908..c2126cd603 100644
--- a/frontend/src/components/editor/chrome/panels/write-secret-modal.tsx
+++ b/frontend/src/components/editor/chrome/panels/write-secret-modal.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React from "react";
-import { toast } from "@/components/ui/use-toast";
import { Button } from "@/components/ui/button";
import {
DialogContent,
- DialogHeader,
- DialogTitle,
DialogDescription,
DialogFooter,
+ DialogHeader,
+ DialogTitle,
} from "@/components/ui/dialog";
+import { FormDescription } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import { writeSecret } from "@/core/network/requests";
+import { ExternalLink } from "@/components/ui/links";
import {
Select,
SelectContent,
@@ -19,8 +19,8 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { FormDescription } from "@/components/ui/field";
-import { ExternalLink } from "@/components/ui/links";
+import { toast } from "@/components/ui/use-toast";
+import { writeSecret } from "@/core/network/requests";
import type { ListSecretKeysResponse } from "@/core/network/types";
// dotenv providers should be at the top
diff --git a/frontend/src/components/editor/chrome/state.ts b/frontend/src/components/editor/chrome/state.ts
index 00450ee71f..e95f46c1df 100644
--- a/frontend/src/components/editor/chrome/state.ts
+++ b/frontend/src/components/editor/chrome/state.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { createReducerAndAtoms } from "@/utils/createReducer";
+
import { useAtomValue } from "jotai";
-import type { PanelType } from "./types";
-import { ZodLocalStorage } from "@/utils/localStorage";
import { z } from "zod";
+import { createReducerAndAtoms } from "@/utils/createReducer";
+import { ZodLocalStorage } from "@/utils/localStorage";
+import type { PanelType } from "./types";
export interface ChromeState {
selectedPanel: PanelType | undefined;
diff --git a/frontend/src/components/editor/chrome/types.ts b/frontend/src/components/editor/chrome/types.ts
index b3d854292e..97436b6fd6 100644
--- a/frontend/src/components/editor/chrome/types.ts
+++ b/frontend/src/components/editor/chrome/types.ts
@@ -1,22 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { isWasm } from "@/core/wasm/utils";
+
import {
- XCircleIcon,
+ ActivityIcon,
+ BotMessageSquareIcon,
+ BoxIcon,
+ DatabaseIcon,
+ FileTextIcon,
FolderTreeIcon,
FunctionSquareIcon,
+ KeyRoundIcon,
+ type LucideIcon,
NetworkIcon,
+ NotebookPenIcon,
ScrollTextIcon,
- TextSearchIcon,
- FileTextIcon,
- type LucideIcon,
SquareDashedBottomCodeIcon,
- DatabaseIcon,
- NotebookPenIcon,
- BoxIcon,
- BotMessageSquareIcon,
- ActivityIcon,
- KeyRoundIcon,
+ TextSearchIcon,
+ XCircleIcon,
} from "lucide-react";
+import { isWasm } from "@/core/wasm/utils";
export type PanelType =
| "files"
diff --git a/frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts b/frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts
index cdfd0be4a8..cac5386aab 100644
--- a/frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts
+++ b/frontend/src/components/editor/chrome/wrapper/__tests__/storage.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeEach, expect, describe, it } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
import { createStorage } from "../storage";
describe("createStorage", () => {
diff --git a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
index 21de8b0be1..4d96af9dae 100644
--- a/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/app-chrome.tsx
@@ -1,40 +1,40 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, useEffect, Suspense } from "react";
+import React, { type PropsWithChildren, Suspense, useEffect } from "react";
import {
- PanelGroup,
+ type ImperativePanelHandle,
Panel,
+ PanelGroup,
PanelResizeHandle,
- type ImperativePanelHandle,
} from "react-resizable-panels";
import { Footer } from "./footer";
import { Sidebar } from "./sidebar";
import "./app-chrome.css";
-import { useChromeActions, useChromeState } from "../state";
-import { cn } from "@/utils/cn";
-import { createStorage } from "./storage";
-import { Button } from "@/components/ui/button";
+import { TooltipProvider } from "@radix-ui/react-tooltip";
import { XIcon } from "lucide-react";
-import { ErrorsPanel } from "../panels/error-panel";
-import { OutlinePanel } from "../panels/outline-panel";
+import { ChatPanel } from "@/components/chat/chat-panel";
import { DependencyGraphPanel } from "@/components/editor/chrome/panels/dependency-graph-panel";
-import { VariablePanel } from "../panels/variable-panel";
-import { LogsPanel } from "../panels/logs-panel";
-import { DocumentationPanel } from "../panels/documentation-panel";
-import { FileExplorerPanel } from "../panels/file-explorer-panel";
-import { SnippetsPanel } from "../panels/snippets-panel";
-import { ErrorBoundary } from "../../boundary/ErrorBoundary";
-import { DataSourcesPanel } from "../panels/datasources-panel";
+import { Button } from "@/components/ui/button";
import { LazyMount } from "@/components/utils/lazy-mount";
-import { ScratchpadPanel } from "../panels/scratchpad-panel";
import { IfCapability } from "@/core/config/if-capability";
+import { cn } from "@/utils/cn";
+import { ErrorBoundary } from "../../boundary/ErrorBoundary";
+import { ContextAwarePanel } from "../panels/context-aware-panel/context-aware-panel";
+import { DataSourcesPanel } from "../panels/datasources-panel";
+import { DocumentationPanel } from "../panels/documentation-panel";
+import { ErrorsPanel } from "../panels/error-panel";
+import { FileExplorerPanel } from "../panels/file-explorer-panel";
+import { LogsPanel } from "../panels/logs-panel";
+import { OutlinePanel } from "../panels/outline-panel";
import { PackagesPanel } from "../panels/packages-panel";
-import { ChatPanel } from "@/components/chat/chat-panel";
-import { TooltipProvider } from "@radix-ui/react-tooltip";
-import { TracingPanel } from "../panels/tracing-panel";
+import { ScratchpadPanel } from "../panels/scratchpad-panel";
import { SecretsPanel } from "../panels/secrets-panel";
-import { ContextAwarePanel } from "../panels/context-aware-panel/context-aware-panel";
-import { handleDragging } from "./utils";
+import { SnippetsPanel } from "../panels/snippets-panel";
+import { TracingPanel } from "../panels/tracing-panel";
+import { VariablePanel } from "../panels/variable-panel";
+import { useChromeActions, useChromeState } from "../state";
import { PanelsWrapper } from "./panels";
+import { createStorage } from "./storage";
+import { handleDragging } from "./utils";
const LazyTerminal = React.lazy(() => import("@/components/terminal/terminal"));
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-item.tsx b/frontend/src/components/editor/chrome/wrapper/footer-item.tsx
index 4c3c9b2ad3..c662d3bb68 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-item.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-item.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Tooltip } from "@/components/ui/tooltip";
-import { cn } from "@/utils/cn";
+
import type React from "react";
import { forwardRef } from "react";
+import { Tooltip } from "@/components/ui/tooltip";
+import { cn } from "@/utils/cn";
type FooterItemProps = {
selected: boolean;
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx
index d4fb37e285..6bad8609c4 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/ai-status.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { useAtomValue } from "jotai";
-import { aiAtom, aiEnabledAtom } from "@/core/config/config";
import { SparklesIcon } from "lucide-react";
-import { FooterItem } from "../footer-item";
+import React from "react";
import { useOpenSettingsToTab } from "@/components/app-config/state";
+import { aiAtom, aiEnabledAtom } from "@/core/config/config";
+import { FooterItem } from "../footer-item";
export const AIStatusIcon: React.FC = () => {
const ai = useAtomValue(aiAtom);
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
index 99066a03a6..a40925a497 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/backend-status.tsx
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Spinner } from "@/components/icons/spinner";
-import { connectionAtom } from "@/core/network/connection";
-import { WebSocketState } from "@/core/websocket/types";
-import { useRuntimeManager } from "@/core/runtime/config";
+
import { useAtomValue } from "jotai";
import { startCase } from "lodash-es";
-import { CheckCircle2Icon, PowerOffIcon, AlertCircleIcon } from "lucide-react";
+import { AlertCircleIcon, CheckCircle2Icon, PowerOffIcon } from "lucide-react";
import type React from "react";
+import { Spinner } from "@/components/icons/spinner";
+import { connectionAtom } from "@/core/network/connection";
+import { useRuntimeManager } from "@/core/runtime/config";
+import { WebSocketState } from "@/core/websocket/types";
+import { useAsyncData } from "@/hooks/useAsyncData";
import { useInterval } from "@/hooks/useInterval";
import { FooterItem } from "../footer-item";
-import { useAsyncData } from "@/hooks/useAsyncData";
const CHECK_HEALTH_INTERVAL_MS = 30_000;
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/copilot-status.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/copilot-status.tsx
index 8196eb0fa0..3f80e3c135 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/copilot-status.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/copilot-status.tsx
@@ -1,22 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom, useAtomValue, useSetAtom } from "jotai";
import React from "react";
-import { cn } from "@/utils/cn";
+import { useOpenSettingsToTab } from "@/components/app-config/state";
+import { GitHubCopilotIcon } from "@/components/icons/github-copilot";
import { Spinner } from "@/components/icons/spinner";
+import { Button } from "@/components/ui/button";
+import { toast } from "@/components/ui/use-toast";
+import { getCopilotClient } from "@/core/codemirror/copilot/client";
import {
- isGitHubCopilotSignedInState,
- githubCopilotLoadingVersion,
copilotSignedInState,
+ githubCopilotLoadingVersion,
+ isGitHubCopilotSignedInState,
} from "@/core/codemirror/copilot/state";
-import { atom, useAtomValue, useSetAtom } from "jotai";
import { resolvedMarimoConfigAtom } from "@/core/config/config";
-import { GitHubCopilotIcon } from "@/components/icons/github-copilot";
-import { FooterItem } from "../footer-item";
-import { toast } from "@/components/ui/use-toast";
-import { getCopilotClient } from "@/core/codemirror/copilot/client";
-import { Logger } from "@/utils/Logger";
-import { Button } from "@/components/ui/button";
import { useOnMount } from "@/hooks/useLifecycle";
-import { useOpenSettingsToTab } from "@/components/app-config/state";
+import { cn } from "@/utils/cn";
+import { Logger } from "@/utils/Logger";
+import { FooterItem } from "../footer-item";
const copilotAtom = atom((get) => {
return get(resolvedMarimoConfigAtom).completion.copilot;
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx
index e8efb9d82f..694bd2b96d 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/machine-stats.tsx
@@ -1,4 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
+import { CpuIcon, MemoryStickIcon, MicrochipIcon } from "lucide-react";
+import type React from "react";
+import { useState } from "react";
import { Tooltip } from "@/components/ui/tooltip";
import { connectionAtom } from "@/core/network/connection";
import { getUsageStats } from "@/core/network/requests";
@@ -7,10 +12,6 @@ import { isWasm } from "@/core/wasm/utils";
import { WebSocketState } from "@/core/websocket/types";
import { useAsyncData } from "@/hooks/useAsyncData";
import { useInterval } from "@/hooks/useInterval";
-import { useAtomValue } from "jotai";
-import { CpuIcon, MemoryStickIcon, MicrochipIcon } from "lucide-react";
-import type React from "react";
-import { useState } from "react";
import { cn } from "@/utils/cn";
export const MachineStats: React.FC = (props) => {
diff --git a/frontend/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx b/frontend/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx
index ee89a39be2..2e55f265c1 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer-items/rtc-status.tsx
@@ -1,18 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { connectedDocAtom } from "@/core/codemirror/rtc/extension";
-import { useAtomValue, useAtom } from "jotai";
+import { useAtom, useAtomValue } from "jotai";
import { UsersIcon } from "lucide-react";
import type React from "react";
-import { FooterItem } from "../footer-item";
+import { useState } from "react";
+import { Input } from "@/components/ui/input";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
-import { Input } from "@/components/ui/input";
-import { useState } from "react";
+import { connectedDocAtom } from "@/core/codemirror/rtc/extension";
import { isRtcEnabled, usernameAtom } from "@/core/rtc/state";
+import { FooterItem } from "../footer-item";
export const RTCStatus: React.FC = () => {
const connectedDoc = useAtomValue(connectedDocAtom);
diff --git a/frontend/src/components/editor/chrome/wrapper/footer.tsx b/frontend/src/components/editor/chrome/wrapper/footer.tsx
index c44752ac50..9051de4c66 100644
--- a/frontend/src/components/editor/chrome/wrapper/footer.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/footer.tsx
@@ -1,37 +1,38 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type React from "react";
-import { cn } from "@/utils/cn";
-import { useChromeActions, useChromeState } from "../state";
-import { Tooltip } from "@/components/ui/tooltip";
+
import { useAtomValue } from "jotai";
-import { cellErrorCount } from "@/core/cells/cells";
-import { type PanelDescriptor, PANELS } from "../types";
-import { MachineStats } from "./footer-items/machine-stats";
-import { useResolvedMarimoConfig } from "@/core/config/config";
import {
+ ChevronDownIcon,
PowerOffIcon,
TerminalSquareIcon,
ZapIcon,
ZapOffIcon,
} from "lucide-react";
-import { saveUserConfig } from "@/core/network/requests";
-import type { UserConfig } from "@/core/config/config-schema";
-import { ShowInKioskMode } from "../../kiosk-mode";
-import { invariant } from "@/utils/invariant";
-import { IfCapability } from "@/core/config/if-capability";
+import type React from "react";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { ChevronDownIcon } from "lucide-react";
-import { FooterItem } from "./footer-item";
-import { useHotkey } from "@/hooks/useHotkey";
+import { Tooltip } from "@/components/ui/tooltip";
+import { cellErrorCount } from "@/core/cells/cells";
+import { useResolvedMarimoConfig } from "@/core/config/config";
+import type { UserConfig } from "@/core/config/config-schema";
+import { IfCapability } from "@/core/config/if-capability";
+import { saveUserConfig } from "@/core/network/requests";
import { isWasm } from "@/core/wasm/utils";
+import { useHotkey } from "@/hooks/useHotkey";
+import { cn } from "@/utils/cn";
+import { invariant } from "@/utils/invariant";
+import { ShowInKioskMode } from "../../kiosk-mode";
+import { useChromeActions, useChromeState } from "../state";
+import { PANELS, type PanelDescriptor } from "../types";
+import { FooterItem } from "./footer-item";
import { AIStatusIcon } from "./footer-items/ai-status";
import { BackendConnection } from "./footer-items/backend-status";
import { CopilotStatusIcon } from "./footer-items/copilot-status";
+import { MachineStats } from "./footer-items/machine-stats";
import { RTCStatus } from "./footer-items/rtc-status";
export const Footer: React.FC = () => {
diff --git a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx b/frontend/src/components/editor/chrome/wrapper/sidebar.tsx
index c6076144d4..610099cfe3 100644
--- a/frontend/src/components/editor/chrome/wrapper/sidebar.tsx
+++ b/frontend/src/components/editor/chrome/wrapper/sidebar.tsx
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
+import { MessageCircleQuestionIcon } from "lucide-react";
import type React from "react";
import type { PropsWithChildren } from "react";
-import { MessageCircleQuestionIcon } from "lucide-react";
-import { cn } from "@/utils/cn";
-import { useChromeActions, useChromeState } from "../state";
import { Tooltip } from "@/components/ui/tooltip";
-import { FeedbackButton } from "../components/feedback-button";
-import { type PanelDescriptor, PANELS } from "../types";
import { notebookQueuedOrRunningCountAtom } from "@/core/cells/cells";
-import { useAtomValue } from "jotai";
+import { cn } from "@/utils/cn";
+import { FeedbackButton } from "../components/feedback-button";
+import { useChromeActions, useChromeState } from "../state";
+import { PANELS, type PanelDescriptor } from "../types";
export const Sidebar: React.FC = () => {
const { selectedPanel } = useChromeState();
diff --git a/frontend/src/components/editor/code/readonly-python-code.tsx b/frontend/src/components/editor/code/readonly-python-code.tsx
index ca12d882d8..7c69810b8a 100644
--- a/frontend/src/components/editor/code/readonly-python-code.tsx
+++ b/frontend/src/components/editor/code/readonly-python-code.tsx
@@ -1,19 +1,20 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { memo, useState } from "react";
+
+import { sql } from "@codemirror/lang-sql";
import CodeMirror, {
EditorView,
type ReactCodeMirrorProps,
} from "@uiw/react-codemirror";
import { CopyIcon, EyeIcon, EyeOffIcon } from "lucide-react";
+import { memo, useState } from "react";
import { Button } from "@/components/ui/button";
-import { Events } from "@/utils/events";
+import { Tooltip } from "@/components/ui/tooltip";
import { toast } from "@/components/ui/use-toast";
+import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
import { useTheme } from "@/theme/useTheme";
import { cn } from "@/utils/cn";
-import { customPythonLanguageSupport } from "@/core/codemirror/language/languages/python";
-import { sql } from "@codemirror/lang-sql";
import { copyToClipboard } from "@/utils/copy";
-import { Tooltip } from "@/components/ui/tooltip";
+import { Events } from "@/utils/events";
const pythonExtensions = [
customPythonLanguageSupport(),
diff --git a/frontend/src/components/editor/columns/__tests__/storage.test.ts b/frontend/src/components/editor/columns/__tests__/storage.test.ts
index 459fdcd495..9466b5f406 100644
--- a/frontend/src/components/editor/columns/__tests__/storage.test.ts
+++ b/frontend/src/components/editor/columns/__tests__/storage.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, afterEach } from "vitest";
+import { afterEach, describe, expect, it } from "vitest";
import { reorderColumnSizes, storageFn } from "../storage";
describe("Column width storage", () => {
diff --git a/frontend/src/components/editor/columns/cell-column.tsx b/frontend/src/components/editor/columns/cell-column.tsx
index ddf026a88a..e8a1fa0e85 100644
--- a/frontend/src/components/editor/columns/cell-column.tsx
+++ b/frontend/src/components/editor/columns/cell-column.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { memo, useRef } from "react";
-import { SortableColumn } from "./sortable-column";
-import type { CellColumnId } from "@/utils/id-tree";
import type { AppConfig } from "@/core/config/config-schema";
-import { storageFn } from "./storage";
import { useResizeHandle } from "@/hooks/useResizeHandle";
+import type { CellColumnId } from "@/utils/id-tree";
+import { SortableColumn } from "./sortable-column";
+import { storageFn } from "./storage";
interface Props {
className?: string;
diff --git a/frontend/src/components/editor/columns/sortable-column.tsx b/frontend/src/components/editor/columns/sortable-column.tsx
index 06f8284cfc..350d0fe5d0 100644
--- a/frontend/src/components/editor/columns/sortable-column.tsx
+++ b/frontend/src/components/editor/columns/sortable-column.tsx
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { memo } from "react";
-import { mergeRefs } from "../../../utils/mergeRefs";
+
import { useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { ChevronLeftIcon, ChevronRightIcon, PlusIcon, X } from "lucide-react";
-import type { CellColumnId } from "@/utils/id-tree";
-import { useCellActions } from "@/core/cells/cells";
-import { cn } from "@/utils/cn";
+import React, { memo } from "react";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
+import { useCellActions } from "@/core/cells/cells";
+import { cn } from "@/utils/cn";
+import type { CellColumnId } from "@/utils/id-tree";
+import { mergeRefs } from "../../../utils/mergeRefs";
interface Props extends React.HTMLAttributes<HTMLDivElement> {
columnId: CellColumnId;
diff --git a/frontend/src/components/editor/columns/storage.ts b/frontend/src/components/editor/columns/storage.ts
index 53e3f92570..ed662d36e3 100644
--- a/frontend/src/components/editor/columns/storage.ts
+++ b/frontend/src/components/editor/columns/storage.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { z } from "zod";
import { arrayMove } from "@/utils/arrays";
import { NotebookScopedLocalStorage } from "@/utils/localStorage";
-import { z } from "zod";
const BASE_KEY = "marimo:notebook-col-sizes";
diff --git a/frontend/src/components/editor/controls/Controls.tsx b/frontend/src/components/editor/controls/Controls.tsx
index 8dd1770d53..23faf2677f 100644
--- a/frontend/src/components/editor/controls/Controls.tsx
+++ b/frontend/src/components/editor/controls/Controls.tsx
@@ -1,36 +1,35 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
import {
- LayoutTemplateIcon,
EditIcon,
+ LayoutTemplateIcon,
PlayIcon,
SquareIcon,
Undo2Icon,
} from "lucide-react";
-
-import { Button } from "@/components/editor/inputs/Inputs";
+import type { JSX } from "react";
import { KeyboardShortcuts } from "@/components/editor/controls/keyboard-shortcuts";
+import { NotebookMenuDropdown } from "@/components/editor/controls/notebook-menu-dropdown";
import { ShutdownButton } from "@/components/editor/controls/shutdown-button";
-
-import { Tooltip } from "../../ui/tooltip";
-import { renderShortcut } from "../../shortcuts/renderShortcut";
+import { Button } from "@/components/editor/inputs/Inputs";
+import { FindReplace } from "@/components/find-replace/find-replace";
+import type { AppConfig } from "@/core/config/config-schema";
+import { SaveComponent } from "@/core/saving/save-component";
+import { cn } from "@/utils/cn";
+import { Functions } from "@/utils/functions";
import {
canUndoDeletesAtom,
needsRunAtom,
useCellActions,
} from "../../../core/cells/cells";
import { ConfigButton } from "../../app-config/app-config-button";
-import { LayoutSelect } from "../renderers/layout-select";
-import { NotebookMenuDropdown } from "@/components/editor/controls/notebook-menu-dropdown";
-import { FindReplace } from "@/components/find-replace/find-replace";
-import type { AppConfig } from "@/core/config/config-schema";
+import { renderShortcut } from "../../shortcuts/renderShortcut";
+import { Tooltip } from "../../ui/tooltip";
import { useShouldShowInterrupt } from "../cell/useShouldShowInterrupt";
-import { CommandPaletteButton } from "./command-palette-button";
-import { cn } from "@/utils/cn";
import { HideInKioskMode } from "../kiosk-mode";
-import { Functions } from "@/utils/functions";
-import { SaveComponent } from "@/core/saving/save-component";
-import { useAtomValue } from "jotai";
-import type { JSX } from "react";
+import { LayoutSelect } from "../renderers/layout-select";
+import { CommandPaletteButton } from "./command-palette-button";
interface ControlsProps {
presenting: boolean;
diff --git a/frontend/src/components/editor/controls/command-palette-button.tsx b/frontend/src/components/editor/controls/command-palette-button.tsx
index 372c243c44..bd6d3a912d 100644
--- a/frontend/src/components/editor/controls/command-palette-button.tsx
+++ b/frontend/src/components/editor/controls/command-palette-button.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { renderShortcut } from "@/components/shortcuts/renderShortcut";
-import { Tooltip } from "@/components/ui/tooltip";
+
+import { useSetAtom } from "jotai";
import { CommandIcon } from "lucide-react";
import React from "react";
+import { renderShortcut } from "@/components/shortcuts/renderShortcut";
+import { Tooltip } from "@/components/ui/tooltip";
import { Button } from "../inputs/Inputs";
-import { useSetAtom } from "jotai";
import { commandPaletteAtom } from "./command-palette";
export const CommandPaletteButton: React.FC = () => {
diff --git a/frontend/src/components/editor/controls/command-palette.tsx b/frontend/src/components/editor/controls/command-palette.tsx
index 3714e69c74..aa9f67e327 100644
--- a/frontend/src/components/editor/controls/command-palette.tsx
+++ b/frontend/src/components/editor/controls/command-palette.tsx
@@ -1,4 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom, useAtom, useAtomValue } from "jotai";
import {
CommandDialog,
CommandEmpty,
@@ -9,24 +11,23 @@ import {
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command";
+import { lastFocusedCellAtom } from "@/core/cells/focus";
+import { hotkeysAtom } from "@/core/config/config";
+import { type HotkeyAction, isHotkeyAction } from "@/core/hotkeys/hotkeys";
+import { parseShortcut } from "@/core/hotkeys/shortcuts";
+import { useEventListener } from "@/hooks/useEventListener";
+import { Objects } from "@/utils/objects";
import { useRegisteredActions } from "../../../core/hotkeys/actions";
import { useRecentCommands } from "../../../hooks/useRecentCommands";
import { KeyboardHotkeys } from "../../shortcuts/renderShortcut";
-import { type HotkeyAction, isHotkeyAction } from "@/core/hotkeys/hotkeys";
-import { atom, useAtom, useAtomValue } from "jotai";
-import { useNotebookActions } from "../actions/useNotebookActions";
-import { Objects } from "@/utils/objects";
-import { parseShortcut } from "@/core/hotkeys/shortcuts";
import {
- isParentAction,
- flattenActions,
type ActionButton,
+ flattenActions,
+ isParentAction,
} from "../actions/types";
import { useCellActionButtons } from "../actions/useCellActionButton";
-import { lastFocusedCellAtom } from "@/core/cells/focus";
import { useConfigActions } from "../actions/useConfigActions";
-import { hotkeysAtom } from "@/core/config/config";
-import { useEventListener } from "@/hooks/useEventListener";
+import { useNotebookActions } from "../actions/useNotebookActions";
export const commandPaletteAtom = atom(false);
diff --git a/frontend/src/components/editor/controls/keyboard-shortcuts.tsx b/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
index 0d4f7431ea..7aa173e6e8 100644
--- a/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
+++ b/frontend/src/components/editor/controls/keyboard-shortcuts.tsx
@@ -1,28 +1,29 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom, useAtom, useAtomValue } from "jotai";
+import { EditIcon, XIcon } from "lucide-react";
+import { useState } from "react";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { hotkeysAtom, useResolvedMarimoConfig } from "@/core/config/config";
+import type { UserConfig } from "@/core/config/config-schema";
+import {
+ getDefaultHotkey,
+ type HotkeyAction,
+ type HotkeyGroup,
+} from "@/core/hotkeys/hotkeys";
+import { isPlatformMac } from "@/core/hotkeys/shortcuts";
+import { saveUserConfig } from "@/core/network/requests";
import { useHotkey } from "../../../hooks/useHotkey";
+import { KeyboardHotkeys } from "../../shortcuts/renderShortcut";
import {
Dialog,
DialogContent,
- DialogPortal,
- DialogOverlay,
DialogHeader,
+ DialogOverlay,
+ DialogPortal,
DialogTitle,
} from "../../ui/dialog";
-import { KeyboardHotkeys } from "../../shortcuts/renderShortcut";
-import {
- type HotkeyAction,
- type HotkeyGroup,
- getDefaultHotkey,
-} from "@/core/hotkeys/hotkeys";
-import { atom, useAtom, useAtomValue } from "jotai";
-import { useState } from "react";
-import { EditIcon, XIcon } from "lucide-react";
-import { Input } from "@/components/ui/input";
-import { hotkeysAtom, useResolvedMarimoConfig } from "@/core/config/config";
-import { saveUserConfig } from "@/core/network/requests";
-import { isPlatformMac } from "@/core/hotkeys/shortcuts";
-import { Button } from "@/components/ui/button";
-import type { UserConfig } from "@/core/config/config-schema";
export const keyboardShortcutsAtom = atom(false);
diff --git a/frontend/src/components/editor/controls/notebook-menu-dropdown.tsx b/frontend/src/components/editor/controls/notebook-menu-dropdown.tsx
index 48612932d4..be7016e21f 100644
--- a/frontend/src/components/editor/controls/notebook-menu-dropdown.tsx
+++ b/frontend/src/components/editor/controls/notebook-menu-dropdown.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Button } from "@/components/editor/inputs/Inputs";
+
import { MenuIcon } from "lucide-react";
import React from "react";
+import { Button } from "@/components/editor/inputs/Inputs";
import {
DropdownMenu,
DropdownMenuContent,
@@ -13,11 +14,11 @@ import {
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import { Tooltip } from "@/components/ui/tooltip";
+import { getMarimoVersion } from "@/core/meta/globals";
import { MinimalShortcut } from "../../shortcuts/renderShortcut";
-import { useNotebookActions } from "../actions/useNotebookActions";
import type { ActionButton } from "../actions/types";
-import { getMarimoVersion } from "@/core/meta/globals";
-import { Tooltip } from "@/components/ui/tooltip";
+import { useNotebookActions } from "../actions/useNotebookActions";
export const NotebookMenuDropdown: React.FC = () => {
const actions = useNotebookActions();
diff --git a/frontend/src/components/editor/controls/shutdown-button.tsx b/frontend/src/components/editor/controls/shutdown-button.tsx
index 99c5c7f5e2..c68e8364f2 100644
--- a/frontend/src/components/editor/controls/shutdown-button.tsx
+++ b/frontend/src/components/editor/controls/shutdown-button.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { AlertDialogDestructiveAction } from "../../ui/alert-dialog";
-import { Button } from "../inputs/Inputs";
-import { Tooltip } from "../../ui/tooltip";
-import { useImperativeModal } from "../../modal/ImperativeModal";
import { XIcon } from "lucide-react";
import { sendShutdown } from "@/core/network/requests";
import { isWasm } from "@/core/wasm/utils";
+import { useImperativeModal } from "../../modal/ImperativeModal";
+import { AlertDialogDestructiveAction } from "../../ui/alert-dialog";
+import { Tooltip } from "../../ui/tooltip";
+import { Button } from "../inputs/Inputs";
export const ShutdownButton: React.FC<{ description: string }> = (props) => {
const { openConfirm, closeModal } = useImperativeModal();
diff --git a/frontend/src/components/editor/database/__tests__/secrets.test.ts b/frontend/src/components/editor/database/__tests__/secrets.test.ts
index a3152b85fb..d82b389d3a 100644
--- a/frontend/src/components/editor/database/__tests__/secrets.test.ts
+++ b/frontend/src/components/editor/database/__tests__/secrets.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import {
displaySecret,
isSecret,
diff --git a/frontend/src/components/editor/database/add-database-form.tsx b/frontend/src/components/editor/database/add-database-form.tsx
index d5314aebb0..5521fdb974 100644
--- a/frontend/src/components/editor/database/add-database-form.tsx
+++ b/frontend/src/components/editor/database/add-database-form.tsx
@@ -1,28 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { z } from "zod";
+
+import { zodResolver } from "@hookform/resolvers/zod";
import { useState } from "react";
import { useForm } from "react-hook-form";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { Button } from "@/components/ui/button";
+import type { z } from "zod";
+import { DatabaseLogo, type DBLogoName } from "@/components/databases/icon";
import { type FormRenderer, ZodForm } from "@/components/forms/form";
-import {
- PostgresConnectionSchema,
- MySQLConnectionSchema,
- SQLiteConnectionSchema,
- DuckDBConnectionSchema,
- SnowflakeConnectionSchema,
- BigQueryConnectionSchema,
- type DatabaseConnection,
- ClickhouseConnectionSchema,
- TimeplusConnectionSchema,
- ChdbConnectionSchema,
- TrinoConnectionSchema,
- IcebergConnectionSchema,
- DataFusionConnectionSchema,
- PySparkConnectionSchema,
- MotherDuckConnectionSchema,
- RedshiftConnectionSchema,
-} from "./schemas";
+import { getDefaults } from "@/components/forms/form-utils";
+import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
@@ -31,16 +16,8 @@ import {
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
-import { DatabaseLogo, type DBLogoName } from "@/components/databases/icon";
-import { useCellActions } from "@/core/cells/cells";
-import { useLastFocusedCellId } from "@/core/cells/focus";
-import {
- ConnectionDisplayNames,
- type ConnectionLibrary,
- generateDatabaseCode,
-} from "./as-code";
import { FormErrorsBanner } from "@/components/ui/form";
-import { getDefaults } from "@/components/forms/form-utils";
+import { ExternalLink } from "@/components/ui/links";
import {
Select,
SelectContent,
@@ -49,8 +26,32 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
+import { useCellActions } from "@/core/cells/cells";
+import { useLastFocusedCellId } from "@/core/cells/focus";
+import {
+ ConnectionDisplayNames,
+ type ConnectionLibrary,
+ generateDatabaseCode,
+} from "./as-code";
import { ENV_RENDERER, SecretsProvider } from "./form-renderers";
-import { ExternalLink } from "@/components/ui/links";
+import {
+ BigQueryConnectionSchema,
+ ChdbConnectionSchema,
+ ClickhouseConnectionSchema,
+ type DatabaseConnection,
+ DataFusionConnectionSchema,
+ DuckDBConnectionSchema,
+ IcebergConnectionSchema,
+ MotherDuckConnectionSchema,
+ MySQLConnectionSchema,
+ PostgresConnectionSchema,
+ PySparkConnectionSchema,
+ RedshiftConnectionSchema,
+ SnowflakeConnectionSchema,
+ SQLiteConnectionSchema,
+ TimeplusConnectionSchema,
+ TrinoConnectionSchema,
+} from "./schemas";
interface Props {
onSubmit: () => void;
diff --git a/frontend/src/components/editor/database/as-code.ts b/frontend/src/components/editor/database/as-code.ts
index 6553bcf3f1..a402667f01 100644
--- a/frontend/src/components/editor/database/as-code.ts
+++ b/frontend/src/components/editor/database/as-code.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { assertNever } from "@/utils/assertNever";
-import { DatabaseConnectionSchema, type DatabaseConnection } from "./schemas";
+
// @ts-expect-error: no declaration file
import dedent from "string-dedent";
+import { assertNever } from "@/utils/assertNever";
+import { type DatabaseConnection, DatabaseConnectionSchema } from "./schemas";
import { isSecret, unprefixSecret } from "./secrets";
export type ConnectionLibrary =
diff --git a/frontend/src/components/editor/database/form-renderers.tsx b/frontend/src/components/editor/database/form-renderers.tsx
index 18f8d7990f..3873fa3844 100644
--- a/frontend/src/components/editor/database/form-renderers.tsx
+++ b/frontend/src/components/editor/database/form-renderers.tsx
@@ -1,18 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { partition } from "lodash-es";
+import { KeyIcon, PlusCircleIcon } from "lucide-react";
+import { createContext, type ReactNode, use } from "react";
+import { z } from "zod";
import type { FormRenderer } from "@/components/forms/form";
import { FieldOptions } from "@/components/forms/options";
-import {
- FormField,
- FormItem,
- FormLabel,
- FormDescription,
- FormControl,
- FormMessage,
-} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
-import { SECRETS_REGISTRY } from "@/core/secrets/request-registry";
-import { KeyIcon, PlusCircleIcon } from "lucide-react";
+import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
@@ -21,21 +16,25 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Button } from "@/components/ui/button";
-import { cn } from "@/utils/cn";
-import { z } from "zod";
+import {
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { Input } from "@/components/ui/input";
+import { NumberField } from "@/components/ui/number-field";
+import { SECRETS_REGISTRY } from "@/core/secrets/request-registry";
import { useAsyncData } from "@/hooks/useAsyncData";
-
-import { createContext, use, type ReactNode } from "react";
+import { cn } from "@/utils/cn";
import { Functions } from "@/utils/functions";
-import { NumberField } from "@/components/ui/number-field";
-import { displaySecret, isSecret, prefixSecret } from "./secrets";
-import { partition } from "lodash-es";
-import { useImperativeModal } from "@/components/modal/ImperativeModal";
import {
sortProviders,
WriteSecretModal,
} from "../chrome/panels/write-secret-modal";
+import { displaySecret, isSecret, prefixSecret } from "./secrets";
interface SecretsContextType {
providerNames: string[];
diff --git a/frontend/src/components/editor/dynamic-favicon.tsx b/frontend/src/components/editor/dynamic-favicon.tsx
index b721586610..eb4dc884a7 100644
--- a/frontend/src/components/editor/dynamic-favicon.tsx
+++ b/frontend/src/components/editor/dynamic-favicon.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useCellErrors } from "@/core/cells/cells";
-import { useEventListener } from "@/hooks/useEventListener";
+
import { usePrevious } from "@dnd-kit/utilities";
import { useEffect } from "react";
+import { useCellErrors } from "@/core/cells/cells";
+import { useEventListener } from "@/hooks/useEventListener";
const FAVICON_PATHS = {
idle: "./favicon.ico",
diff --git a/frontend/src/components/editor/errors/auto-fix.tsx b/frontend/src/components/editor/errors/auto-fix.tsx
index 1b4f5ea675..1ffc01359b 100644
--- a/frontend/src/components/editor/errors/auto-fix.tsx
+++ b/frontend/src/components/editor/errors/auto-fix.tsx
@@ -1,17 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { WrenchIcon } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
-import { useCellActions, notebookAtom } from "@/core/cells/cells";
+import { notebookAtom, useCellActions } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
import { getAutoFixes } from "@/core/errors/errors";
import type { MarimoError } from "@/core/kernel/messages";
import { store } from "@/core/state/jotai";
-import { WrenchIcon } from "lucide-react";
export const AutoFixButton = ({
errors,
cellId,
-}: { errors: MarimoError[]; cellId: CellId; className?: string }) => {
+}: {
+ errors: MarimoError[];
+ cellId: CellId;
+ className?: string;
+}) => {
const { createNewCell } = useCellActions();
const autoFixes = errors.flatMap((error) => getAutoFixes(error));
diff --git a/frontend/src/components/editor/file-tree/__tests__/requesting-tree.test.ts b/frontend/src/components/editor/file-tree/__tests__/requesting-tree.test.ts
index 9a6bdec1ee..38173b2dc4 100644
--- a/frontend/src/components/editor/file-tree/__tests__/requesting-tree.test.ts
+++ b/frontend/src/components/editor/file-tree/__tests__/requesting-tree.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeEach, afterEach, expect, vi, describe, test } from "vitest";
-import { RequestingTree } from "../requesting-tree";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { toast } from "@/components/ui/use-toast";
+import { RequestingTree } from "../requesting-tree";
const sendListFiles = vi.fn();
const sendCreateFileOrFolder = vi.fn();
diff --git a/frontend/src/components/editor/file-tree/file-explorer.tsx b/frontend/src/components/editor/file-tree/file-explorer.tsx
index 7bd7883d7a..98ac793360 100644
--- a/frontend/src/components/editor/file-tree/file-explorer.tsx
+++ b/frontend/src/components/editor/file-tree/file-explorer.tsx
@@ -1,12 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- type NodeApi,
- type NodeRendererProps,
- Tree,
- type TreeApi,
-} from "react-arborist";
-import React, { Suspense, use, useEffect, useRef, useState } from "react";
+import { useAtom } from "jotai";
import {
ArrowLeftIcon,
BracesIcon,
@@ -14,6 +8,7 @@ import {
ChevronRightIcon,
CopyIcon,
CopyMinusIcon,
+ DownloadIcon,
Edit3Icon,
ExternalLinkIcon,
FilePlus2Icon,
@@ -24,21 +19,19 @@ import {
Trash2Icon,
UploadIcon,
ViewIcon,
- DownloadIcon,
} from "lucide-react";
-import type { FileInfo } from "@/core/network/types";
+import React, { Suspense, use, useEffect, useRef, useState } from "react";
import {
- FILE_TYPE_ICONS,
- type FileType,
- PYTHON_CODE_FOR_FILE_TYPE,
- guessFileType,
-} from "./types";
-import { toast } from "@/components/ui/use-toast";
+ type NodeApi,
+ type NodeRendererProps,
+ Tree,
+ type TreeApi,
+} from "react-arborist";
+import useEvent from "react-use-event-hook";
+import { Spinner } from "@/components/icons/spinner";
import { useImperativeModal } from "@/components/modal/ImperativeModal";
import { AlertDialogDestructiveAction } from "@/components/ui/alert-dialog";
-import { useAtom } from "jotai";
import { Button, buttonVariants } from "@/components/ui/button";
-
import {
DropdownMenu,
DropdownMenuContent,
@@ -47,20 +40,26 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Tooltip } from "@/components/ui/tooltip";
-import { cn } from "@/utils/cn";
-import { FileViewer } from "./file-viewer";
-import { treeAtom, openStateAtom } from "./state";
-import { useFileExplorerUpload } from "./upload";
+import { toast } from "@/components/ui/use-toast";
+import { openFile, sendFileDetails } from "@/core/network/requests";
+import type { FileInfo } from "@/core/network/types";
import { isWasm } from "@/core/wasm/utils";
import { useAsyncData } from "@/hooks/useAsyncData";
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import { Spinner } from "@/components/icons/spinner";
-import type { RequestingTree } from "./requesting-tree";
-import type { FilePath } from "@/utils/paths";
-import useEvent from "react-use-event-hook";
+import { cn } from "@/utils/cn";
import { copyToClipboard } from "@/utils/copy";
-import { openFile, sendFileDetails } from "@/core/network/requests";
import { downloadBlob } from "@/utils/download";
+import type { FilePath } from "@/utils/paths";
+import { FileViewer } from "./file-viewer";
+import type { RequestingTree } from "./requesting-tree";
+import { openStateAtom, treeAtom } from "./state";
+import {
+ FILE_TYPE_ICONS,
+ type FileType,
+ guessFileType,
+ PYTHON_CODE_FOR_FILE_TYPE,
+} from "./types";
+import { useFileExplorerUpload } from "./upload";
const RequestingTreeContext = React.createContext<RequestingTree | null>(null);
diff --git a/frontend/src/components/editor/file-tree/file-viewer.tsx b/frontend/src/components/editor/file-tree/file-viewer.tsx
index de9e890bfe..a3804f6043 100644
--- a/frontend/src/components/editor/file-tree/file-viewer.tsx
+++ b/frontend/src/components/editor/file-tree/file-viewer.tsx
@@ -1,29 +1,30 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { sendFileDetails, sendUpdateFile } from "@/core/network/requests";
-import type { FileInfo } from "@/core/network/types";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
-import { ErrorBanner } from "@/plugins/impl/common/error-banner";
-import { useTheme } from "@/theme/useTheme";
+
import { EditorView, keymap } from "@codemirror/view";
-import type React from "react";
-import { useEffect, useRef, useState } from "react";
-import { Button } from "../inputs/Inputs";
+import { useAtomValue } from "jotai";
import {
CopyIcon,
DownloadIcon,
ExternalLinkIcon,
SaveIcon,
} from "lucide-react";
+import type React from "react";
+import { useEffect, useRef, useState } from "react";
import { renderShortcut } from "@/components/shortcuts/renderShortcut";
import { Tooltip } from "@/components/ui/tooltip";
-import { downloadBlob, downloadByURL } from "@/utils/download";
-import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
import { hotkeysAtom } from "@/core/config/config";
-import { useAtomValue } from "jotai";
-import { ImageViewer, CsvViewer, AudioViewer, VideoViewer } from "./renderers";
+import { sendFileDetails, sendUpdateFile } from "@/core/network/requests";
+import type { FileInfo } from "@/core/network/types";
import { isWasm } from "@/core/wasm/utils";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
+import { ErrorBanner } from "@/plugins/impl/common/error-banner";
+import { useTheme } from "@/theme/useTheme";
import { copyToClipboard } from "@/utils/copy";
+import { downloadBlob, downloadByURL } from "@/utils/download";
+import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
+import { Button } from "../inputs/Inputs";
+import { AudioViewer, CsvViewer, ImageViewer, VideoViewer } from "./renderers";
interface Props {
file: FileInfo;
diff --git a/frontend/src/components/editor/file-tree/renderers.tsx b/frontend/src/components/editor/file-tree/renderers.tsx
index c3e023bce1..06d267d874 100644
--- a/frontend/src/components/editor/file-tree/renderers.tsx
+++ b/frontend/src/components/editor/file-tree/renderers.tsx
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { PaginationState } from "@tanstack/react-table";
+import type React from "react";
+import { useMemo, useState } from "react";
import {
generateColumns,
inferFieldTypes,
} from "@/components/data-table/columns";
import { DataTable } from "@/components/data-table/data-table";
import { parseCsvData } from "@/plugins/impl/vega/loader";
-import { Objects } from "@/utils/objects";
-import type React from "react";
-import { useMemo, useState } from "react";
-import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
-import type { PaginationState } from "@tanstack/react-table";
import { Arrays } from "@/utils/arrays";
+import { type Base64String, base64ToDataURL } from "@/utils/json/base64";
+import { Objects } from "@/utils/objects";
const PAGE_SIZE = 25;
diff --git a/frontend/src/components/editor/file-tree/requesting-tree.tsx b/frontend/src/components/editor/file-tree/requesting-tree.tsx
index a9ec5adb86..36267255b4 100644
--- a/frontend/src/components/editor/file-tree/requesting-tree.tsx
+++ b/frontend/src/components/editor/file-tree/requesting-tree.tsx
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { SimpleTree } from "react-arborist";
import { toast } from "@/components/ui/use-toast";
import type {
- sendListFiles,
sendCreateFileOrFolder,
sendDeleteFileOrFolder,
+ sendListFiles,
sendRenameFileOrFolder,
} from "@/core/network/requests";
import type { FileInfo, FileUpdateResponse } from "@/core/network/types";
import { prettyError } from "@/utils/errors";
import { Functions } from "@/utils/functions";
import { type FilePath, PathBuilder } from "@/utils/paths";
-import { SimpleTree } from "react-arborist";
export class RequestingTree {
private delegate = new SimpleTree<FileInfo>([]);
diff --git a/frontend/src/components/editor/file-tree/state.tsx b/frontend/src/components/editor/file-tree/state.tsx
index fd09ba7ee7..864a727133 100644
--- a/frontend/src/components/editor/file-tree/state.tsx
+++ b/frontend/src/components/editor/file-tree/state.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom } from "jotai";
import {
sendCreateFileOrFolder,
sendDeleteFileOrFolder,
sendListFiles,
sendRenameFileOrFolder,
} from "@/core/network/requests";
-import { atom } from "jotai";
-import { RequestingTree } from "./requesting-tree";
import { store } from "@/core/state/jotai";
+import { RequestingTree } from "./requesting-tree";
// State lives outside of the component
// to preserve the state when the component is unmounted
diff --git a/frontend/src/components/editor/file-tree/upload.tsx b/frontend/src/components/editor/file-tree/upload.tsx
index 1bbdb16d56..8f931b4b0f 100644
--- a/frontend/src/components/editor/file-tree/upload.tsx
+++ b/frontend/src/components/editor/file-tree/upload.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { type DropzoneOptions, useDropzone } from "react-dropzone";
import { toast } from "@/components/ui/use-toast";
import { sendCreateFileOrFolder } from "@/core/network/requests";
-import type { FilePath } from "@/utils/paths";
import { serializeBlob } from "@/utils/blob";
-import { type DropzoneOptions, useDropzone } from "react-dropzone";
-import { refreshRoot } from "./state";
import { Logger } from "@/utils/Logger";
+import type { FilePath } from "@/utils/paths";
+import { refreshRoot } from "./state";
const MAX_SIZE = 1024 * 1024 * 100; // 100MB
diff --git a/frontend/src/components/editor/header/app-header.tsx b/frontend/src/components/editor/header/app-header.tsx
index 3de1fbe57f..a601fc0047 100644
--- a/frontend/src/components/editor/header/app-header.tsx
+++ b/frontend/src/components/editor/header/app-header.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
+
import React, { type PropsWithChildren } from "react";
+import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
import { Disconnected } from "../Disconnected";
interface Props {
diff --git a/frontend/src/components/editor/header/filename-form.tsx b/frontend/src/components/editor/header/filename-form.tsx
index c3bd5e037f..6617725d3b 100644
--- a/frontend/src/components/editor/header/filename-form.tsx
+++ b/frontend/src/components/editor/header/filename-form.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { JSX } from "react";
import { FilenameInput } from "@/components/editor/header/filename-input";
import { useUpdateFilename } from "@/core/saving/filename";
import { Paths } from "@/utils/paths";
-import type { JSX } from "react";
-
export const FilenameForm = ({
filename,
}: {
diff --git a/frontend/src/components/editor/header/filename-input.tsx b/frontend/src/components/editor/header/filename-input.tsx
index 8aa78a1ca0..8bc2b0dbdf 100644
--- a/frontend/src/components/editor/header/filename-input.tsx
+++ b/frontend/src/components/editor/header/filename-input.tsx
@@ -1,11 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useRef, useState, type JSX } from "react";
-
-import { cn } from "../../../utils/cn";
+import { PopoverAnchor } from "@radix-ui/react-popover";
+import { FilePenIcon } from "lucide-react";
+import { type JSX, useEffect, useRef, useState } from "react";
import { sendListFiles } from "@/core/network/requests";
-import { Paths } from "@/utils/paths";
+import type { FileInfo } from "@/core/network/types";
import { useAsyncData } from "@/hooks/useAsyncData";
+import { Paths } from "@/utils/paths";
+import { cn } from "../../../utils/cn";
import {
Command,
CommandEmpty,
@@ -13,15 +15,12 @@ import {
CommandItem,
CommandList,
} from "../../ui/command";
-import { FilePenIcon } from "lucide-react";
-import { FILE_TYPE_ICONS, guessFileType } from "../file-tree/types";
import { Popover, PopoverContent } from "../../ui/popover";
-import { PopoverAnchor } from "@radix-ui/react-popover";
-import type { FileInfo } from "@/core/network/types";
+import { FILE_TYPE_ICONS, guessFileType } from "../file-tree/types";
import "./filename-input.css";
-import { ErrorBoundary } from "../boundary/ErrorBoundary";
import { getFeatureFlag } from "@/core/config/feature-flag";
+import { ErrorBoundary } from "../boundary/ErrorBoundary";
interface FilenameInputProps {
resetOnBlur?: boolean;
diff --git a/frontend/src/components/editor/header/status.tsx b/frontend/src/components/editor/header/status.tsx
index 19b2fba518..2dd8e9758c 100644
--- a/frontend/src/components/editor/header/status.tsx
+++ b/frontend/src/components/editor/header/status.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
+import { HourglassIcon, LockIcon, UnlinkIcon } from "lucide-react";
+import React from "react";
import { Tooltip } from "@/components/ui/tooltip";
import { notebookScrollToRunning } from "@/core/cells/actions";
import { viewStateAtom } from "@/core/mode";
import { type ConnectionStatus, WebSocketState } from "@/core/websocket/types";
import { cn } from "@/utils/cn";
-import { useAtomValue } from "jotai";
-import { UnlinkIcon, HourglassIcon, LockIcon } from "lucide-react";
-import React from "react";
export const StatusOverlay: React.FC<{
connection: ConnectionStatus;
diff --git a/frontend/src/components/editor/inputs/Inputs.tsx b/frontend/src/components/editor/inputs/Inputs.tsx
index b8fbf7f32e..87db19cadf 100644
--- a/frontend/src/components/editor/inputs/Inputs.tsx
+++ b/frontend/src/components/editor/inputs/Inputs.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { VariantProps } from "class-variance-authority";
-import * as styles from "./Inputs.styles";
-import React from "react";
import clsx from "clsx";
+import React from "react";
+import * as styles from "./Inputs.styles";
type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
VariantProps<typeof styles.button>;
diff --git a/frontend/src/components/editor/kiosk-mode.tsx b/frontend/src/components/editor/kiosk-mode.tsx
index c4e823eb4a..e8bdcddf5d 100644
--- a/frontend/src/components/editor/kiosk-mode.tsx
+++ b/frontend/src/components/editor/kiosk-mode.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { kioskModeAtom } from "@/core/mode";
+
import { useAtomValue } from "jotai";
import React from "react";
+import { kioskModeAtom } from "@/core/mode";
interface Props {
children: React.ReactNode;
diff --git a/frontend/src/components/editor/links/cell-link-list.tsx b/frontend/src/components/editor/links/cell-link-list.tsx
index 29a01e49d4..4d3e63b685 100644
--- a/frontend/src/components/editor/links/cell-link-list.tsx
+++ b/frontend/src/components/editor/links/cell-link-list.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellId } from "@/core/cells/ids";
+
import type React from "react";
-import { CellLink } from "./cell-link";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { useCellIds } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import { CellLink } from "./cell-link";
interface Props {
maxCount: number;
diff --git a/frontend/src/components/editor/links/cell-link.tsx b/frontend/src/components/editor/links/cell-link.tsx
index cf83c5c54f..141850a5da 100644
--- a/frontend/src/components/editor/links/cell-link.tsx
+++ b/frontend/src/components/editor/links/cell-link.tsx
@@ -1,13 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { SCRATCH_CELL_ID } from "@/core/cells/cells";
+
+import type { JSX } from "react"; /* Copyright 2024 Marimo. All rights reserved. */
+import {
+ SCRATCH_CELL_ID,
+ useCellActions,
+ useCellIds,
+ useCellNames,
+} from "@/core/cells/cells";
import { type CellId, HTMLCellId } from "@/core/cells/ids";
-import { Logger } from "../../../utils/Logger";
-import { cn } from "@/utils/cn";
import { displayCellName } from "@/core/cells/names";
-import { useCellActions, useCellIds, useCellNames } from "@/core/cells/cells";
-import { useFilename } from "@/core/saving/filename";
import { goToCellLine } from "@/core/codemirror/go-to-definition/utils";
-import type { JSX } from "react";
+import { useFilename } from "@/core/saving/filename";
+import { cn } from "@/utils/cn";
+import { Logger } from "../../../utils/Logger";
interface Props {
cellId: CellId;
@@ -69,7 +74,10 @@ export const CellLinkError = (
export const CellLinkTraceback = ({
cellId,
lineNumber,
-}: { cellId: CellId; lineNumber: number }): JSX.Element => {
+}: {
+ cellId: CellId;
+ lineNumber: number;
+}): JSX.Element => {
const filename = useFilename();
return (
<CellLink
diff --git a/frontend/src/components/editor/notebook-banner.tsx b/frontend/src/components/editor/notebook-banner.tsx
index 404dab3584..a6521e333b 100644
--- a/frontend/src/components/editor/notebook-banner.tsx
+++ b/frontend/src/components/editor/notebook-banner.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { AlertCircleIcon, RotateCcwIcon, XIcon } from "lucide-react";
+import type React from "react";
+import type { AppConfig } from "@/core/config/config-schema";
import { useBanners, useBannersActions } from "@/core/errors/state";
import { renderHTML } from "@/plugins/core/RenderHTML";
import { Banner } from "@/plugins/impl/common/error-banner";
-import { AlertCircleIcon, RotateCcwIcon, XIcon } from "lucide-react";
-import type React from "react";
+import { cn } from "@/utils/cn";
import { Button } from "../ui/button";
import { useRestartKernel } from "./actions/useRestartKernel";
-import type { AppConfig } from "@/core/config/config-schema";
-import { cn } from "@/utils/cn";
interface Props {
width: AppConfig["width"];
diff --git a/frontend/src/components/editor/output/CalloutOutput.tsx b/frontend/src/components/editor/output/CalloutOutput.tsx
index 4eab7e45af..886102757c 100644
--- a/frontend/src/components/editor/output/CalloutOutput.tsx
+++ b/frontend/src/components/editor/output/CalloutOutput.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { memo } from "react";
-import { HtmlOutput } from "./HtmlOutput";
-import { calloutStyles } from "./CalloutOutput.styles";
import type { Intent } from "@/plugins/impl/common/intent";
+import { calloutStyles } from "./CalloutOutput.styles";
+import { HtmlOutput } from "./HtmlOutput";
interface Props {
html: string;
diff --git a/frontend/src/components/editor/output/ConsoleOutput.tsx b/frontend/src/components/editor/output/ConsoleOutput.tsx
index af883a1ea2..45f44d662d 100644
--- a/frontend/src/components/editor/output/ConsoleOutput.tsx
+++ b/frontend/src/components/editor/output/ConsoleOutput.tsx
@@ -1,18 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { AnsiUp } from "ansi_up";
+import { ChevronRightIcon } from "lucide-react";
import React, { useLayoutEffect } from "react";
-import type { OutputMessage } from "@/core/kernel/messages";
-import { OutputRenderer } from "../Output";
-import { cn } from "@/utils/cn";
-import { isInternalCellName } from "@/core/cells/names";
-import { NameCellContentEditable } from "../actions/name-cell-input";
-import type { CellId } from "@/core/cells/ids";
+import { DebuggerControls } from "@/components/debugger/debugger-code";
import { Input } from "@/components/ui/input";
-import { AnsiUp } from "ansi_up";
+import type { CellId } from "@/core/cells/ids";
+import { isInternalCellName } from "@/core/cells/names";
import type { WithResponse } from "@/core/cells/types";
+import type { OutputMessage } from "@/core/kernel/messages";
+import { cn } from "@/utils/cn";
import { invariant } from "@/utils/invariant";
+import { NameCellContentEditable } from "../actions/name-cell-input";
import { ErrorBoundary } from "../boundary/ErrorBoundary";
-import { DebuggerControls } from "@/components/debugger/debugger-code";
-import { ChevronRightIcon } from "lucide-react";
+import { OutputRenderer } from "../Output";
const ansiUp = new AnsiUp();
@@ -207,10 +208,7 @@ const StdInput = (props: {
);
};
-const StdInputWithResponse = (props: {
- output: string;
- response?: string;
-}) => {
+const StdInputWithResponse = (props: { output: string; response?: string }) => {
return (
<div className="flex gap-2 items-center">
{renderText(props.output)}
diff --git a/frontend/src/components/editor/output/EmotionCacheProvider.tsx b/frontend/src/components/editor/output/EmotionCacheProvider.tsx
index e87ac79402..cf55cffad7 100644
--- a/frontend/src/components/editor/output/EmotionCacheProvider.tsx
+++ b/frontend/src/components/editor/output/EmotionCacheProvider.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type PropsWithChildren, useMemo } from "react";
+
import createCache from "@emotion/cache";
import { CacheProvider } from "@emotion/react";
+import { type PropsWithChildren, useMemo } from "react";
/**
* Custom Emotion cache provider that works in shadow roots.
diff --git a/frontend/src/components/editor/output/JsonOutput.tsx b/frontend/src/components/editor/output/JsonOutput.tsx
index ff6da27a04..c4545303de 100644
--- a/frontend/src/components/editor/output/JsonOutput.tsx
+++ b/frontend/src/components/editor/output/JsonOutput.tsx
@@ -1,27 +1,27 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { memo, useState } from "react";
+
import {
+ booleanType,
type DataItemProps,
type DataType,
- JsonViewer,
- booleanType,
defineDataType,
- intType,
floatType,
+ intType,
+ JsonViewer,
nullType,
objectType,
stringType,
} from "@textea/json-viewer";
-
+import { CheckIcon, CopyIcon } from "lucide-react";
+import { memo, useState } from "react";
+import { cn } from "@/utils/cn";
+import { copyToClipboard } from "@/utils/copy";
+import { isUrl } from "@/utils/urls";
+import { useTheme } from "../../../theme/useTheme";
+import { logNever } from "../../../utils/assertNever";
import { HtmlOutput } from "./HtmlOutput";
import { ImageOutput } from "./ImageOutput";
import { VideoOutput } from "./VideoOutput";
-import { logNever } from "../../../utils/assertNever";
-import { useTheme } from "../../../theme/useTheme";
-import { isUrl } from "@/utils/urls";
-import { copyToClipboard } from "@/utils/copy";
-import { CheckIcon, CopyIcon } from "lucide-react";
-import { cn } from "@/utils/cn";
interface Props {
/**
diff --git a/frontend/src/components/editor/output/MarimoErrorOutput.tsx b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
index d2e77d397d..9793297615 100644
--- a/frontend/src/components/editor/output/MarimoErrorOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
@@ -1,10 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "../../../utils/cn";
-import type { MarimoError } from "../../../core/kernel/messages";
-import { Alert } from "../../ui/alert";
-import { AlertTitle } from "../../ui/alert";
-
+import { NotebookPenIcon, SquareArrowOutUpRightIcon } from "lucide-react";
+import { Fragment, type JSX } from "react";
import {
Accordion,
AccordionContent,
@@ -12,13 +9,14 @@ import {
AccordionTrigger,
} from "@/components/ui/accordion";
import { Button } from "@/components/ui/button";
-import { Fragment, type JSX } from "react";
-import { CellLinkError } from "../links/cell-link";
-import type { CellId } from "@/core/cells/ids";
-import { AutoFixButton } from "../errors/auto-fix";
-import { NotebookPenIcon, SquareArrowOutUpRightIcon } from "lucide-react";
import { ExternalLink } from "@/components/ui/links";
+import type { CellId } from "@/core/cells/ids";
+import type { MarimoError } from "../../../core/kernel/messages";
+import { cn } from "../../../utils/cn";
+import { Alert, AlertTitle } from "../../ui/alert";
import { useChromeActions } from "../chrome/state";
+import { AutoFixButton } from "../errors/auto-fix";
+import { CellLinkError } from "../links/cell-link";
const Tip = (props: {
title?: string;
diff --git a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx b/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
index 2369e770ba..58e58280a3 100644
--- a/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoTracebackOutput.tsx
@@ -1,50 +1,46 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "../../../utils/cn";
-
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
-} from "@/components/ui/accordion";
-import { Button } from "@/components/ui/button";
-import { renderHTML } from "@/plugins/core/RenderHTML";
-
+import { type DOMNode, Element, Text } from "html-react-parser";
+import { useAtomValue } from "jotai";
import {
BugIcon,
+ BugPlayIcon,
ChevronDown,
+ CopyIcon,
ExternalLinkIcon,
- SearchIcon,
MessageCircleIcon,
- CopyIcon,
- BugPlayIcon,
+ SearchIcon,
} from "lucide-react";
-import { useState, type JSX } from "react";
-import { useAtomValue } from "jotai";
-import { aiEnabledAtom } from "@/core/config/config";
-import { Element, Text, type DOMNode } from "html-react-parser";
-import { isWasm } from "@/core/wasm/utils";
-
-import { CellLinkTraceback } from "../links/cell-link";
+import { type JSX, useState } from "react";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+} from "@/components/ui/accordion";
+import { Button } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import { Kbd } from "@/components/ui/kbd";
+import { Tooltip } from "@/components/ui/tooltip";
+import { getCellEditorView } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import { insertDebuggerAtLine } from "@/core/codemirror/editing/debugging";
+import { aiEnabledAtom } from "@/core/config/config";
+import { sendPdb } from "@/core/network/requests";
+import { isWasm } from "@/core/wasm/utils";
+import { renderHTML } from "@/plugins/core/RenderHTML";
import { copyToClipboard } from "@/utils/copy";
import {
elementContainsMarimoCellFile,
extractAllTracebackInfo,
getTracebackInfo,
} from "@/utils/traceback";
-import type { CellId } from "@/core/cells/ids";
-import { Tooltip } from "@/components/ui/tooltip";
-import { Kbd } from "@/components/ui/kbd";
-import { insertDebuggerAtLine } from "@/core/codemirror/editing/debugging";
-import { getCellEditorView } from "@/core/cells/cells";
-
-import { sendPdb } from "@/core/network/requests";
+import { cn } from "../../../utils/cn";
+import { CellLinkTraceback } from "../links/cell-link";
interface Props {
cellId: CellId | undefined;
@@ -147,7 +143,11 @@ export const MarimoTracebackOutput = ({
</a>
</DropdownMenuItem>
<DropdownMenuItem asChild={true}>
- <a target="_blank" href="https://marimo.io/discord?ref=notebook">
+ <a
+ target="_blank"
+ href="https://marimo.io/discord?ref=notebook"
+ rel="noopener"
+ >
<MessageCircleIcon className="h-4 w-4 mr-2" />
Ask in Discord
<ExternalLinkIcon className="h-3 w-3 ml-auto" />
diff --git a/frontend/src/components/editor/output/TextOutput.tsx b/frontend/src/components/editor/output/TextOutput.tsx
index d2456ca950..6afed44538 100644
--- a/frontend/src/components/editor/output/TextOutput.tsx
+++ b/frontend/src/components/editor/output/TextOutput.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { OutputChannel } from "@/core/kernel/messages";
-import { cn } from "@/utils/cn";
import { AnsiUp } from "ansi_up";
import type { JSX } from "react";
+import type { OutputChannel } from "@/core/kernel/messages";
+import { cn } from "@/utils/cn";
const ansiUp = new AnsiUp();
diff --git a/frontend/src/components/editor/output/__tests__/json-output.test.ts b/frontend/src/components/editor/output/__tests__/json-output.test.ts
index e98b4cef7b..2b04a165d8 100644
--- a/frontend/src/components/editor/output/__tests__/json-output.test.ts
+++ b/frontend/src/components/editor/output/__tests__/json-output.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { getCopyValue } from "../JsonOutput";
describe("getCopyValue", () => {
diff --git a/frontend/src/components/editor/output/__tests__/traceback.test.tsx b/frontend/src/components/editor/output/__tests__/traceback.test.tsx
index 58c7f6892f..7a8aee7a9f 100644
--- a/frontend/src/components/editor/output/__tests__/traceback.test.tsx
+++ b/frontend/src/components/editor/output/__tests__/traceback.test.tsx
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { render } from "@testing-library/react";
+import { describe, expect, test } from "vitest";
+import { Tracebacks } from "@/__mocks__/tracebacks";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import type { CellId } from "@/core/cells/ids";
+import { renderHTML } from "@/plugins/core/RenderHTML";
import {
MarimoTracebackOutput,
- replaceTracebackPrefix,
replaceTracebackFilenames,
+ replaceTracebackPrefix,
} from "../MarimoTracebackOutput";
-import { renderHTML } from "@/plugins/core/RenderHTML";
-import { Tracebacks } from "@/__mocks__/tracebacks";
-import { render } from "@testing-library/react";
-import { describe, expect, test } from "vitest";
-import type { CellId } from "@/core/cells/ids";
-import { TooltipProvider } from "@/components/ui/tooltip";
const cellId = "1" as CellId;
diff --git a/frontend/src/components/editor/package-alert.tsx b/frontend/src/components/editor/package-alert.tsx
index f5b159f131..3988e9a1d4 100644
--- a/frontend/src/components/editor/package-alert.tsx
+++ b/frontend/src/components/editor/package-alert.tsx
@@ -1,6 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { zodResolver } from "@hookform/resolvers/zod";
+import {
+ BoxIcon,
+ CheckIcon,
+ DownloadCloudIcon,
+ PackageCheckIcon,
+ PackageXIcon,
+ PlusIcon,
+ XIcon,
+} from "lucide-react";
+import type React from "react";
+import { useState } from "react";
import { useForm } from "react-hook-form";
import {
Form,
@@ -9,51 +20,40 @@ import {
FormItem,
FormMessage,
} from "@/components/ui/form";
-import { saveUserConfig } from "@/core/network/requests";
import {
- type UserConfig,
- UserConfigSchema,
-} from "../../core/config/config-schema";
-import { NativeSelect } from "../ui/native-select";
-import { cn } from "@/utils/cn";
-import { sendInstallMissingPackages } from "@/core/network/requests";
-import {
- useAlerts,
- useAlertActions,
- isMissingPackageAlert,
isInstallingPackageAlert,
+ isMissingPackageAlert,
+ useAlertActions,
+ useAlerts,
} from "@/core/alerts/state";
-import { Banner } from "@/plugins/impl/common/error-banner";
-import {
- PackageXIcon,
- BoxIcon,
- CheckIcon,
- DownloadCloudIcon,
- PackageCheckIcon,
- XIcon,
- PlusIcon,
-} from "lucide-react";
-import type React from "react";
-import { Button } from "../ui/button";
-import type { PackageInstallationStatus } from "@/core/kernel/messages";
-import { logNever } from "@/utils/assertNever";
import { useResolvedMarimoConfig } from "@/core/config/config";
+import type { PackageInstallationStatus } from "@/core/kernel/messages";
+import {
+ saveUserConfig,
+ sendInstallMissingPackages,
+} from "@/core/network/requests";
import { isWasm } from "@/core/wasm/utils";
+import { usePackageMetadata } from "@/hooks/usePackageMetadata";
+import { Banner } from "@/plugins/impl/common/error-banner";
+import { logNever } from "@/utils/assertNever";
+import { cn } from "@/utils/cn";
+import { Logger } from "@/utils/Logger";
import {
type PackageManagerName,
PackageManagerNames,
+ type UserConfig,
+ UserConfigSchema,
} from "../../core/config/config-schema";
-import { Logger } from "@/utils/Logger";
-import { usePackageMetadata } from "@/hooks/usePackageMetadata";
-import { Tooltip } from "../ui/tooltip";
-import { useState } from "react";
-import { ExternalLink } from "../ui/links";
+import { Button } from "../ui/button";
import {
DropdownMenu,
- DropdownMenuContent,
DropdownMenuCheckboxItem,
+ DropdownMenuContent,
DropdownMenuTrigger,
} from "../ui/dropdown-menu";
+import { ExternalLink } from "../ui/links";
+import { NativeSelect } from "../ui/native-select";
+import { Tooltip } from "../ui/tooltip";
function parsePackageSpecifier(spec: string): {
name: string;
diff --git a/frontend/src/components/editor/renderers/CellArray.tsx b/frontend/src/components/editor/renderers/CellArray.tsx
index 4c4587e411..b19e56a9cd 100644
--- a/frontend/src/components/editor/renderers/CellArray.tsx
+++ b/frontend/src/components/editor/renderers/CellArray.tsx
@@ -1,56 +1,57 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import {
+ horizontalListSortingStrategy,
+ SortableContext,
+ verticalListSortingStrategy,
+} from "@dnd-kit/sortable";
+import { useAtomValue } from "jotai";
+import {
+ DatabaseIcon,
+ SparklesIcon,
+ SquareCodeIcon,
+ SquareMIcon,
+} from "lucide-react";
import { useEffect } from "react";
import { Cell } from "@/components/editor/Cell";
-import type { ConnectionStatus } from "../../../core/websocket/types";
+import { PackageAlert } from "@/components/editor/package-alert";
+import { SortableCellsProvider } from "@/components/sort/SortableCellsProvider";
+import { Button } from "@/components/ui/button";
+import { Tooltip } from "@/components/ui/tooltip";
+import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
+import type { CellId } from "@/core/cells/ids";
+import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
+import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
+import { aiEnabledAtom, autoInstantiateAtom } from "@/core/config/config";
+import { useBoolean } from "@/hooks/useBoolean";
+import { cn } from "@/utils/cn";
+import { Functions } from "@/utils/functions";
+import type { CellColumnId, CollapsibleTree } from "@/utils/id-tree";
+import type { Milliseconds } from "@/utils/time";
import {
- useNotebook,
type CellActions,
columnIdsAtom,
type NotebookState,
- useCellActions,
SETUP_CELL_ID,
+ useCellActions,
+ useNotebook,
} from "../../../core/cells/cells";
+import { formatAll } from "../../../core/codemirror/format";
import type { AppConfig, UserConfig } from "../../../core/config/config-schema";
import type { AppMode } from "../../../core/mode";
+import type { ConnectionStatus } from "../../../core/websocket/types";
import { useHotkey } from "../../../hooks/useHotkey";
-import { formatAll } from "../../../core/codemirror/format";
import { type Theme, useTheme } from "../../../theme/useTheme";
-import { VerticalLayoutWrapper } from "./vertical-layout/vertical-layout-wrapper";
-import { useDelayVisibility } from "./vertical-layout/useDelayVisibility";
-import { useChromeActions } from "../chrome/state";
-import { Functions } from "@/utils/functions";
-import { NotebookBanner } from "../notebook-banner";
-import { PackageAlert } from "@/components/editor/package-alert";
-import { useDeleteCellCallback } from "../cell/useDeleteCell";
-import { cn } from "@/utils/cn";
-import { Button } from "@/components/ui/button";
-import {
- DatabaseIcon,
- SparklesIcon,
- SquareCodeIcon,
- SquareMIcon,
-} from "lucide-react";
-import { maybeAddMarimoImport } from "@/core/cells/add-missing-import";
-import { aiEnabledAtom, autoInstantiateAtom } from "@/core/config/config";
-import { useAtomValue } from "jotai";
-import { useBoolean } from "@/hooks/useBoolean";
import { AddCellWithAI } from "../ai/add-cell-with-ai";
-import type { Milliseconds } from "@/utils/time";
-import { SQLLanguageAdapter } from "@/core/codemirror/language/languages/sql";
-import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { Tooltip } from "@/components/ui/tooltip";
+import { ConnectingAlert } from "../alerts/connecting-alert";
+import { useDeleteCellCallback } from "../cell/useDeleteCell";
import { FloatingOutline } from "../chrome/panels/outline/floating-outline";
-import {
- horizontalListSortingStrategy,
- SortableContext,
- verticalListSortingStrategy,
-} from "@dnd-kit/sortable";
-import { SortableCellsProvider } from "@/components/sort/SortableCellsProvider";
+import { useChromeActions } from "../chrome/state";
import { Column } from "../columns/cell-column";
-import type { CellColumnId, CollapsibleTree } from "@/utils/id-tree";
-import type { CellId } from "@/core/cells/ids";
-import { StdinBlockingAlert } from "../alerts/stdin-blocking-alert";
-import { ConnectingAlert } from "../alerts/connecting-alert";
+import { NotebookBanner } from "../notebook-banner";
+import { StdinBlockingAlert } from "../stdin-blocking-alert";
+import { useDelayVisibility } from "./vertical-layout/useDelayVisibility";
+import { VerticalLayoutWrapper } from "./vertical-layout/vertical-layout-wrapper";
interface CellArrayProps {
mode: AppMode;
diff --git a/frontend/src/components/editor/renderers/cells-renderer.tsx b/frontend/src/components/editor/renderers/cells-renderer.tsx
index 629ac20e4e..4fea5ac9df 100644
--- a/frontend/src/components/editor/renderers/cells-renderer.tsx
+++ b/frontend/src/components/editor/renderers/cells-renderer.tsx
@@ -1,17 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { flattenTopLevelNotebookCells, useNotebook } from "@/core/cells/cells";
+
+import { useAtomValue } from "jotai";
import type React from "react";
-import { type PropsWithChildren, memo } from "react";
-import { cellRendererPlugins } from "./plugins";
+import { memo, type PropsWithChildren } from "react";
+import { flattenTopLevelNotebookCells, useNotebook } from "@/core/cells/cells";
import type { AppConfig } from "@/core/config/config-schema";
-import { type AppMode, kioskModeAtom } from "@/core/mode";
+import { KnownQueryParams } from "@/core/constants";
import {
type LayoutData,
useLayoutActions,
useLayoutState,
} from "@/core/layout/layout";
-import { useAtomValue } from "jotai";
-import { KnownQueryParams } from "@/core/constants";
+import { type AppMode, kioskModeAtom } from "@/core/mode";
+import { cellRendererPlugins } from "./plugins";
import {
type ICellRendererPlugin,
type LayoutType,
diff --git a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
index 7d08ffcd6a..107f5b39fd 100644
--- a/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/grid-layout.tsx
@@ -1,23 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, {
- type PropsWithChildren,
memo,
+ type PropsWithChildren,
useEffect,
useMemo,
useState,
} from "react";
import { Responsive, WidthProvider } from "react-grid-layout";
-import type { ICellRendererProps } from "../types";
-import type { GridLayout, GridLayoutCellSide } from "./types";
import { OutputArea } from "@/components/editor/Output";
import type { CellRuntimeState } from "@/core/cells/types";
+import type { ICellRendererProps } from "../types";
+import type { GridLayout, GridLayoutCellSide } from "./types";
import "react-grid-layout/css/styles.css";
import "./styles.css";
-import type { CellId } from "@/core/cells/ids";
-import type { AppMode } from "@/core/mode";
-import { TinyCode } from "@/components/editor/cell/TinyCode";
-import { cn } from "@/utils/cn";
+import { BorderAllIcon } from "@radix-ui/react-icons";
+import { startCase } from "lodash-es";
import {
AlignEndVerticalIcon,
AlignHorizontalSpaceAroundIcon,
@@ -28,21 +26,23 @@ import {
ScrollIcon,
XIcon,
} from "lucide-react";
-import { Label } from "@/components/ui/label";
-import { useIsDragging } from "@/hooks/useIsDragging";
-import { Switch } from "@/components/ui/switch";
+import { TinyCode } from "@/components/editor/cell/TinyCode";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Objects } from "@/utils/objects";
-import { Maps } from "@/utils/maps";
-import { startCase } from "lodash-es";
-import { BorderAllIcon } from "@radix-ui/react-icons";
+import { Label } from "@/components/ui/label";
import { NumberField } from "@/components/ui/number-field";
+import { Switch } from "@/components/ui/switch";
import { outputIsLoading } from "@/core/cells/cell";
+import type { CellId } from "@/core/cells/ids";
+import type { AppMode } from "@/core/mode";
+import { useIsDragging } from "@/hooks/useIsDragging";
+import { cn } from "@/utils/cn";
+import { Maps } from "@/utils/maps";
+import { Objects } from "@/utils/objects";
type Props = ICellRendererProps<GridLayout>;
diff --git a/frontend/src/components/editor/renderers/grid-layout/plugin.tsx b/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
index 43122fef86..7f53a7b015 100644
--- a/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
+++ b/frontend/src/components/editor/renderers/grid-layout/plugin.tsx
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { z } from "zod";
+import type { CellId } from "@/core/cells/ids";
+import { Logger } from "@/utils/Logger";
+import { Maps } from "@/utils/maps";
import type { ICellRendererPlugin } from "../types";
+import { GridLayoutRenderer } from "./grid-layout";
import type {
GridLayout,
GridLayoutCellSide,
SerializedGridLayout,
SerializedGridLayoutCell,
} from "./types";
-import { Logger } from "@/utils/Logger";
-import { z } from "zod";
-import { Maps } from "@/utils/maps";
-import { GridLayoutRenderer } from "./grid-layout";
-import type { CellId } from "@/core/cells/ids";
/**
* Plugin definition for the grid layout.
diff --git a/frontend/src/components/editor/renderers/layout-select.tsx b/frontend/src/components/editor/renderers/layout-select.tsx
index 72c1d0961b..9eac512767 100644
--- a/frontend/src/components/editor/renderers/layout-select.tsx
+++ b/frontend/src/components/editor/renderers/layout-select.tsx
@@ -1,4 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { startCase } from "lodash-es";
+import {
+ Grid3x3Icon,
+ ListIcon,
+ PresentationIcon,
+ SquareIcon,
+} from "lucide-react";
import type React from "react";
import {
Select,
@@ -9,18 +17,11 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { LAYOUT_TYPES, type LayoutType } from "./types";
-import {
- SquareIcon,
- Grid3x3Icon,
- ListIcon,
- PresentationIcon,
-} from "lucide-react";
-import { isWasm } from "@/core/wasm/utils";
+import { getFeatureFlag } from "@/core/config/feature-flag";
import { useLayoutActions, useLayoutState } from "@/core/layout/layout";
+import { isWasm } from "@/core/wasm/utils";
import { logNever } from "@/utils/assertNever";
-import { startCase } from "lodash-es";
-import { getFeatureFlag } from "@/core/config/feature-flag";
+import { LAYOUT_TYPES, type LayoutType } from "./types";
export const LayoutSelect: React.FC = () => {
const { selectedLayout } = useLayoutState();
diff --git a/frontend/src/components/editor/renderers/plugins.ts b/frontend/src/components/editor/renderers/plugins.ts
index 3646d3d0e6..d62121ecdd 100644
--- a/frontend/src/components/editor/renderers/plugins.ts
+++ b/frontend/src/components/editor/renderers/plugins.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { CellData } from "@/core/cells/types";
import { GridLayoutPlugin } from "./grid-layout/plugin";
+import { SlidesLayoutPlugin } from "./slides-layout/plugin";
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";
// If more renderers are added, we may want to consider lazy loading them.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
diff --git a/frontend/src/components/editor/renderers/slides-layout/plugin.tsx b/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
index d1da71f20c..4d8a4d69c1 100644
--- a/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
+++ b/frontend/src/components/editor/renderers/slides-layout/plugin.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { ICellRendererPlugin } from "../types";
-import type { SlidesLayout } from "./types";
+
import { z } from "zod";
+import type { ICellRendererPlugin } from "../types";
import { SlidesLayoutRenderer } from "./slides-layout";
+import type { SlidesLayout } from "./types";
/**
* Plugin definition for the 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 57671ee1ee..0bee1a3e34 100644
--- a/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
+++ b/frontend/src/components/editor/renderers/slides-layout/slides-layout.tsx
@@ -1,13 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, { memo } from "react";
-import type { ICellRendererProps } from "../types";
-import type { SlidesLayout } from "./types";
-
+import { outputIsLoading } from "@/core/cells/cell";
import type { CellId } from "@/core/cells/ids";
import type { CellRuntimeState } from "@/core/cells/types";
import type { AppMode } from "@/core/mode";
import { OutputArea } from "../../Output";
-import { outputIsLoading } from "@/core/cells/cell";
+import type { ICellRendererProps } from "../types";
+import type { SlidesLayout } from "./types";
type Props = ICellRendererProps<SlidesLayout>;
diff --git a/frontend/src/components/editor/renderers/types.ts b/frontend/src/components/editor/renderers/types.ts
index ead06771cb..e99c172d68 100644
--- a/frontend/src/components/editor/renderers/types.ts
+++ b/frontend/src/components/editor/renderers/types.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { AppConfig } from "@/core/config/config-schema";
-import type { CellData, CellRuntimeState } from "@/core/cells/types";
+
import type { ZodType, ZodTypeDef } from "zod";
+import type { CellData, CellRuntimeState } from "@/core/cells/types";
+import type { AppConfig } from "@/core/config/config-schema";
import type { AppMode } from "@/core/mode";
/**
diff --git a/frontend/src/components/editor/renderers/vertical-layout/__tests__/useDelayVisibility.test.ts b/frontend/src/components/editor/renderers/vertical-layout/__tests__/useDelayVisibility.test.ts
index 80319e17fd..01f83971f5 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/__tests__/useDelayVisibility.test.ts
+++ b/frontend/src/components/editor/renderers/vertical-layout/__tests__/useDelayVisibility.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
-import { renderHook, act } from "@testing-library/react";
-import { useDelayVisibility } from "../useDelayVisibility";
+
+import { act, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as cellsModule from "@/core/cells/cells";
+import { useDelayVisibility } from "../useDelayVisibility";
describe("useDelayVisibility", () => {
beforeEach(() => {
diff --git a/frontend/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts b/frontend/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts
index 036793d8dd..f7fb8a49c7 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts
+++ b/frontend/src/components/editor/renderers/vertical-layout/__tests__/vertical-layout.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { groupCellsByColumn } from "../vertical-layout";
describe("groupCellsByColumn", () => {
diff --git a/frontend/src/components/editor/renderers/vertical-layout/sidebar/__tests__/sidebar.test.tsx b/frontend/src/components/editor/renderers/vertical-layout/sidebar/__tests__/sidebar.test.tsx
index 24e513d903..31b68780af 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/sidebar/__tests__/sidebar.test.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/sidebar/__tests__/sidebar.test.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+
+import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
import { render } from "@testing-library/react";
+import { describe, expect, it } from "vitest";
+import { Functions } from "@/utils/functions";
import { Sidebar } from "../sidebar";
import { normalizeWidth } from "../state";
-import { Functions } from "@/utils/functions";
-import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
describe("Sidebar", () => {
it("should use default width when no width is provided", () => {
diff --git a/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar-slot.tsx b/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar-slot.tsx
index 44ad3b7458..4a4b87e890 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar-slot.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar-slot.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { memo } from "react";
+
import { Slot } from "@marimo-team/react-slotz";
+import React, { memo } from "react";
import { SlotNames } from "@/core/slots/slots";
export const SidebarSlot: React.FC = memo(() => {
diff --git a/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar.tsx b/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar.tsx
index 5dbced7304..d7a78f6a73 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/sidebar/sidebar.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { cn } from "@/utils/cn";
-import { SidebarToggle } from "./toggle";
import { SidebarSlot } from "./sidebar-slot";
import { CLOSED_WIDTH } from "./state";
+import { SidebarToggle } from "./toggle";
import "./sidebar.css";
interface SidebarProps {
diff --git a/frontend/src/components/editor/renderers/vertical-layout/sidebar/wrapped-with-sidebar.tsx b/frontend/src/components/editor/renderers/vertical-layout/sidebar/wrapped-with-sidebar.tsx
index c4281f91cd..e88bdc799f 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/sidebar/wrapped-with-sidebar.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/sidebar/wrapped-with-sidebar.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { useSlot } from "@marimo-team/react-slotz";
+import { useAtom } from "jotai";
import type React from "react";
+import { SlotNames } from "@/core/slots/slots";
import { SheetMenu } from "./sheet-sidebar";
-import { useAtom } from "jotai";
-import { normalizeWidth, sidebarAtom } from "./state";
import { Sidebar } from "./sidebar";
-import { useSlot } from "@marimo-team/react-slotz";
-import { SlotNames } from "@/core/slots/slots";
+import { normalizeWidth, sidebarAtom } from "./state";
interface Props {
children: React.ReactNode;
diff --git a/frontend/src/components/editor/renderers/vertical-layout/useDelayVisibility.ts b/frontend/src/components/editor/renderers/vertical-layout/useDelayVisibility.ts
index 9abdaaacc7..48e88c3c5a 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/useDelayVisibility.ts
+++ b/frontend/src/components/editor/renderers/vertical-layout/useDelayVisibility.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { AppMode } from "@/core/mode";
-import { getNotebook } from "@/core/cells/cells";
+
import { useState } from "react";
-import { Logger } from "@/utils/Logger";
+import { getNotebook } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
+import type { AppMode } from "@/core/mode";
import { useOnMount } from "@/hooks/useLifecycle";
import { extractCellNameFromHash } from "@/utils/cell-urls";
+import { Logger } from "@/utils/Logger";
export function useDelayVisibility(numCells: number, mode: AppMode) {
// Start the app as invisible and delay proportional to the number of cells,
diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
index 4698061f6e..879fb448e2 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout-wrapper.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PropsWithChildren } from "react";
-import { cn } from "@/utils/cn";
import type { AppConfig } from "@/core/config/config-schema";
+import { cn } from "@/utils/cn";
interface Props {
className?: string;
diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
index 825d3eadff..d8ffb556f5 100644
--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx
@@ -1,15 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type React from "react";
-import { memo, useRef, useState } from "react";
-import type { CellData, CellRuntimeState } from "@/core/cells/types";
-import { type CellId, HTMLCellId } from "@/core/cells/ids";
-import { OutputArea } from "@/components/editor/Output";
-import type { ICellRendererPlugin, ICellRendererProps } from "../types";
-import { VerticalLayoutWrapper } from "./vertical-layout-wrapper";
-import { z } from "zod";
-import { useDelayVisibility } from "./useDelayVisibility";
-import { type AppMode, kioskModeAtom } from "@/core/mode";
-import { ReadonlyCode } from "@/components/editor/code/readonly-python-code";
+
+import { useAtomValue } from "jotai";
import {
Check,
Code2Icon,
@@ -17,30 +8,40 @@ import {
ImageIcon,
MoreHorizontalIcon,
} from "lucide-react";
-import { cn } from "@/utils/cn";
-import { Button } from "@/components/ui/button";
-import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
-import { isStaticNotebook } from "@/core/static/static-state";
+import type React from "react";
+import { memo, useRef, useState } from "react";
+import { z } from "zod";
+import { ReadonlyCode } from "@/components/editor/code/readonly-python-code";
+import { OutputArea } from "@/components/editor/Output";
import { ConsoleOutput } from "@/components/editor/output/ConsoleOutput";
+import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
+import { Button } from "@/components/ui/button";
import {
- DropdownMenuItem,
DropdownMenu,
DropdownMenuContent,
- DropdownMenuTrigger,
+ DropdownMenuItem,
DropdownMenuSeparator,
+ DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { downloadHTMLAsImage } from "@/utils/download";
+import { outputIsLoading, outputIsStale } from "@/core/cells/cell";
+import { type CellId, HTMLCellId } from "@/core/cells/ids";
+import type { CellData, CellRuntimeState } from "@/core/cells/types";
+import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
+import { useResolvedMarimoConfig } from "@/core/config/config";
+import { KnownQueryParams } from "@/core/constants";
+import { showCodeInRunModeAtom } from "@/core/meta/state";
+import { isErrorMime } from "@/core/mime";
+import { type AppMode, kioskModeAtom } from "@/core/mode";
+import type { CellConfig } from "@/core/network/types";
import { downloadAsHTML } from "@/core/static/download-html";
+import { isStaticNotebook } from "@/core/static/static-state";
import { isWasm } from "@/core/wasm/utils";
-import type { CellConfig } from "@/core/network/types";
-import { useAtomValue } from "jotai";
+import { cn } from "@/utils/cn";
+import { downloadHTMLAsImage } from "@/utils/download";
import { FloatingOutline } from "../../chrome/panels/outline/floating-outline";
-import { KnownQueryParams } from "@/core/constants";
-import { useResolvedMarimoConfig } from "@/core/config/config";
-import { MarkdownLanguageAdapter } from "@/core/codemirror/language/languages/markdown";
-import { isErrorMime } from "@/core/mime";
-import { showCodeInRunModeAtom } from "@/core/meta/state";
-import { Alert, AlertTitle, AlertDescription } from "@/components/ui/alert";
+import type { ICellRendererPlugin, ICellRendererProps } from "../types";
+import { useDelayVisibility } from "./useDelayVisibility";
+import { VerticalLayoutWrapper } from "./vertical-layout-wrapper";
type VerticalLayout = null;
type VerticalLayoutProps = ICellRendererProps<VerticalLayout>;
diff --git a/frontend/src/components/editor/stdin-blocking-alert.tsx b/frontend/src/components/editor/stdin-blocking-alert.tsx
new file mode 100644
index 0000000000..d1fde59f1b
--- /dev/null
+++ b/frontend/src/components/editor/stdin-blocking-alert.tsx
@@ -0,0 +1,83 @@
+/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom, useAtomValue } from "jotai";
+import { notebookAtom } from "@/core/cells/cells";
+import { Banner } from "@/plugins/impl/common/error-banner";
+import { Logger } from "@/utils/Logger";
+import { Button } from "../ui/button";
+import { Kbd } from "../ui/kbd";
+import { DelayMount } from "../utils/delay-mount";
+
+// Atom to check if there is a cell with unresolved stdin
+const hasBlockingStdinAtom = atom((get) => {
+ const notebook = get(notebookAtom);
+
+ // Check each cell in order
+ for (const cellId of notebook.cellIds.inOrderIds) {
+ // Check if the cell is idle and has unresolved stdin
+ const runtime = notebook.cellRuntime[cellId];
+ if (runtime.status === "idle") {
+ const hasUnresolvedStdin = runtime.consoleOutputs.some(
+ (output) => output.channel === "stdin" && output.response === undefined,
+ );
+ if (hasUnresolvedStdin) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+});
+
+export const StdinBlockingAlert: React.FC = () => {
+ const hasBlockingStdin = useAtomValue(hasBlockingStdinAtom);
+
+ const handleJumpToStdin = () => {
+ const el = document.querySelector<HTMLElement>("[data-stdin-blocking]");
+ if (el) {
+ el.scrollIntoView({ behavior: "smooth", block: "center" });
+ requestAnimationFrame(() => {
+ el.focus();
+ });
+ } else {
+ Logger.error("No element with data-stdin-blocking found");
+ }
+ };
+
+ if (!hasBlockingStdin) {
+ return null;
+ }
+
+ const body = (
+ <div className="flex flex-col gap-4 mb-5 fixed top-5 left-1/2 transform -translate-x-1/2 z-[200] opacity-95">
+ <Banner
+ kind="info"
+ className="flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit"
+ >
+ <div className="flex justify-between">
+ <span className="font-bold text-lg flex items-center mb-1">
+ Program waiting for input
+ </span>
+ </div>
+ <div className="flex flex-col gap-4 justify-between items-start text-muted-foreground text-base">
+ <div>
+ <p>
+ The program is still running, but blocked on{" "}
+ <Kbd className="inline">stdin</Kbd>.
+ <Button
+ variant="link"
+ className="h-auto font-normal"
+ onClick={handleJumpToStdin}
+ >
+ Jump to the cell
+ </Button>
+ </p>
+ </div>
+ </div>
+ </Banner>
+ </div>
+ );
+
+ // Delay the mount to avoid flickering
+ return <DelayMount milliseconds={2000}>{body}</DelayMount>;
+};
diff --git a/frontend/src/components/export/export-output-button.tsx b/frontend/src/components/export/export-output-button.tsx
index 632fe9f5ce..9c80f67e76 100644
--- a/frontend/src/components/export/export-output-button.tsx
+++ b/frontend/src/components/export/export-output-button.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { type CellId, CellOutputId } from "@/core/cells/ids";
import { downloadHTMLAsImage } from "@/utils/download";
-import { CellOutputId, type CellId } from "@/core/cells/ids";
export function downloadCellOutput(cellId: CellId) {
const output = document.getElementById(CellOutputId.create(cellId));
diff --git a/frontend/src/components/find-replace/find-replace.tsx b/frontend/src/components/find-replace/find-replace.tsx
index 9fbd0c7f24..6b467095de 100644
--- a/frontend/src/components/find-replace/find-replace.tsx
+++ b/frontend/src/components/find-replace/find-replace.tsx
@@ -1,22 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- findReplaceAtom,
- openFindReplacePanel,
-} from "@/core/codemirror/find-replace/state";
+
+import type { EditorView } from "@codemirror/view";
+import { FocusScope } from "@react-aria/focus";
import { useAtom, useAtomValue } from "jotai";
-import type React from "react";
-import { useEffect, useState, useRef } from "react";
-import { Input } from "../ui/input";
-import { Button } from "../ui/button";
-import {
- getMatches,
- findNext,
- findPrev,
- replaceAll,
- replaceNext,
-} from "@/core/codemirror/find-replace/navigate";
-import { Toggle } from "../ui/toggle";
-import { Tooltip } from "../ui/tooltip";
import {
ArrowLeftIcon,
ArrowRightIcon,
@@ -25,17 +11,32 @@ import {
WholeWordIcon,
XIcon,
} from "lucide-react";
-import { useHotkey } from "@/hooks/useHotkey";
-import type { EditorView } from "@codemirror/view";
-import { FocusScope } from "@react-aria/focus";
-import { toast } from "../ui/use-toast";
+import type React from "react";
+import { useEffect, useRef, useState } from "react";
+import {
+ findNext,
+ findPrev,
+ getMatches,
+ replaceAll,
+ replaceNext,
+} from "@/core/codemirror/find-replace/navigate";
import {
clearGlobalSearchQuery,
setGlobalSearchQuery,
} from "@/core/codemirror/find-replace/search-highlight";
-import { KeyboardHotkeys } from "../shortcuts/renderShortcut";
+import {
+ findReplaceAtom,
+ openFindReplacePanel,
+} from "@/core/codemirror/find-replace/state";
import { hotkeysAtom } from "@/core/config/config";
+import { useHotkey } from "@/hooks/useHotkey";
import { UndoButton } from "../buttons/undo-button";
+import { KeyboardHotkeys } from "../shortcuts/renderShortcut";
+import { Button } from "../ui/button";
+import { Input } from "../ui/input";
+import { Toggle } from "../ui/toggle";
+import { Tooltip } from "../ui/tooltip";
+import { toast } from "../ui/use-toast";
export const FindReplace: React.FC = () => {
const [isFocused, setIsFocused] = useState(false);
diff --git a/frontend/src/components/forms/__tests__/form-utils.test.ts b/frontend/src/components/forms/__tests__/form-utils.test.ts
index ff37e8ef78..fecdb7fc26 100644
--- a/frontend/src/components/forms/__tests__/form-utils.test.ts
+++ b/frontend/src/components/forms/__tests__/form-utils.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
-import { getDefaults } from "@/components/forms/form-utils";
import { z } from "zod";
+import { getDefaults } from "@/components/forms/form-utils";
describe("getDefaults", () => {
it("should return default value for ZodLiteral", () => {
diff --git a/frontend/src/components/forms/form-utils.ts b/frontend/src/components/forms/form-utils.ts
index ed18389a9a..6a4fe1890d 100644
--- a/frontend/src/components/forms/form-utils.ts
+++ b/frontend/src/components/forms/form-utils.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Logger } from "@/utils/Logger";
+
import { z } from "zod";
+import { Logger } from "@/utils/Logger";
/**
* Get default values for a zod schema
diff --git a/frontend/src/components/forms/form.tsx b/frontend/src/components/forms/form.tsx
index b14e691d30..b5a709719d 100644
--- a/frontend/src/components/forms/form.tsx
+++ b/frontend/src/components/forms/form.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { z } from "zod";
-import { DebouncedInput, DebouncedNumberInput } from "../ui/input";
-import { Checkbox } from "../ui/checkbox";
+
+import { PlusIcon, RefreshCcw, Trash2Icon } from "lucide-react";
+import React from "react";
import {
type FieldValues,
FormProvider,
@@ -10,25 +10,12 @@ import {
type UseFormReturn,
useFieldArray,
} from "react-hook-form";
-import {
- FormField,
- FormItem,
- FormLabel,
- FormControl,
- FormMessage,
- FormDescription,
-} from "../ui/form";
-import { Objects } from "../../utils/objects";
-import { Button } from "../ui/button";
-import { getDefaults, getUnionLiteral } from "./form-utils";
-import { PlusIcon, RefreshCcw, Trash2Icon } from "lucide-react";
+import { z } from "zod";
import { FieldOptions, randomNumber } from "@/components/forms/options";
-import { cn } from "@/utils/cn";
-import React from "react";
-import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
-import { Strings } from "@/utils/strings";
+import { Combobox, ComboboxItem } from "@/components/ui/combobox";
import { Label } from "@/components/ui/label";
import { NativeSelect } from "@/components/ui/native-select";
+import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import {
Select,
SelectContent,
@@ -37,14 +24,28 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { Combobox, ComboboxItem } from "@/components/ui/combobox";
+import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
+import { Strings } from "@/utils/strings";
+import { Objects } from "../../utils/objects";
+import { Button } from "../ui/button";
+import { Checkbox } from "../ui/checkbox";
+import {
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "../ui/form";
+import { DebouncedInput, DebouncedNumberInput } from "../ui/input";
+import { Textarea } from "../ui/textarea";
+import { getDefaults, getUnionLiteral } from "./form-utils";
import {
- TextAreaMultiSelect,
ensureStringArray,
SwitchableMultiSelect,
+ TextAreaMultiSelect,
} from "./switchable-multi-select";
-import { Textarea } from "../ui/textarea";
export interface FormRenderer<T extends FieldValues = any, S = any> {
isMatch: (schema: z.ZodType) => schema is z.ZodType<S, z.ZodTypeDef, unknown>;
Component: React.ComponentType<{
diff --git a/frontend/src/components/forms/switchable-multi-select.tsx b/frontend/src/components/forms/switchable-multi-select.tsx
index 7f40b5cffd..37ed7639de 100644
--- a/frontend/src/components/forms/switchable-multi-select.tsx
+++ b/frontend/src/components/forms/switchable-multi-select.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { EditIcon } from "lucide-react";
import React, { useState } from "react";
-import { Textarea } from "../ui/textarea";
+import { cn } from "@/utils/cn";
import { Combobox, ComboboxItem } from "../ui/combobox";
-import { Tooltip } from "../ui/tooltip";
-import { EditIcon } from "lucide-react";
+import { Textarea } from "../ui/textarea";
import { Toggle } from "../ui/toggle";
-import { cn } from "@/utils/cn";
+import { Tooltip } from "../ui/tooltip";
interface Props {
options: string[];
diff --git a/frontend/src/components/home/components.tsx b/frontend/src/components/home/components.tsx
index 09618881e2..d2d468228a 100644
--- a/frontend/src/components/home/components.tsx
+++ b/frontend/src/components/home/components.tsx
@@ -1,36 +1,37 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { openTutorial } from "@/core/network/requests";
-import type React from "react";
+
+import { CaretDownIcon } from "@radix-ui/react-icons";
import {
ActivityIcon,
BarChart2Icon,
+ BookMarkedIcon,
BookOpenIcon,
DatabaseIcon,
FileIcon,
FileTextIcon,
+ GithubIcon,
GraduationCapIcon,
GridIcon,
LayoutIcon,
- OrbitIcon,
- GithubIcon,
LinkIcon,
- BookMarkedIcon,
MessagesSquareIcon,
+ OrbitIcon,
YoutubeIcon,
} from "lucide-react";
-import { Button } from "@/components/ui/button";
-import type { TutorialId } from "@/core/network/types";
+import type React from "react";
import { MarkdownIcon } from "@/components/editor/cell/code/icons";
-import { asURL } from "@/utils/url";
+import { Button } from "@/components/ui/button";
import {
DropdownMenu,
- DropdownMenuTrigger,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Objects } from "@/utils/objects";
-import { CaretDownIcon } from "@radix-ui/react-icons";
import { Constants } from "@/core/constants";
+import { openTutorial } from "@/core/network/requests";
+import type { TutorialId } from "@/core/network/types";
+import { Objects } from "@/utils/objects";
+import { asURL } from "@/utils/url";
const TUTORIALS: Record<
TutorialId,
diff --git a/frontend/src/components/home/state.ts b/frontend/src/components/home/state.ts
index a1f0def913..7cda37cbe2 100644
--- a/frontend/src/components/home/state.ts
+++ b/frontend/src/components/home/state.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, {} from "react";
-import { Functions } from "@/utils/functions";
+
import { atomWithStorage } from "jotai/utils";
+import React from "react";
import type { MarimoFile } from "@/core/network/types";
+import { Functions } from "@/utils/functions";
export type RunningNotebooksMap = Map<string, MarimoFile>;
diff --git a/frontend/src/components/icons/copy-icon.tsx b/frontend/src/components/icons/copy-icon.tsx
index 90b9138767..5d06dd2ac2 100644
--- a/frontend/src/components/icons/copy-icon.tsx
+++ b/frontend/src/components/icons/copy-icon.tsx
@@ -2,10 +2,10 @@
import { CheckIcon, Copy } from "lucide-react";
import type React from "react";
import { useState } from "react";
-import { Tooltip } from "../ui/tooltip";
import { cn } from "@/utils/cn";
-import { Events } from "@/utils/events";
import { copyToClipboard } from "@/utils/copy";
+import { Events } from "@/utils/events";
+import { Tooltip } from "../ui/tooltip";
import { toast } from "../ui/use-toast";
interface Props {
diff --git a/frontend/src/components/icons/large-spinner.tsx b/frontend/src/components/icons/large-spinner.tsx
index 91ecaa9c17..716bba2ac7 100644
--- a/frontend/src/components/icons/large-spinner.tsx
+++ b/frontend/src/components/icons/large-spinner.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
import { Loader2Icon } from "lucide-react";
-import { useState, useEffect } from "react";
+import { useEffect, useState } from "react";
+import { cn } from "@/utils/cn";
export const LargeSpinner = ({ title }: { title?: string }) => {
const [currentTitle, setCurrentTitle] = useState(title);
diff --git a/frontend/src/components/icons/spinner.tsx b/frontend/src/components/icons/spinner.tsx
index 4879329901..2c7767cb36 100644
--- a/frontend/src/components/icons/spinner.tsx
+++ b/frontend/src/components/icons/spinner.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
-import { type VariantProps, cva } from "class-variance-authority";
+import { cva, type VariantProps } from "class-variance-authority";
import { Loader2Icon } from "lucide-react";
import React from "react";
+import { cn } from "@/utils/cn";
const spinnerVariants = cva("animate-spin", {
variants: {
diff --git a/frontend/src/components/modal/ImperativeModal.tsx b/frontend/src/components/modal/ImperativeModal.tsx
index 2f4ecd928f..9755f35d40 100644
--- a/frontend/src/components/modal/ImperativeModal.tsx
+++ b/frontend/src/components/modal/ImperativeModal.tsx
@@ -1,18 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, { type PropsWithChildren } from "react";
-import { Dialog } from "../ui/dialog";
import {
AlertDialog,
AlertDialogAction,
- AlertDialogContent,
- AlertDialogFooter,
AlertDialogCancel,
+ AlertDialogContent,
AlertDialogDescription,
+ AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "../ui/alert-dialog";
-import { Input } from "../ui/input";
import { Button } from "../ui/button";
+import { Dialog } from "../ui/dialog";
+import { Input } from "../ui/input";
interface ModalContextType {
modal: React.ReactNode | null;
diff --git a/frontend/src/components/pages/edit-page.tsx b/frontend/src/components/pages/edit-page.tsx
index 5804106b78..7922aac898 100644
--- a/frontend/src/components/pages/edit-page.tsx
+++ b/frontend/src/components/pages/edit-page.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { AppConfig, UserConfig } from "@/core/config/config-schema";
+import { KnownQueryParams } from "@/core/constants";
import { EditApp } from "@/core/edit-app";
import { AppChrome } from "../editor/chrome/wrapper/app-chrome";
import { CommandPalette } from "../editor/controls/command-palette";
-import type { AppConfig, UserConfig } from "@/core/config/config-schema";
-import { KnownQueryParams } from "@/core/constants";
interface Props {
userConfig: UserConfig;
diff --git a/frontend/src/components/pages/home-page.tsx b/frontend/src/components/pages/home-page.tsx
index 32634faeba..a65f0d4175 100644
--- a/frontend/src/components/pages/home-page.tsx
+++ b/frontend/src/components/pages/home-page.tsx
@@ -1,14 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- getWorkspaceFiles,
- getRecentFiles,
- getRunningNotebooks,
- shutdownSession,
-} from "@/core/network/requests";
-import { combineAsyncData, useAsyncData } from "@/hooks/useAsyncData";
-import type React from "react";
-import { Suspense, use, useEffect, useRef, useState } from "react";
-import { Spinner } from "../icons/spinner";
+
+import { useAtom, useSetAtom } from "jotai";
import {
BookTextIcon,
ChevronDownIcon,
@@ -21,53 +13,62 @@ import {
RefreshCcwIcon,
SearchIcon,
} from "lucide-react";
-import { ShutdownButton } from "../editor/controls/shutdown-button";
-import { getSessionId, isSessionId } from "@/core/kernel/session";
-import { useInterval } from "@/hooks/useInterval";
-import { useImperativeModal } from "@/components/modal/ImperativeModal";
-import { AlertDialogDestructiveAction } from "@/components/ui/alert-dialog";
-import { assertExists } from "@/utils/assertExists";
-import { Button } from "@/components/ui/button";
-import { Tooltip } from "@/components/ui/tooltip";
-import { toast } from "@/components/ui/use-toast";
-import type { FileInfo, MarimoFile } from "@/core/network/types";
-import { ConfigButton } from "../app-config/app-config-button";
-import { Checkbox } from "@/components/ui/checkbox";
-import { Label } from "@/components/ui/label";
-import { MarkdownIcon } from "@/components/editor/cell/code/icons";
-import { asURL } from "@/utils/url";
-import { timeAgo } from "@/utils/dates";
+import type React from "react";
+import { Suspense, use, useEffect, useRef, useState } from "react";
import {
type NodeApi,
type NodeRendererProps,
Tree,
type TreeApi,
} from "react-arborist";
+import { MarkdownIcon } from "@/components/editor/cell/code/icons";
+import { useImperativeModal } from "@/components/modal/ImperativeModal";
+import { AlertDialogDestructiveAction } from "@/components/ui/alert-dialog";
+import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
+import { Label } from "@/components/ui/label";
+import { Tooltip } from "@/components/ui/tooltip";
+import { toast } from "@/components/ui/use-toast";
+import { getSessionId, isSessionId } from "@/core/kernel/session";
+import {
+ getRecentFiles,
+ getRunningNotebooks,
+ getWorkspaceFiles,
+ shutdownSession,
+} from "@/core/network/requests";
+import type { FileInfo, MarimoFile } from "@/core/network/types";
+import { combineAsyncData, useAsyncData } from "@/hooks/useAsyncData";
+import { useInterval } from "@/hooks/useInterval";
+import { Banner } from "@/plugins/impl/common/error-banner";
+import { assertExists } from "@/utils/assertExists";
import { cn } from "@/utils/cn";
+import { timeAgo } from "@/utils/dates";
+import { prettyError } from "@/utils/errors";
+import { Maps } from "@/utils/maps";
+import { Paths } from "@/utils/paths";
+import { asURL } from "@/utils/url";
+import { newNotebookURL } from "@/utils/urls";
+import { ConfigButton } from "../app-config/app-config-button";
+import { ErrorBoundary } from "../editor/boundary/ErrorBoundary";
+import { ShutdownButton } from "../editor/controls/shutdown-button";
import {
+ FILE_TYPE_ICONS,
type FileType,
guessFileType,
- FILE_TYPE_ICONS,
} from "../editor/file-tree/types";
-import { useAtom, useSetAtom } from "jotai";
+import {
+ Header,
+ OpenTutorialDropDown,
+ ResourceLinks,
+} from "../home/components";
import {
expandedFoldersAtom,
includeMarkdownAtom,
RunningNotebooksContext,
WorkspaceRootContext,
} from "../home/state";
-import { Maps } from "@/utils/maps";
+import { Spinner } from "../icons/spinner";
import { Input } from "../ui/input";
-import { Paths } from "@/utils/paths";
-import { ErrorBoundary } from "../editor/boundary/ErrorBoundary";
-import { Banner } from "@/plugins/impl/common/error-banner";
-import { prettyError } from "@/utils/errors";
-import { newNotebookURL } from "@/utils/urls";
-import {
- Header,
- OpenTutorialDropDown,
- ResourceLinks,
-} from "../home/components";
function tabTarget(path: string) {
// Consistent tab target so we open in the same tab when clicking on the same notebook
@@ -384,11 +385,7 @@ const NotebookList: React.FC<{
);
};
-const MarimoFileComponent = ({
- file,
-}: {
- file: MarimoFile;
-}) => {
+const MarimoFileComponent = ({ file }: { file: MarimoFile }) => {
// If path is a sessionId, then it has not been saved yet
// We want to keep the sessionId in this case
const isNewNotebook = isSessionId(file.path);
diff --git a/frontend/src/components/pages/run-page.tsx b/frontend/src/components/pages/run-page.tsx
index d04ad94927..17aa819535 100644
--- a/frontend/src/components/pages/run-page.tsx
+++ b/frontend/src/components/pages/run-page.tsx
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Panel, PanelGroup } from "react-resizable-panels";
import type { AppConfig } from "@/core/config/config-schema";
+import { Constants } from "@/core/constants";
import { RunApp } from "@/core/run-app";
-import { StaticBanner } from "../static-html/static-banner";
import { isStaticNotebook } from "@/core/static/static-state";
import { isWasm } from "@/core/wasm/utils";
-import { Constants } from "@/core/constants";
+import faviconUrl from "../../../public/favicon.ico?inline";
import { ContextAwarePanel } from "../editor/chrome/panels/context-aware-panel/context-aware-panel";
-import { PanelGroup, Panel } from "react-resizable-panels";
-import { createStorage } from "../editor/chrome/wrapper/storage";
import { PanelsWrapper } from "../editor/chrome/wrapper/panels";
-import faviconUrl from "../../../public/favicon.ico?inline";
+import { createStorage } from "../editor/chrome/wrapper/storage";
+import { StaticBanner } from "../static-html/static-banner";
interface Props {
appConfig: AppConfig;
diff --git a/frontend/src/components/scratchpad/scratchpad.tsx b/frontend/src/components/scratchpad/scratchpad.tsx
index 5a82ed9eb6..b503dc264e 100644
--- a/frontend/src/components/scratchpad/scratchpad.tsx
+++ b/frontend/src/components/scratchpad/scratchpad.tsx
@@ -1,44 +1,45 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { EditorView } from "@codemirror/view";
+import { useAtom, useAtomValue, useSetAtom } from "jotai";
+import {
+ BetweenHorizontalStartIcon,
+ EraserIcon,
+ HistoryIcon,
+ PlayIcon,
+} from "lucide-react";
import type React from "react";
-import { useResolvedMarimoConfig } from "@/core/config/config";
import { useRef, useState } from "react";
-import { useTheme } from "@/theme/useTheme";
-import { CellEditor } from "../editor/cell/code/cell-editor";
-import { HTMLCellId } from "@/core/cells/ids";
-import { Functions } from "@/utils/functions";
-import type { EditorView } from "@codemirror/view";
import useEvent from "react-use-event-hook";
-import { sendRunScratchpad } from "@/core/network/requests";
-import { OutputArea } from "../editor/Output";
-import { ConsoleOutput } from "../editor/output/ConsoleOutput";
import {
SCRATCH_CELL_ID,
useCellActions,
useNotebook,
} from "@/core/cells/cells";
+import { useLastFocusedCellId } from "@/core/cells/focus";
+import { HTMLCellId } from "@/core/cells/ids";
import { DEFAULT_CELL_NAME } from "@/core/cells/names";
-import { Button } from "../ui/button";
-import { Tooltip } from "../ui/tooltip";
-import { renderShortcut } from "../shortcuts/renderShortcut";
-import {
- BetweenHorizontalStartIcon,
- EraserIcon,
- PlayIcon,
- HistoryIcon,
-} from "lucide-react";
+import type { LanguageAdapterType } from "@/core/codemirror/language/types";
+import { useResolvedMarimoConfig } from "@/core/config/config";
+import { sendRunScratchpad } from "@/core/network/requests";
+import type { CellConfig } from "@/core/network/types";
+import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
+import { useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { Functions } from "@/utils/functions";
+import { CellEditor } from "../editor/cell/code/cell-editor";
import { HideInKioskMode } from "../editor/kiosk-mode";
-import { useLastFocusedCellId } from "@/core/cells/focus";
+import { OutputArea } from "../editor/Output";
+import { ConsoleOutput } from "../editor/output/ConsoleOutput";
import { Spinner } from "../icons/spinner";
-import { useAtom, useAtomValue, useSetAtom } from "jotai";
+import { renderShortcut } from "../shortcuts/renderShortcut";
+import { Button } from "../ui/button";
+import { Tooltip } from "../ui/tooltip";
import {
addToHistoryAtom,
- scratchpadHistoryAtom,
historyVisibleAtom,
+ scratchpadHistoryAtom,
} from "./scratchpad-history";
-import { cn } from "@/utils/cn";
-import type { CellConfig } from "@/core/network/types";
-import { LazyAnyLanguageCodeMirror } from "@/plugins/impl/code/LazyAnyLanguageCodeMirror";
-import type { LanguageAdapterType } from "@/core/codemirror/language/types";
const scratchpadCellConfig: CellConfig = {
hide_code: false,
diff --git a/frontend/src/components/shortcuts/renderShortcut.tsx b/frontend/src/components/shortcuts/renderShortcut.tsx
index 54e8bd185c..44f900cef4 100644
--- a/frontend/src/components/shortcuts/renderShortcut.tsx
+++ b/frontend/src/components/shortcuts/renderShortcut.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
+import { hotkeysAtom } from "@/core/config/config";
import { type HotkeyAction, NOT_SET } from "@/core/hotkeys/hotkeys";
import { isPlatformMac } from "@/core/hotkeys/shortcuts";
-import { Kbd } from "../ui/kbd";
+import { cn } from "@/utils/cn";
import { DropdownMenuShortcut } from "../ui/dropdown-menu";
+import { Kbd } from "../ui/kbd";
import { Tooltip } from "../ui/tooltip";
-import { hotkeysAtom } from "@/core/config/config";
-import { useAtomValue } from "jotai";
-import { cn } from "@/utils/cn";
export function renderShortcut(shortcut: HotkeyAction, includeName = true) {
return <Shortcut shortcut={shortcut} includeName={includeName} />;
diff --git a/frontend/src/components/slides/slides-component.tsx b/frontend/src/components/slides/slides-component.tsx
index 0b16e84e04..71861300a8 100644
--- a/frontend/src/components/slides/slides-component.tsx
+++ b/frontend/src/components/slides/slides-component.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, useEffect, type JSX } from "react";
-import { Swiper, SwiperSlide, type SwiperRef } from "swiper/react";
+import React, { type JSX, type PropsWithChildren, useEffect } from "react";
import {
- Virtual,
Keyboard,
+ Navigation,
Pagination,
+ Virtual,
Zoom,
- Navigation,
} from "swiper/modules";
+import { Swiper, type SwiperRef, SwiperSlide } from "swiper/react";
import { Button } from "@/components/ui/button";
-import { cn } from "@/utils/cn";
import { useEventListener } from "@/hooks/useEventListener";
+import { cn } from "@/utils/cn";
import "./slides.css";
import "swiper/css";
diff --git a/frontend/src/components/sort/SortableCellsProvider.tsx b/frontend/src/components/sort/SortableCellsProvider.tsx
index 701b075c35..a6be92928b 100644
--- a/frontend/src/components/sort/SortableCellsProvider.tsx
+++ b/frontend/src/components/sort/SortableCellsProvider.tsx
@@ -1,30 +1,31 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useMemo, useState, useCallback } from "react";
+
import {
- DndContext,
+ type AutoScrollOptions,
+ type CollisionDetection,
closestCenter,
- KeyboardSensor,
- PointerSensor,
- useSensor,
+ DndContext,
type DragEndEvent,
- useSensors,
- type AutoScrollOptions,
- type UniqueIdentifier,
type DragStartEvent,
+ getFirstCollision,
+ KeyboardSensor,
+ PointerSensor,
pointerWithin,
rectIntersection,
- getFirstCollision,
- type CollisionDetection,
+ type UniqueIdentifier,
+ useSensor,
+ useSensors,
} from "@dnd-kit/core";
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
import { sortableKeyboardCoordinates } from "@dnd-kit/sortable";
-import { getNotebook, useCellActions } from "../../core/cells/cells";
-import { useEvent } from "../../hooks/useEvent";
+import React, { useCallback, useMemo, useState } from "react";
import type { CellId } from "@/core/cells/ids";
import { useAppConfig } from "@/core/config/config";
import { Arrays } from "@/utils/arrays";
import type { CellColumnId, MultiColumn } from "@/utils/id-tree";
import { invariant } from "@/utils/invariant";
+import { getNotebook, useCellActions } from "../../core/cells/cells";
+import { useEvent } from "../../hooks/useEvent";
interface SortableCellsProviderProps {
multiColumn: boolean;
diff --git a/frontend/src/components/static-html/share-modal.tsx b/frontend/src/components/static-html/share-modal.tsx
index 58e7485ed7..b1f412e016 100644
--- a/frontend/src/components/static-html/share-modal.tsx
+++ b/frontend/src/components/static-html/share-modal.tsx
@@ -1,22 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { CopyIcon } from "lucide-react";
+import React, { useMemo, useState } from "react";
+import { Button } from "@/components/ui/button";
import {
- DialogFooter,
DialogContent,
+ DialogDescription,
+ DialogFooter,
DialogHeader,
DialogTitle,
- DialogDescription,
} from "@/components/ui/dialog";
-import React, { useMemo, useState } from "react";
-import { Button } from "@/components/ui/button";
import { toast } from "@/components/ui/use-toast";
-import { Input } from "../ui/input";
-import { CopyIcon } from "lucide-react";
-import { Events } from "@/utils/events";
-import { Tooltip } from "../ui/tooltip";
import { Constants } from "@/core/constants";
import { exportAsHTML } from "@/core/network/requests";
import { VirtualFileTracker } from "@/core/static/virtual-file-tracker";
import { copyToClipboard } from "@/utils/copy";
+import { Events } from "@/utils/events";
+import { Input } from "../ui/input";
+import { Tooltip } from "../ui/tooltip";
const BASE_URL = "https://static.marimo.app";
diff --git a/frontend/src/components/static-html/static-banner.tsx b/frontend/src/components/static-html/static-banner.tsx
index 3d47794d1e..95f5129399 100644
--- a/frontend/src/components/static-html/static-banner.tsx
+++ b/frontend/src/components/static-html/static-banner.tsx
@@ -2,26 +2,26 @@
/* eslint-disable react/jsx-no-comment-textnodes */
/* eslint-disable react/jsx-no-target-blank */
-import { isStaticNotebook } from "@/core/static/static-state";
+import { useAtomValue } from "jotai";
+import { CopyIcon, DownloadIcon } from "lucide-react";
import type React from "react";
-import { Button } from "../ui/button";
-import { toast } from "../ui/use-toast";
+import { Constants } from "@/core/constants";
+import { codeAtom } from "@/core/saving/file-state";
+import { useFilename } from "@/core/saving/filename";
+import { isStaticNotebook } from "@/core/static/static-state";
+import { createShareableLink } from "@/core/wasm/share";
+import { copyToClipboard } from "@/utils/copy";
import { downloadBlob } from "@/utils/download";
+import { Button } from "../ui/button";
import {
- DialogHeader,
Dialog,
DialogContent,
DialogDescription,
+ DialogHeader,
DialogTitle,
DialogTrigger,
} from "../ui/dialog";
-import { CopyIcon, DownloadIcon } from "lucide-react";
-import { createShareableLink } from "@/core/wasm/share";
-import { copyToClipboard } from "@/utils/copy";
-import { Constants } from "@/core/constants";
-import { useFilename } from "@/core/saving/filename";
-import { useAtomValue } from "jotai";
-import { codeAtom } from "@/core/saving/file-state";
+import { toast } from "../ui/use-toast";
export const StaticBanner: React.FC = () => {
const code = useAtomValue(codeAtom);
diff --git a/frontend/src/components/terminal/terminal.tsx b/frontend/src/components/terminal/terminal.tsx
index cb53379753..9d6f072787 100644
--- a/frontend/src/components/terminal/terminal.tsx
+++ b/frontend/src/components/terminal/terminal.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useEffect, useRef, useState } from "react";
-import { Terminal } from "@xterm/xterm";
+
import { AttachAddon } from "@xterm/addon-attach";
import { FitAddon } from "@xterm/addon-fit";
+import { Terminal } from "@xterm/xterm";
+import React, { useEffect, useRef, useState } from "react";
import "@xterm/xterm/css/xterm.css";
import "./xterm.css";
+import { waitForConnectionOpen } from "@/core/network/connection";
import { useRuntimeManager } from "@/core/runtime/config";
import { Logger } from "@/utils/Logger";
-import { waitForConnectionOpen } from "@/core/network/connection";
const TerminalComponent: React.FC<{
visible: boolean;
diff --git a/frontend/src/components/terminal/xterm.css b/frontend/src/components/terminal/xterm.css
index de1a06ff7c..f4a7795ce1 100644
--- a/frontend/src/components/terminal/xterm.css
+++ b/frontend/src/components/terminal/xterm.css
@@ -1,3 +1,3 @@
.xterm {
- padding: .5rem;
+ padding: 0.5rem;
}
diff --git a/frontend/src/components/tracing/tracing-spec.ts b/frontend/src/components/tracing/tracing-spec.ts
index a16f1cea06..ea1915e898 100644
--- a/frontend/src/components/tracing/tracing-spec.ts
+++ b/frontend/src/components/tracing/tracing-spec.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { TimeUnit } from "vega";
+import type { TopLevelSpec } from "vega-lite";
import type { CellId } from "@/core/cells/ids";
import type { CellRun } from "@/core/cells/runs";
import type { ResolvedTheme } from "@/theme/useTheme";
-import type { TimeUnit } from "vega";
-import type { TopLevelSpec } from "vega-lite";
export const REACT_HOVERED_CELLID = "hoveredCellId";
export const VEGA_HOVER_SIGNAL = "cellHover";
diff --git a/frontend/src/components/tracing/tracing.test.tsx b/frontend/src/components/tracing/tracing.test.tsx
index bb9e73828f..b9b94c443f 100644
--- a/frontend/src/components/tracing/tracing.test.tsx
+++ b/frontend/src/components/tracing/tracing.test.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, beforeAll, afterAll, vi } from "vitest";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { formatChartTime } from "./tracing";
describe("formatChartTime", () => {
diff --git a/frontend/src/components/tracing/tracing.tsx b/frontend/src/components/tracing/tracing.tsx
index 33e3b79a75..0c9b0fe657 100644
--- a/frontend/src/components/tracing/tracing.tsx
+++ b/frontend/src/components/tracing/tracing.tsx
@@ -1,41 +1,42 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useRef, useState, type JSX } from "react";
-import type { CellId } from "@/core/cells/ids";
-import { ElapsedTime, formatElapsedTime } from "../editor/cell/CellStatus";
-import { Tooltip } from "@/components/ui/tooltip";
-import { compile } from "vega-lite";
+
+import { atom, useAtomValue, useSetAtom } from "jotai";
import {
- ChevronRight,
- ChevronDown,
ActivityIcon,
- CirclePlayIcon,
+ ChevronDown,
+ ChevronRight,
CircleCheck,
CircleEllipsis,
+ CirclePlayIcon,
CircleX,
} from "lucide-react";
+import React, { type JSX, useRef, useState } from "react";
import type { SignalListeners, VisualizationSpec } from "react-vega";
+import useResizeObserver from "use-resize-observer";
+import { compile } from "vega-lite";
+import { Tooltip } from "@/components/ui/tooltip";
+import { useCellIds } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import { formatLogTimestamp } from "@/core/cells/logs";
import {
- type RunId,
- runsAtom,
type CellRun,
type Run,
+ type RunId,
+ runsAtom,
useRunsActions,
} from "@/core/cells/runs";
-import { atom, useAtomValue, useSetAtom } from "jotai";
+import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { ClearButton } from "../buttons/clear-button";
+import { ElapsedTime, formatElapsedTime } from "../editor/cell/CellStatus";
+import { PanelEmptyState } from "../editor/chrome/panels/empty-state";
import { CellLink } from "../editor/links/cell-link";
-import { formatLogTimestamp } from "@/core/cells/logs";
-import { useCellIds } from "@/core/cells/cells";
import {
type ChartPosition,
type ChartValues,
createGanttBaseSpec,
VEGA_HOVER_SIGNAL,
} from "./tracing-spec";
-import { ClearButton } from "../buttons/clear-button";
-import { cn } from "@/utils/cn";
-import { PanelEmptyState } from "../editor/chrome/panels/empty-state";
-import { type ResolvedTheme, useTheme } from "@/theme/useTheme";
-import useResizeObserver from "use-resize-observer";
const expandedRunsAtom = atom<Map<RunId, boolean>>(new Map<RunId, boolean>());
diff --git a/frontend/src/components/ui/accordion.tsx b/frontend/src/components/ui/accordion.tsx
index 4755b9bea9..5345fdb741 100644
--- a/frontend/src/components/ui/accordion.tsx
+++ b/frontend/src/components/ui/accordion.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
import { ChevronDown } from "lucide-react";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/alert-dialog.tsx b/frontend/src/components/ui/alert-dialog.tsx
index 28bdf317e4..1ed1591415 100644
--- a/frontend/src/components/ui/alert-dialog.tsx
+++ b/frontend/src/components/ui/alert-dialog.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
-import { cn } from "@/utils/cn";
+import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
+import * as React from "react";
import { buttonVariants } from "@/components/ui/button";
-import { useRestoreFocus } from "./use-restore-focus";
-import { withFullScreenAsRoot } from "./fullscreen";
import { StyleNamespace } from "@/theme/namespace";
+import { cn } from "@/utils/cn";
+import { withFullScreenAsRoot } from "./fullscreen";
+import { useRestoreFocus } from "./use-restore-focus";
const AlertDialog = AlertDialogPrimitive.Root;
diff --git a/frontend/src/components/ui/alert.tsx b/frontend/src/components/ui/alert.tsx
index 153eae6e9b..0777c93ede 100644
--- a/frontend/src/components/ui/alert.tsx
+++ b/frontend/src/components/ui/alert.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";
-import { type VariantProps, cva } from "class-variance-authority";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/aria-popover.tsx b/frontend/src/components/ui/aria-popover.tsx
index bd2beb85d1..2770dacb1c 100644
--- a/frontend/src/components/ui/aria-popover.tsx
+++ b/frontend/src/components/ui/aria-popover.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
import {
Dialog as AriaDialog,
type DialogProps as AriaDialogProps,
@@ -8,6 +8,7 @@ import {
type PopoverProps as AriaPopoverProps,
composeRenderProps,
} from "react-aria-components";
+import { cn } from "@/utils/cn";
const PopoverTrigger = AriaDialogTrigger;
diff --git a/frontend/src/components/ui/badge.tsx b/frontend/src/components/ui/badge.tsx
index 3db8a2d47a..648dbb8f44 100644
--- a/frontend/src/components/ui/badge.tsx
+++ b/frontend/src/components/ui/badge.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { cva, type VariantProps } from "class-variance-authority";
import * as React from "react";
-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 2a47c73b76..ba8fd7b33d 100644
--- a/frontend/src/components/ui/button.tsx
+++ b/frontend/src/components/ui/button.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import { Slot } from "@radix-ui/react-slot";
-import { type VariantProps, cva } from "class-variance-authority";
-import { cn } from "@/utils/cn";
+import { Slot } from "@radix-ui/react-slot";
+import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
import { parseShortcut } from "@/core/hotkeys/shortcuts";
import { useEventListener } from "@/hooks/useEventListener";
+import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
const activeCommon = "active:shadow-none";
diff --git a/frontend/src/components/ui/calendar.tsx b/frontend/src/components/ui/calendar.tsx
index 435ac6ca7f..6ae114a277 100644
--- a/frontend/src/components/ui/calendar.tsx
+++ b/frontend/src/components/ui/calendar.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
import { getLocalTimeZone, today } from "@internationalized/date";
import { ChevronLeft, ChevronRight } from "lucide-react";
+import * as React from "react";
import {
Button as AriaButton,
Calendar as AriaCalendar,
diff --git a/frontend/src/components/ui/checkbox.tsx b/frontend/src/components/ui/checkbox.tsx
index d3bcbc3a05..98b8c90013 100644
--- a/frontend/src/components/ui/checkbox.tsx
+++ b/frontend/src/components/ui/checkbox.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
import { Check } from "lucide-react";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/combobox.tsx b/frontend/src/components/ui/combobox.tsx
index 5609b22ba3..038a4233ea 100644
--- a/frontend/src/components/ui/combobox.tsx
+++ b/frontend/src/components/ui/combobox.tsx
@@ -1,8 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ChevronDownIcon, Check, XCircle } from "lucide-react";
+
+import { useControllableState } from "@radix-ui/react-use-controllable-state";
+import { Check, ChevronDownIcon, XCircle } from "lucide-react";
import React, { createContext } from "react";
import { cn } from "../../utils/cn";
-import { useControllableState } from "@radix-ui/react-use-controllable-state";
+import { Functions } from "../../utils/functions";
+import { Badge } from "./badge";
import {
Command,
CommandEmpty,
@@ -11,8 +14,6 @@ import {
CommandList,
} from "./command";
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
-import { Functions } from "../../utils/functions";
-import { Badge } from "./badge";
interface ComboboxContextValue {
isSelected: (value: unknown) => boolean;
diff --git a/frontend/src/components/ui/command.tsx b/frontend/src/components/ui/command.tsx
index 5c0569b10d..a1bec17e90 100644
--- a/frontend/src/components/ui/command.tsx
+++ b/frontend/src/components/ui/command.tsx
@@ -1,19 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import type { DialogProps } from "@radix-ui/react-dialog";
+import type { VariantProps } from "class-variance-authority";
import { Command as CommandPrimitive } from "cmdk";
import { Search } from "lucide-react";
-
-import { cn } from "@/utils/cn";
+import * as React from "react";
import { Dialog, DialogContent } from "@/components/ui/dialog";
+import { cn } from "@/utils/cn";
+import { Strings } from "@/utils/strings";
import {
MENU_ITEM_DISABLED,
MenuShortcut,
menuItemVariants,
menuSeparatorVariants,
} from "./menu-items";
-import { Strings } from "@/utils/strings";
-import type { VariantProps } from "class-variance-authority";
const Command = React.forwardRef<
React.ElementRef<typeof CommandPrimitive>,
diff --git a/frontend/src/components/ui/context-menu.tsx b/frontend/src/components/ui/context-menu.tsx
index 405a726b39..fa32783f74 100644
--- a/frontend/src/components/ui/context-menu.tsx
+++ b/frontend/src/components/ui/context-menu.tsx
@@ -1,13 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
import {
CheckIcon,
ChevronRightIcon,
DotFilledIcon,
} from "@radix-ui/react-icons";
-
+import type { VariantProps } from "class-variance-authority";
+import * as React from "react";
+import { StyleNamespace } from "@/theme/namespace";
import { cn } from "@/utils/cn";
+import { withFullScreenAsRoot } from "./fullscreen";
import {
MenuShortcut,
menuContentCommon,
@@ -17,9 +20,6 @@ import {
menuSeparatorVariants,
menuSubTriggerVariants,
} from "./menu-items";
-import type { VariantProps } from "class-variance-authority";
-import { withFullScreenAsRoot } from "./fullscreen";
-import { StyleNamespace } from "@/theme/namespace";
const ContextMenu = ContextMenuPrimitive.Root;
const ContextMenuTrigger = ContextMenuPrimitive.Trigger;
diff --git a/frontend/src/components/ui/date-input.tsx b/frontend/src/components/ui/date-input.tsx
index 4460e8fe86..76693e2d40 100644
--- a/frontend/src/components/ui/date-input.tsx
+++ b/frontend/src/components/ui/date-input.tsx
@@ -15,9 +15,8 @@ import {
composeRenderProps,
Text,
} from "react-aria-components";
-
-import { FieldError, fieldGroupVariants, Label } from "./field";
import { cn } from "@/utils/cn";
+import { FieldError, fieldGroupVariants, Label } from "./field";
const DateSegment = ({ className, ...props }: AriaDateSegmentProps) => {
return (
diff --git a/frontend/src/components/ui/date-picker.tsx b/frontend/src/components/ui/date-picker.tsx
index 123159c6fc..e71119899c 100644
--- a/frontend/src/components/ui/date-picker.tsx
+++ b/frontend/src/components/ui/date-picker.tsx
@@ -1,20 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { CalendarIcon } from "lucide-react";
+import { useState } from "react";
import {
+ Button as AriaButton,
DatePicker as AriaDatePicker,
type DatePickerProps as AriaDatePickerProps,
DateRangePicker as AriaDateRangePicker,
- Dialog as AriaDialog,
- Button as AriaButton,
type DateRangePickerProps as AriaDateRangePickerProps,
type DateValue as AriaDateValue,
+ Dialog as AriaDialog,
type DialogProps as AriaDialogProps,
type PopoverProps as AriaPopoverProps,
type ValidationResult as AriaValidationResult,
composeRenderProps,
Text,
} from "react-aria-components";
-
+import { cn } from "@/utils/cn";
+import { Popover } from "./aria-popover";
import { buttonVariants } from "./button";
import {
Calendar,
@@ -26,11 +28,8 @@ import {
CalendarHeading,
RangeCalendar,
} from "./calendar";
-import { cn } from "@/utils/cn";
-import { FieldGroup, FieldError, Label } from "./field";
import { DateInput } from "./date-input";
-import { Popover } from "./aria-popover";
-import { useState } from "react";
+import { FieldError, FieldGroup, Label } from "./field";
const DatePickerContent = ({
className,
diff --git a/frontend/src/components/ui/dialog.tsx b/frontend/src/components/ui/dialog.tsx
index 25c6d32bde..799a57b46b 100644
--- a/frontend/src/components/ui/dialog.tsx
+++ b/frontend/src/components/ui/dialog.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { X } from "lucide-react";
-
+import * as React from "react";
+import { StyleNamespace } from "@/theme/namespace";
import { cn } from "@/utils/cn";
-import { useRestoreFocus } from "./use-restore-focus";
import { withFullScreenAsRoot } from "./fullscreen";
-import { StyleNamespace } from "@/theme/namespace";
+import { useRestoreFocus } from "./use-restore-focus";
const Dialog = DialogPrimitive.Root;
diff --git a/frontend/src/components/ui/draggable-popover.tsx b/frontend/src/components/ui/draggable-popover.tsx
index ad91f51749..0bed14d97a 100644
--- a/frontend/src/components/ui/draggable-popover.tsx
+++ b/frontend/src/components/ui/draggable-popover.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type * as PopoverPrimitive from "@radix-ui/react-popover";
+import { GripHorizontalIcon } from "lucide-react";
import { useRef, useState } from "react";
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
-import { GripHorizontalIcon } from "lucide-react";
-import type * as PopoverPrimitive from "@radix-ui/react-popover";
interface DraggablePopoverProps extends PopoverPrimitive.PopoverProps {
children: React.ReactNode;
diff --git a/frontend/src/components/ui/dropdown-menu.tsx b/frontend/src/components/ui/dropdown-menu.tsx
index dbeff13e15..66a3aac6a7 100644
--- a/frontend/src/components/ui/dropdown-menu.tsx
+++ b/frontend/src/components/ui/dropdown-menu.tsx
@@ -1,5 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
+import type { VariantProps } from "class-variance-authority";
+import { Check, ChevronRight, Circle } from "lucide-react";
+import React from "react";
+import { StyleNamespace } from "@/theme/namespace";
+import { cn } from "@/utils/cn";
+import { withFullScreenAsRoot } from "./fullscreen";
import {
MenuShortcut,
menuContentCommon,
@@ -10,12 +16,6 @@ import {
menuSeparatorVariants,
menuSubTriggerVariants,
} from "./menu-items";
-import { cn } from "@/utils/cn";
-import React from "react";
-import { Check, ChevronRight, Circle } from "lucide-react";
-import type { VariantProps } from "class-variance-authority";
-import { withFullScreenAsRoot } from "./fullscreen";
-import { StyleNamespace } from "@/theme/namespace";
const DropdownMenu = DropdownMenuPrimitive.Root;
const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
diff --git a/frontend/src/components/ui/field.tsx b/frontend/src/components/ui/field.tsx
index 45680c93c5..b8fcb3815d 100644
--- a/frontend/src/components/ui/field.tsx
+++ b/frontend/src/components/ui/field.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
import { cva, type VariantProps } from "class-variance-authority";
import {
FieldError as AriaFieldError,
@@ -12,6 +12,7 @@ import {
type TextProps as AriaTextProps,
composeRenderProps,
} from "react-aria-components";
+import { cn } from "@/utils/cn";
import { selectStyles } from "./native-select";
const labelVariants = cva([
diff --git a/frontend/src/components/ui/form.tsx b/frontend/src/components/ui/form.tsx
index f0c5fe6c8f..07caad25b0 100644
--- a/frontend/src/components/ui/form.tsx
+++ b/frontend/src/components/ui/form.tsx
@@ -1,7 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import type * as LabelPrimitive from "@radix-ui/react-label";
import { Slot } from "@radix-ui/react-slot";
+import { AlertCircleIcon } from "lucide-react";
+import * as React from "react";
import {
Controller,
type ControllerProps,
@@ -10,11 +12,9 @@ import {
FormProvider,
useFormContext,
} from "react-hook-form";
-
-import { cn } from "@/utils/cn";
import { Label } from "@/components/ui/label";
import { Tooltip } from "@/components/ui/tooltip";
-import { AlertCircleIcon } from "lucide-react";
+import { cn } from "@/utils/cn";
const Form = FormProvider;
diff --git a/frontend/src/components/ui/fullscreen.tsx b/frontend/src/components/ui/fullscreen.tsx
index 3cb90b25f7..d1ec91f001 100644
--- a/frontend/src/components/ui/fullscreen.tsx
+++ b/frontend/src/components/ui/fullscreen.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEventListener } from "@/hooks/useEventListener";
+
import { useState } from "react";
+import { useEventListener } from "@/hooks/useEventListener";
/**
* Get the full screen element if we are in full screen mode
diff --git a/frontend/src/components/ui/input.tsx b/frontend/src/components/ui/input.tsx
index 08221de163..a56de964d0 100644
--- a/frontend/src/components/ui/input.tsx
+++ b/frontend/src/components/ui/input.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import { cn } from "@/utils/cn";
-import { useDebounceControlledState } from "@/hooks/useDebounce";
-import { Events } from "@/utils/events";
+import { useControllableState } from "@radix-ui/react-use-controllable-state";
+import { SearchIcon, XIcon } from "lucide-react";
+import * as React from "react";
import {
NumberField,
type NumberFieldProps,
} from "@/components/ui/number-field";
-import { SearchIcon, XIcon } from "lucide-react";
-import { useControllableState } from "@radix-ui/react-use-controllable-state";
+import { useDebounceControlledState } from "@/hooks/useDebounce";
+import { cn } from "@/utils/cn";
+import { Events } from "@/utils/events";
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
rootClassName?: string;
diff --git a/frontend/src/components/ui/label.tsx b/frontend/src/components/ui/label.tsx
index 85f851490e..6fc7a6153b 100644
--- a/frontend/src/components/ui/label.tsx
+++ b/frontend/src/components/ui/label.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as LabelPrimitive from "@radix-ui/react-label";
-import { type VariantProps, cva } from "class-variance-authority";
+import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/menu-items.tsx b/frontend/src/components/ui/menu-items.tsx
index 9060fa8db1..3509e180f1 100644
--- a/frontend/src/components/ui/menu-items.tsx
+++ b/frontend/src/components/ui/menu-items.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { cn } from "@/utils/cn";
+
import { cva } from "class-variance-authority";
import React from "react";
+import { cn } from "@/utils/cn";
export const menuContentCommon = cva(
"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
diff --git a/frontend/src/components/ui/native-select.tsx b/frontend/src/components/ui/native-select.tsx
index b032d9064c..76bb7862a6 100644
--- a/frontend/src/components/ui/native-select.tsx
+++ b/frontend/src/components/ui/native-select.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+import { cva } from "class-variance-authority";
+import * as React from "react";
import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
-import { cva } from "class-variance-authority";
export const selectStyles = cva(
"flex h-6 w-fit mb-1 items-center justify-between rounded-sm bg-background px-2 text-sm font-prose ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer",
diff --git a/frontend/src/components/ui/navigation.tsx b/frontend/src/components/ui/navigation.tsx
index 126b406169..38956a1ae5 100644
--- a/frontend/src/components/ui/navigation.tsx
+++ b/frontend/src/components/ui/navigation.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import { ChevronDownIcon } from "@radix-ui/react-icons";
import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu";
-import { type VariantProps, cva } from "class-variance-authority";
+import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
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 2e75b10bb9..f1062d2eb8 100644
--- a/frontend/src/components/ui/number-field.tsx
+++ b/frontend/src/components/ui/number-field.tsx
@@ -1,5 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ChevronUp, ChevronDown } from "lucide-react";
+import { ChevronDown, ChevronUp } from "lucide-react";
+import React from "react";
import {
NumberField as AriaNumberField,
type NumberFieldProps as AriaNumberFieldProps,
@@ -7,7 +8,6 @@ import {
type ButtonProps,
Input as RACInput,
} from "react-aria-components";
-import React from "react";
import { cn } from "@/utils/cn";
export interface NumberFieldProps extends AriaNumberFieldProps {
diff --git a/frontend/src/components/ui/popover.tsx b/frontend/src/components/ui/popover.tsx
index 53b7497f4e..4b1df08335 100644
--- a/frontend/src/components/ui/popover.tsx
+++ b/frontend/src/components/ui/popover.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as PopoverPrimitive from "@radix-ui/react-popover";
-import { cn } from "@/utils/cn";
+import * as PopoverPrimitive from "@radix-ui/react-popover";
+import * as React from "react";
import { StyleNamespace } from "@/theme/namespace";
+import { cn } from "@/utils/cn";
import { withFullScreenAsRoot } from "./fullscreen";
const Popover = PopoverPrimitive.Root;
diff --git a/frontend/src/components/ui/progress.tsx b/frontend/src/components/ui/progress.tsx
index 1817090910..02510c5a44 100644
--- a/frontend/src/components/ui/progress.tsx
+++ b/frontend/src/components/ui/progress.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as ProgressPrimitive from "@radix-ui/react-progress";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/radio-group.tsx b/frontend/src/components/ui/radio-group.tsx
index 75e0b16792..410cf2e3e9 100644
--- a/frontend/src/components/ui/radio-group.tsx
+++ b/frontend/src/components/ui/radio-group.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
import { Circle } from "lucide-react";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/range-slider.tsx b/frontend/src/components/ui/range-slider.tsx
index 843f718c40..8ceaf0c2c9 100644
--- a/frontend/src/components/ui/range-slider.tsx
+++ b/frontend/src/components/ui/range-slider.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as SliderPrimitive from "@radix-ui/react-slider";
+import * as SliderPrimitive from "@radix-ui/react-slider";
+import { TooltipPortal } from "@radix-ui/react-tooltip";
+import * as React from "react";
import { cn } from "@/utils/cn";
+import { prettyScientificNumber } from "@/utils/numbers";
+import { useBoolean } from "../../hooks/useBoolean";
import {
TooltipContent,
TooltipProvider,
TooltipRoot,
TooltipTrigger,
} from "./tooltip";
-import { useBoolean } from "../../hooks/useBoolean";
-import { TooltipPortal } from "@radix-ui/react-tooltip";
-import { prettyScientificNumber } from "@/utils/numbers";
const RangeSlider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
diff --git a/frontend/src/components/ui/scroll-area.tsx b/frontend/src/components/ui/scroll-area.tsx
index 115891effd..6ebe583af6 100644
--- a/frontend/src/components/ui/scroll-area.tsx
+++ b/frontend/src/components/ui/scroll-area.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
+import * as React from "react";
import { cn } from "@/utils/cn";
const ScrollArea = React.forwardRef<
diff --git a/frontend/src/components/ui/select.tsx b/frontend/src/components/ui/select.tsx
index ccd4037424..d54b7ac82f 100644
--- a/frontend/src/components/ui/select.tsx
+++ b/frontend/src/components/ui/select.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as SelectPrimitive from "@radix-ui/react-select";
+import type { VariantProps } from "class-variance-authority";
import {
CheckIcon,
ChevronDown,
@@ -8,13 +9,12 @@ import {
ChevronUpIcon,
XIcon,
} from "lucide-react";
-
+import * as React from "react";
+import { StyleNamespace } from "@/theme/namespace";
import { cn } from "@/utils/cn";
-import { selectStyles } from "./native-select";
-import type { VariantProps } from "class-variance-authority";
import { withFullScreenAsRoot } from "./fullscreen";
import { MENU_ITEM_DISABLED } from "./menu-items";
-import { StyleNamespace } from "@/theme/namespace";
+import { selectStyles } from "./native-select";
const Select = SelectPrimitive.Root;
diff --git a/frontend/src/components/ui/sheet.tsx b/frontend/src/components/ui/sheet.tsx
index f63d38e8a3..c0f4e5c14c 100644
--- a/frontend/src/components/ui/sheet.tsx
+++ b/frontend/src/components/ui/sheet.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import * as SheetPrimitive from "@radix-ui/react-dialog";
import { Cross2Icon } from "@radix-ui/react-icons";
import { cva, type VariantProps } from "class-variance-authority";
+import React from "react";
+import { StyleNamespace } from "@/theme/namespace";
import { cn } from "@/utils/cn";
import { withFullScreenAsRoot } from "./fullscreen";
-import { StyleNamespace } from "@/theme/namespace";
const Sheet = SheetPrimitive.Root;
diff --git a/frontend/src/components/ui/slider.tsx b/frontend/src/components/ui/slider.tsx
index fe1d1ba6e3..efa63a680d 100644
--- a/frontend/src/components/ui/slider.tsx
+++ b/frontend/src/components/ui/slider.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as SliderPrimitive from "@radix-ui/react-slider";
+import * as SliderPrimitive from "@radix-ui/react-slider";
+import { TooltipPortal } from "@radix-ui/react-tooltip";
+import * as React from "react";
import { cn } from "@/utils/cn";
+import { prettyScientificNumber } from "@/utils/numbers";
+import { useBoolean } from "../../hooks/useBoolean";
import {
TooltipContent,
TooltipProvider,
TooltipRoot,
TooltipTrigger,
} from "./tooltip";
-import { useBoolean } from "../../hooks/useBoolean";
-import { TooltipPortal } from "@radix-ui/react-tooltip";
-import { prettyScientificNumber } from "@/utils/numbers";
const Slider = React.forwardRef<
React.ElementRef<typeof SliderPrimitive.Root>,
diff --git a/frontend/src/components/ui/switch.tsx b/frontend/src/components/ui/switch.tsx
index d52473a41e..2180fdf3c8 100644
--- a/frontend/src/components/ui/switch.tsx
+++ b/frontend/src/components/ui/switch.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as SwitchPrimitives from "@radix-ui/react-switch";
-import { cn } from "@/utils/cn";
+import * as SwitchPrimitives from "@radix-ui/react-switch";
import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
+import { cn } from "@/utils/cn";
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/tabs.tsx b/frontend/src/components/ui/tabs.tsx
index 5f71e34749..80ac3b0574 100644
--- a/frontend/src/components/ui/tabs.tsx
+++ b/frontend/src/components/ui/tabs.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/textarea.tsx b/frontend/src/components/ui/textarea.tsx
index 41e00d0c87..69a0b0ff3c 100644
--- a/frontend/src/components/ui/textarea.tsx
+++ b/frontend/src/components/ui/textarea.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+import { useControllableState } from "@radix-ui/react-use-controllable-state";
+import * as React from "react";
+import { useDebounceControlledState } from "@/hooks/useDebounce";
import { cn } from "@/utils/cn";
import { Events } from "@/utils/events";
-import { useDebounceControlledState } from "@/hooks/useDebounce";
-import { useControllableState } from "@radix-ui/react-use-controllable-state";
export interface TextareaProps
extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
diff --git a/frontend/src/components/ui/toast.tsx b/frontend/src/components/ui/toast.tsx
index 7f5a499f1f..bcfafa7415 100644
--- a/frontend/src/components/ui/toast.tsx
+++ b/frontend/src/components/ui/toast.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as ToastPrimitives from "@radix-ui/react-toast";
-import { type VariantProps, cva } from "class-variance-authority";
+import { cva, type VariantProps } from "class-variance-authority";
import { X } from "lucide-react";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/toggle.tsx b/frontend/src/components/ui/toggle.tsx
index b3f42185e6..975d988632 100644
--- a/frontend/src/components/ui/toggle.tsx
+++ b/frontend/src/components/ui/toggle.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
+
import * as TogglePrimitive from "@radix-ui/react-toggle";
import { cva, type VariantProps } from "class-variance-authority";
+import * as React from "react";
import { cn } from "@/utils/cn";
diff --git a/frontend/src/components/ui/tooltip.tsx b/frontend/src/components/ui/tooltip.tsx
index 7ceff88270..f33983e410 100644
--- a/frontend/src/components/ui/tooltip.tsx
+++ b/frontend/src/components/ui/tooltip.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import * as React from "react";
-import * as TooltipPrimitive from "@radix-ui/react-tooltip";
-import { cn } from "@/utils/cn";
+import * as TooltipPrimitive from "@radix-ui/react-tooltip";
+import * as React from "react";
import { StyleNamespace } from "@/theme/namespace";
+import { cn } from "@/utils/cn";
const TooltipProvider = ({
delayDuration = 400,
diff --git a/frontend/src/components/variables/common.tsx b/frontend/src/components/variables/common.tsx
index 078b307735..658b3d0a65 100644
--- a/frontend/src/components/variables/common.tsx
+++ b/frontend/src/components/variables/common.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React from "react";
-import { toast } from "../ui/use-toast";
-import { Badge } from "../ui/badge";
import { copyToClipboard } from "@/utils/copy";
+import { Badge } from "../ui/badge";
+import { toast } from "../ui/use-toast";
interface Props extends React.HTMLAttributes<HTMLDivElement> {
name: string;
diff --git a/frontend/src/components/variables/variables-table.tsx b/frontend/src/components/variables/variables-table.tsx
index 44adea9788..ab483801d0 100644
--- a/frontend/src/components/variables/variables-table.tsx
+++ b/frontend/src/components/variables/variables-table.tsx
@@ -1,38 +1,38 @@
/* Copyright 2024 Marimo. All rights reserved. */
"use no memo";
-import React, { memo, useMemo } from "react";
-import {
- TableHeader,
- TableRow,
- TableHead,
- TableBody,
- TableCell,
- Table,
-} from "../ui/table";
-import type { Variable, Variables } from "@/core/variables/types";
-import type { CellId } from "@/core/cells/ids";
-import { CellLink } from "@/components/editor/links/cell-link";
-import { cn } from "@/utils/cn";
-import { SquareEqualIcon, WorkflowIcon } from "lucide-react";
import {
- useReactTable,
- getCoreRowModel,
- flexRender,
type ColumnDef,
- type SortingState,
- getSortedRowModel,
type ColumnSort,
+ flexRender,
+ getCoreRowModel,
getFilteredRowModel,
+ getSortedRowModel,
+ type SortingState,
+ useReactTable,
} from "@tanstack/react-table";
-import { DataTableColumnHeader } from "../data-table/column-header";
import { sortBy } from "lodash-es";
+import { SquareEqualIcon, WorkflowIcon } from "lucide-react";
+import React, { memo, useMemo } from "react";
+import { CellLink } from "@/components/editor/links/cell-link";
import { getCellEditorView, useCellNames } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
+import { isInternalCellName } from "@/core/cells/names";
import { goToVariableDefinition } from "@/core/codemirror/go-to-definition/commands";
-import { SearchInput } from "../ui/input";
+import type { Variable, Variables } from "@/core/variables/types";
+import { cn } from "@/utils/cn";
+import { DataTableColumnHeader } from "../data-table/column-header";
import { CellLinkList } from "../editor/links/cell-link-list";
+import { SearchInput } from "../ui/input";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "../ui/table";
import { VariableName } from "./common";
-import { isInternalCellName } from "@/core/cells/names";
interface Props {
className?: string;
diff --git a/frontend/src/core/MarimoApp.tsx b/frontend/src/core/MarimoApp.tsx
index 841a8532db..346d0d38ee 100644
--- a/frontend/src/core/MarimoApp.tsx
+++ b/frontend/src/core/MarimoApp.tsx
@@ -3,19 +3,19 @@ import "../css/index.css";
import "../css/app/App.css";
import "iconify-icon";
+import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
import type React from "react";
-import { type PropsWithChildren, Suspense, memo } from "react";
-import { ErrorBoundary } from "../components/editor/boundary/ErrorBoundary";
-import { TooltipProvider } from "../components/ui/tooltip";
-import { Toaster } from "../components/ui/toaster";
-import { ModalProvider } from "../components/modal/ImperativeModal";
+import { memo, type PropsWithChildren, Suspense } from "react";
+import { TailwindIndicator } from "@/components/debug/indicator";
import { useAppConfig, useResolvedMarimoConfig } from "@/core/config/config";
+import { getInitialAppMode } from "@/core/mode";
import { CssVariables } from "@/theme/ThemeProvider";
-import { TailwindIndicator } from "@/components/debug/indicator";
-import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
-import { slotsController } from "./slots/slots";
import { reactLazyWithPreload } from "@/utils/lazy";
-import { getInitialAppMode } from "@/core/mode";
+import { ErrorBoundary } from "../components/editor/boundary/ErrorBoundary";
+import { ModalProvider } from "../components/modal/ImperativeModal";
+import { Toaster } from "../components/ui/toaster";
+import { TooltipProvider } from "../components/ui/tooltip";
+import { slotsController } from "./slots/slots";
// Force tailwind classnames
// tailwind only creates css for classnames that exist the FE files
diff --git a/frontend/src/core/ai/chat-utils.ts b/frontend/src/core/ai/chat-utils.ts
index feceb0e3cf..c89e9e69a6 100644
--- a/frontend/src/core/ai/chat-utils.ts
+++ b/frontend/src/core/ai/chat-utils.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Message as AIMessage } from "@ai-sdk/react";
import { Logger } from "@/utils/Logger";
import type { ChatState } from "./state";
-import type { Message as AIMessage } from "@ai-sdk/react";
export const addMessageToChat = (
chatState: ChatState,
diff --git a/frontend/src/core/ai/state.ts b/frontend/src/core/ai/state.ts
index 22737685a6..2c15286767 100644
--- a/frontend/src/core/ai/state.ts
+++ b/frontend/src/core/ai/state.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Message as AIMessage } from "@ai-sdk/react";
import { atom } from "jotai";
import { atomWithStorage } from "jotai/utils";
import type { CellId } from "../cells/ids";
-import type { Message as AIMessage } from "@ai-sdk/react";
const KEY = "marimo:ai:chatState:v2";
diff --git a/frontend/src/core/alerts/state.ts b/frontend/src/core/alerts/state.ts
index 7aa6172ffd..e90160e54e 100644
--- a/frontend/src/core/alerts/state.ts
+++ b/frontend/src/core/alerts/state.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { useAtomValue } from "jotai";
import type { PackageInstallationStatus } from "@/core/kernel/messages";
import { createReducerAndAtoms } from "@/utils/createReducer";
import { generateUUID } from "@/utils/uuid";
-import { useAtomValue } from "jotai";
type Identified<T> = { id: string } & T;
diff --git a/frontend/src/core/cells/__tests__/add-missing-import.test.ts b/frontend/src/core/cells/__tests__/add-missing-import.test.ts
index ff82909424..d10de0d835 100644
--- a/frontend/src/core/cells/__tests__/add-missing-import.test.ts
+++ b/frontend/src/core/cells/__tests__/add-missing-import.test.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { variablesAtom } from "@/core/variables/state";
+
import { createStore } from "jotai";
-import { it, describe, expect, vi } from "vitest";
-import { maybeAddMissingImport } from "../add-missing-import";
+import { describe, expect, it, vi } from "vitest";
+import { variablesAtom } from "@/core/variables/state";
import type { Variables } from "@/core/variables/types";
+import { CollapsibleTree, MultiColumn } from "@/utils/id-tree";
+import { maybeAddMissingImport } from "../add-missing-import";
import { type NotebookState, notebookAtom } from "../cells";
import type { CellId } from "../ids";
import type { CellData } from "../types";
-import { CollapsibleTree, MultiColumn } from "@/utils/id-tree";
const CELL_IDS = new MultiColumn([CollapsibleTree.from(["1" as CellId])]);
diff --git a/frontend/src/core/cells/__tests__/cell.test.ts b/frontend/src/core/cells/__tests__/cell.test.ts
index 05ffb3c25a..b6366ef201 100644
--- a/frontend/src/core/cells/__tests__/cell.test.ts
+++ b/frontend/src/core/cells/__tests__/cell.test.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { outputIsLoading, outputIsStale } from "../cell";
+import { describe, expect, it } from "vitest";
import type { OutputMessage } from "@/core/kernel/messages";
-import type { Seconds } from "@/utils/time";
import type { RuntimeState } from "@/core/network/types";
+import type { Seconds } from "@/utils/time";
+import { outputIsLoading, outputIsStale } from "../cell";
const STATUSES: RuntimeState[] = [
"queued",
diff --git a/frontend/src/core/cells/__tests__/cells.test.ts b/frontend/src/core/cells/__tests__/cells.test.ts
index d779e712cd..aa072485e9 100644
--- a/frontend/src/core/cells/__tests__/cells.test.ts
+++ b/frontend/src/core/cells/__tests__/cells.test.ts
@@ -1,4 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { python } from "@codemirror/lang-python";
+import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
import {
afterAll,
beforeAll,
@@ -8,28 +12,25 @@ import {
it,
vi,
} from "vitest";
-import {
- type NotebookState,
- SETUP_CELL_ID,
- exportedForTesting,
- flattenTopLevelNotebookCells,
-} from "../cells";
-import { CellId } from "@/core/cells/ids";
-import type { OutputMessage } from "@/core/kernel/messages";
-import type { Seconds } from "@/utils/time";
-import { EditorView } from "@codemirror/view";
-import { python } from "@codemirror/lang-python";
-import { EditorState } from "@codemirror/state";
import type { CellHandle } from "@/components/editor/Cell";
+import { CellId } from "@/core/cells/ids";
import { foldAllBulk, unfoldAllBulk } from "@/core/codemirror/editing/commands";
import { adaptiveLanguageConfiguration } from "@/core/codemirror/language/extension";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import type { OutputMessage } from "@/core/kernel/messages";
+import { type CollapsibleTree, MultiColumn } from "@/utils/id-tree";
+import type { Seconds } from "@/utils/time";
+import {
+ exportedForTesting,
+ flattenTopLevelNotebookCells,
+ type NotebookState,
+ SETUP_CELL_ID,
+} from "../cells";
import {
focusAndScrollCellIntoView,
- scrollToTop,
scrollToBottom,
+ scrollToTop,
} from "../scrollCellIntoView";
-import { type CollapsibleTree, MultiColumn } from "@/utils/id-tree";
import type { CellData } from "../types";
vi.mock("@/core/codemirror/editing/commands", () => ({
diff --git a/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts b/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
index 778baa32f1..6198b1df03 100644
--- a/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
+++ b/frontend/src/core/cells/__tests__/collapseConsoleOutputs.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { collapseConsoleOutputs } from "../collapseConsoleOutputs";
+import { describe, expect, it } from "vitest";
import type { OutputMessage } from "@/core/kernel/messages";
+import { collapseConsoleOutputs } from "../collapseConsoleOutputs";
describe("collapseConsoleOutputs", () => {
it("should collapse last two text/plain outputs on the same channel", () => {
diff --git a/frontend/src/core/cells/__tests__/ids.test.ts b/frontend/src/core/cells/__tests__/ids.test.ts
index 09d929610e..5cb728400b 100644
--- a/frontend/src/core/cells/__tests__/ids.test.ts
+++ b/frontend/src/core/cells/__tests__/ids.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { CellId, CellOutputId, HTMLCellId, findCellId } from "../ids";
+import { describe, expect, it } from "vitest";
+import { CellId, CellOutputId, findCellId, HTMLCellId } from "../ids";
describe("CellId", () => {
it("create", () => {
diff --git a/frontend/src/core/cells/__tests__/names.test.ts b/frontend/src/core/cells/__tests__/names.test.ts
index 08b7c6ff3b..2696ea1944 100644
--- a/frontend/src/core/cells/__tests__/names.test.ts
+++ b/frontend/src/core/cells/__tests__/names.test.ts
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { describe, expect, it } from "vitest";
import {
- normalizeName,
DEFAULT_CELL_NAME,
- getValidName,
displayCellName,
+ getValidName,
+ normalizeName,
} from "../names";
-import { expect, describe, it } from "vitest";
describe("normalizeName", () => {
it("should return the default cell name for empty input", () => {
diff --git a/frontend/src/core/cells/__tests__/runs.test.ts b/frontend/src/core/cells/__tests__/runs.test.ts
index 319c9d0996..e11479b37a 100644
--- a/frontend/src/core/cells/__tests__/runs.test.ts
+++ b/frontend/src/core/cells/__tests__/runs.test.ts
@@ -1,6 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, beforeEach } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
+import type { CellMessage } from "@/core/kernel/messages";
+import { invariant } from "@/utils/invariant";
import {
exportedForTesting,
MAX_CODE_LENGTH,
@@ -8,8 +10,6 @@ import {
type RunId,
type RunsState,
} from "../runs";
-import type { CellMessage } from "@/core/kernel/messages";
-import { invariant } from "@/utils/invariant";
const { reducer, initialState, isPureMarkdown } = exportedForTesting;
diff --git a/frontend/src/core/cells/__tests__/session.test.ts b/frontend/src/core/cells/__tests__/session.test.ts
index fa3b9719d0..1e5544af77 100644
--- a/frontend/src/core/cells/__tests__/session.test.ts
+++ b/frontend/src/core/cells/__tests__/session.test.ts
@@ -1,15 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type * as api from "@marimo-team/marimo-api";
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { describe, expect, it, vi, beforeEach } from "vitest";
-import { notebookStateFromSession } from "../session";
-import { Logger } from "@/utils/Logger";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import { parseOutline } from "@/core/dom/outline";
-import { MultiColumn } from "@/utils/id-tree";
-import type * as api from "@marimo-team/marimo-api";
+import { MultiColumn, visibleForTesting } from "@/utils/id-tree";
import { invariant } from "@/utils/invariant";
+import { Logger } from "@/utils/Logger";
import type { CellId } from "../ids";
-import { visibleForTesting } from "@/utils/id-tree";
+import { notebookStateFromSession } from "../session";
// Mock dependencies
vi.mock("@/utils/Logger", () => ({
diff --git a/frontend/src/core/cells/__tests__/utils.test.ts b/frontend/src/core/cells/__tests__/utils.test.ts
index 01c7287be7..da923b6bfa 100644
--- a/frontend/src/core/cells/__tests__/utils.test.ts
+++ b/frontend/src/core/cells/__tests__/utils.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { getCellConfigs, type NotebookState } from "@/core/cells/cells";
import { CellId } from "@/core/cells/ids";
-import { MultiColumn } from "@/utils/id-tree";
import type { CellData, CellRuntimeState } from "@/core/cells/types";
+import { MultiColumn } from "@/utils/id-tree";
import {
disabledCellIds,
enabledCellIds,
diff --git a/frontend/src/core/cells/actions.ts b/frontend/src/core/cells/actions.ts
index c40d55ae30..026f7034f1 100644
--- a/frontend/src/core/cells/actions.ts
+++ b/frontend/src/core/cells/actions.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { store } from "../state/jotai";
+import { scrollAndHighlightCell } from "@/components/editor/links/cell-link";
import { Objects } from "@/utils/objects";
+import { store } from "../state/jotai";
import { notebookAtom } from "./cells";
-import { scrollAndHighlightCell } from "@/components/editor/links/cell-link";
/**
* Scroll to the first cell that is currently in "running" state.
diff --git a/frontend/src/core/cells/cell.ts b/frontend/src/core/cells/cell.ts
index af3da3241a..78c0a1de8a 100644
--- a/frontend/src/core/cells/cell.ts
+++ b/frontend/src/core/cells/cell.ts
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { logNever } from "@/utils/assertNever";
-import type { CellMessage, OutputMessage } from "../kernel/messages";
-import type { CellRuntimeState } from "./types";
-import { collapseConsoleOutputs } from "./collapseConsoleOutputs";
-import { parseOutline } from "../dom/outline";
-import { type Seconds, Time } from "@/utils/time";
import { invariant } from "@/utils/invariant";
-import type { RuntimeState } from "../network/types";
+import { type Seconds, Time } from "@/utils/time";
import { extractAllTracebackInfo, type TracebackInfo } from "@/utils/traceback";
+import { parseOutline } from "../dom/outline";
+import type { CellMessage, OutputMessage } from "../kernel/messages";
+import type { RuntimeState } from "../network/types";
+import { collapseConsoleOutputs } from "./collapseConsoleOutputs";
+import type { CellRuntimeState } from "./types";
export function transitionCell(
cell: CellRuntimeState,
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index dec7bbea4f..fda967a424 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -1,31 +1,47 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { historyField } from "@codemirror/commands";
import { type Atom, atom, useAtom, useAtomValue } from "jotai";
-import { type ReducerWithoutAction, createRef } from "react";
+import { selectAtom, splitAtom } from "jotai/utils";
+import { isEqual, zip } from "lodash-es";
+import { createRef, type ReducerWithoutAction } from "react";
+import type { CellHandle } from "@/components/editor/Cell";
+import {
+ type CellColumnId,
+ type CellIndex,
+ MultiColumn,
+} from "@/utils/id-tree";
+import { invariant } from "@/utils/invariant";
+import { Logger } from "@/utils/Logger";
+import { clamp } from "@/utils/math";
+import { Objects } from "@/utils/objects";
+import { extractAllTracebackInfo, type TracebackInfo } from "@/utils/traceback";
+import { createReducerAndAtoms } from "../../utils/createReducer";
+import { foldAllBulk, unfoldAllBulk } from "../codemirror/editing/commands";
+import {
+ splitEditor,
+ updateEditorCodeFromPython,
+} from "../codemirror/language/utils";
+import { findCollapseRange, mergeOutlines } from "../dom/outline";
import type { CellMessage } from "../kernel/messages";
+import { isErrorMime } from "../mime";
+import type { CellConfig } from "../network/types";
+import { isRtcEnabled } from "../rtc/state";
+import { createDeepEqualAtom, store } from "../state/jotai";
+import { prepareCellForExecution, transitionCell } from "./cell";
+import { CellId } from "./ids";
+import { type CellLog, getCellLogsForMessage } from "./logs";
+import {
+ focusAndScrollCellIntoView,
+ scrollToBottom,
+ scrollToTop,
+} from "./scrollCellIntoView";
import {
- type CellRuntimeState,
type CellData,
+ type CellRuntimeState,
createCell,
createCellRuntimeState,
} from "./types";
-import {
- scrollToBottom,
- scrollToTop,
- focusAndScrollCellIntoView,
-} from "./scrollCellIntoView";
-import { CellId } from "./ids";
-import { prepareCellForExecution, transitionCell } from "./cell";
-import { createDeepEqualAtom, store } from "../state/jotai";
-import { createReducerAndAtoms } from "../../utils/createReducer";
-import { foldAllBulk, unfoldAllBulk } from "../codemirror/editing/commands";
-import { findCollapseRange, mergeOutlines } from "../dom/outline";
-import type { CellHandle } from "@/components/editor/Cell";
-import { Logger } from "@/utils/Logger";
-import { Objects } from "@/utils/objects";
-import { splitAtom, selectAtom } from "jotai/utils";
-import { type CellLog, getCellLogsForMessage } from "./logs";
-import { historyField } from "@codemirror/commands";
-import { clamp } from "@/utils/math";
import {
canUndoDeletes,
disabledCellIds,
@@ -34,21 +50,6 @@ import {
notebookNeedsRun,
notebookQueueOrRunningCount,
} from "./utils";
-import {
- splitEditor,
- updateEditorCodeFromPython,
-} from "../codemirror/language/utils";
-import { invariant } from "@/utils/invariant";
-import type { CellConfig } from "../network/types";
-import {
- type CellColumnId,
- type CellIndex,
- MultiColumn,
-} from "@/utils/id-tree";
-import { isEqual, zip } from "lodash-es";
-import { isErrorMime } from "../mime";
-import { extractAllTracebackInfo, type TracebackInfo } from "@/utils/traceback";
-import { isRtcEnabled } from "../rtc/state";
export const SCRATCH_CELL_ID = "__scratch__" as CellId;
export const SETUP_CELL_ID = "setup" as CellId;
diff --git a/frontend/src/core/cells/effects.ts b/frontend/src/core/cells/effects.ts
index 6c0b915186..d653450353 100644
--- a/frontend/src/core/cells/effects.ts
+++ b/frontend/src/core/cells/effects.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { MultiColumn } from "@/utils/id-tree";
+
import { debounce, isEqual } from "lodash-es";
+import type { MultiColumn } from "@/utils/id-tree";
import { kioskModeAtom } from "../mode";
import { syncCellIds } from "../network/requests";
import type { UpdateCellIdsRequest } from "../network/types";
diff --git a/frontend/src/core/cells/focus.ts b/frontend/src/core/cells/focus.ts
index b76b1371aa..eec77998c5 100644
--- a/frontend/src/core/cells/focus.ts
+++ b/frontend/src/core/cells/focus.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { atom, useAtomValue, useSetAtom } from "jotai";
-import type { CellId } from "./ids";
-import { type NotebookState, SCRATCH_CELL_ID, notebookAtom } from "./cells";
+
import type { EditorView } from "@codemirror/view";
+import { atom, useAtomValue, useSetAtom } from "jotai";
import type { CellConfig, RuntimeState } from "../network/types";
+import { type NotebookState, notebookAtom, SCRATCH_CELL_ID } from "./cells";
+import type { CellId } from "./ids";
/**
* Holds state for the last focused cell.
diff --git a/frontend/src/core/cells/logs.ts b/frontend/src/core/cells/logs.ts
index 241f01b681..57224e1fe5 100644
--- a/frontend/src/core/cells/logs.ts
+++ b/frontend/src/core/cells/logs.ts
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { fromUnixTime } from "date-fns";
+import { toast } from "@/components/ui/use-toast";
import { invariant } from "@/utils/invariant";
import type { CellMessage, OutputMessage } from "../kernel/messages";
-import type { CellId } from "./ids";
-import { fromUnixTime } from "date-fns";
import { isErrorMime } from "../mime";
-import { toast } from "@/components/ui/use-toast";
+import type { CellId } from "./ids";
export interface CellLog {
timestamp: number;
diff --git a/frontend/src/core/cells/outputs.ts b/frontend/src/core/cells/outputs.ts
index 596b441f6f..acad59be74 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 type { CellId } from "./ids";
import type { OutputMessage } from "../kernel/messages";
+import type { CellId } from "./ids";
// 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/cells/runs.ts b/frontend/src/core/cells/runs.ts
index 2d67f4267f..f5b85a1d99 100644
--- a/frontend/src/core/cells/runs.ts
+++ b/frontend/src/core/cells/runs.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { createReducerAndAtoms } from "@/utils/createReducer";
-import type { CellMessage } from "../kernel/messages";
import type { TypedString } from "@/utils/typed";
+import type { CellMessage } from "../kernel/messages";
import type { CellId } from "./ids";
export type RunId = TypedString<"RunId">;
diff --git a/frontend/src/core/cells/scrollCellIntoView.ts b/frontend/src/core/cells/scrollCellIntoView.ts
index 6464fe6028..17d1fb0efc 100644
--- a/frontend/src/core/cells/scrollCellIntoView.ts
+++ b/frontend/src/core/cells/scrollCellIntoView.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { RefObject } from "react";
-import { Logger } from "../../utils/Logger";
-import { type CellId, HTMLCellId } from "./ids";
import type { CellHandle } from "@/components/editor/Cell";
+import { Logger } from "../../utils/Logger";
import { goToVariableDefinition } from "../codemirror/go-to-definition/commands";
import type { CellConfig } from "../network/types";
+import { type CellId, HTMLCellId } from "./ids";
export function focusAndScrollCellIntoView({
cellId,
diff --git a/frontend/src/core/cells/session.ts b/frontend/src/core/cells/session.ts
index cc46b71a65..f1577bdd8f 100644
--- a/frontend/src/core/cells/session.ts
+++ b/frontend/src/core/cells/session.ts
@@ -1,6 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { MultiColumn } from "@/utils/id-tree";
+
import type * as api from "@marimo-team/marimo-api";
+import { MultiColumn } from "@/utils/id-tree";
+import { Logger } from "@/utils/Logger";
+import { Sets } from "@/utils/sets";
import { parseOutline } from "../dom/outline";
import { CellId } from "./ids";
import {
@@ -8,8 +11,6 @@ import {
type CellRuntimeState,
createCellRuntimeState,
} from "./types";
-import { Logger } from "@/utils/Logger";
-import { Sets } from "@/utils/sets";
// Constants
const DEFAULT_TIMESTAMP = 0;
diff --git a/frontend/src/core/cells/types.ts b/frontend/src/core/cells/types.ts
index c4aba79455..318f482161 100644
--- a/frontend/src/core/cells/types.ts
+++ b/frontend/src/core/cells/types.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { OutputMessage } from "../kernel/messages";
+
+import type { Milliseconds, Seconds } from "@/utils/time";
import type { SerializedEditorState } from "../codemirror/types";
-import type { Outline } from "./outline";
+import type { OutputMessage } from "../kernel/messages";
+import type { CellConfig, RuntimeState } from "../network/types";
import type { CellId } from "./ids";
import { DEFAULT_CELL_NAME } from "./names";
-import type { Milliseconds, Seconds } from "@/utils/time";
-import type { CellConfig, RuntimeState } from "../network/types";
+import type { Outline } from "./outline";
/**
* Create a new cell with default state.
diff --git a/frontend/src/core/cells/utils.ts b/frontend/src/core/cells/utils.ts
index 416f805f23..65e432824c 100644
--- a/frontend/src/core/cells/utils.ts
+++ b/frontend/src/core/cells/utils.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellId } from "./ids";
-import { Objects } from "@/utils/objects";
+
import type { EditorView } from "@codemirror/view";
-import type { NotebookState } from "./cells";
+import { Objects } from "@/utils/objects";
import type { RuntimeState } from "../network/types";
+import type { NotebookState } from "./cells";
+import type { CellId } from "./ids";
export function notebookIsRunning(state: NotebookState) {
return Object.values(state.cellRuntime).some(
diff --git a/frontend/src/core/codemirror/__tests__/extensions.test.ts b/frontend/src/core/codemirror/__tests__/extensions.test.ts
index 8b0d49465d..8c92d23667 100644
--- a/frontend/src/core/codemirror/__tests__/extensions.test.ts
+++ b/frontend/src/core/codemirror/__tests__/extensions.test.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
-import { EditorView } from "@codemirror/view";
+
import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import * as scrollUtils from "../../../utils/scroll";
import { scrollActiveLineIntoView } from "../extensions";
import { formattingChangeEffect } from "../format";
diff --git a/frontend/src/core/codemirror/__tests__/format.test.ts b/frontend/src/core/codemirror/__tests__/format.test.ts
index eae3599454..f337a563b0 100644
--- a/frontend/src/core/codemirror/__tests__/format.test.ts
+++ b/frontend/src/core/codemirror/__tests__/format.test.ts
@@ -1,24 +1,24 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import { EditorView } from "@codemirror/view";
-import { EditorState } from "@codemirror/state";
import { python } from "@codemirror/lang-python";
-import type { CellId } from "@/core/cells/ids";
-import { formatEditorViews, formatAll, formatSQL } from "../format";
-import {
- adaptiveLanguageConfiguration,
- switchLanguage,
-} from "../language/extension";
-import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { sendFormat } from "@/core/network/requests";
+import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import type { NotebookState } from "@/core/cells/cells";
import { getNotebook } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
import { notebookCellEditorViews } from "@/core/cells/utils";
import { getResolvedMarimoConfig } from "@/core/config/config";
-import type { NotebookState } from "@/core/cells/cells";
-import { cellActionsState, type CodemirrorCellActions } from "../cells/state";
+import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { sendFormat } from "@/core/network/requests";
import type { MarimoConfig } from "@/core/network/types";
+import { type CodemirrorCellActions, cellActionsState } from "../cells/state";
import { cellIdState } from "../config/extension";
+import { formatAll, formatEditorViews, formatSQL } from "../format";
+import {
+ adaptiveLanguageConfiguration,
+ switchLanguage,
+} from "../language/extension";
vi.mock("@/core/network/requests", () => ({
sendFormat: vi.fn(),
diff --git a/frontend/src/core/codemirror/__tests__/setup.test.ts b/frontend/src/core/codemirror/__tests__/setup.test.ts
index 263b46a64a..dc39adca3b 100644
--- a/frontend/src/core/codemirror/__tests__/setup.test.ts
+++ b/frontend/src/core/codemirror/__tests__/setup.test.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, test, vi } from "vitest";
-import { type CodeMirrorSetupOpts, setupCodeMirror } from "../cm";
+
import { EditorState, type Extension } from "@codemirror/state";
import { keymap } from "@codemirror/view";
+import { describe, expect, test, vi } from "vitest";
import type { CellId } from "@/core/cells/ids";
-import { Objects } from "@/utils/objects";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { PythonLanguageAdapter } from "../language/languages/python";
+import { Objects } from "@/utils/objects";
import type { CodemirrorCellActions } from "../cells/state";
+import { type CodeMirrorSetupOpts, setupCodeMirror } from "../cm";
+import { PythonLanguageAdapter } from "../language/languages/python";
vi.mock("@/core/config/config", async (importOriginal) => {
const original = await importOriginal<{}>();
diff --git a/frontend/src/core/codemirror/ai/request.ts b/frontend/src/core/codemirror/ai/request.ts
index 429e7d904c..3cc255b31d 100644
--- a/frontend/src/core/codemirror/ai/request.ts
+++ b/frontend/src/core/codemirror/ai/request.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { waitForConnectionOpen } from "@/core/network/connection";
+import type { AiCompletionRequest } from "@/core/network/types";
import { getRuntimeManager } from "@/core/runtime/config";
import type { LanguageAdapterType } from "../language/types";
-import type { AiCompletionRequest } from "@/core/network/types";
-import { waitForConnectionOpen } from "@/core/network/connection";
/**
* Request to edit code with AI
diff --git a/frontend/src/core/codemirror/cells/extensions.ts b/frontend/src/core/codemirror/cells/extensions.ts
index ca64b1088c..e491c342bf 100644
--- a/frontend/src/core/codemirror/cells/extensions.ts
+++ b/frontend/src/core/codemirror/cells/extensions.ts
@@ -1,23 +1,24 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+
+import { closeCompletion, completionStatus } from "@codemirror/autocomplete";
+import { type Extension, Prec } from "@codemirror/state";
import { EditorView, type KeyBinding, keymap } from "@codemirror/view";
+import { createTracebackInfoAtom, SCRATCH_CELL_ID } from "@/core/cells/cells";
import { type CellId, HTMLCellId } from "@/core/cells/ids";
-import { type Extension, Prec } from "@codemirror/state";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { store } from "@/core/state/jotai";
+import { createObservable } from "@/core/state/observable";
import { formatKeymapExtension } from "../extensions";
-import { getEditorCodeAsPython } from "../language/utils";
import { formattingChangeEffect } from "../format";
-import { closeCompletion, completionStatus } from "@codemirror/autocomplete";
-import { isAtEndOfEditor, isAtStartOfEditor } from "../utils";
import { goToDefinitionAtCursorPosition } from "../go-to-definition/utils";
+import { getEditorCodeAsPython } from "../language/utils";
+import { isAtEndOfEditor, isAtStartOfEditor } from "../utils";
import {
+ type CodemirrorCellActions,
cellActionsState,
cellIdState,
- type CodemirrorCellActions,
} from "./state";
-import { createTracebackInfoAtom, SCRATCH_CELL_ID } from "@/core/cells/cells";
import { errorLineHighlighter } from "./traceback-decorations";
-import { createObservable } from "@/core/state/observable";
-import { store } from "@/core/state/jotai";
/**
* Extensions for cell actions
diff --git a/frontend/src/core/codemirror/cells/state.ts b/frontend/src/core/codemirror/cells/state.ts
index 36cc9f0a34..15f3597ee1 100644
--- a/frontend/src/core/codemirror/cells/state.ts
+++ b/frontend/src/core/codemirror/cells/state.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellId } from "@/core/cells/ids";
+
import { Facet } from "@codemirror/state";
import type { CellActions } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
export interface CodemirrorCellActions extends CellActions {
toggleHideCode: () => boolean;
diff --git a/frontend/src/core/codemirror/cells/traceback-decorations.ts b/frontend/src/core/codemirror/cells/traceback-decorations.ts
index 07429b82ea..1191005ecd 100644
--- a/frontend/src/core/codemirror/cells/traceback-decorations.ts
+++ b/frontend/src/core/codemirror/cells/traceback-decorations.ts
@@ -1,4 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { EditorState, Extension } from "@codemirror/state";
+import { RangeSetBuilder } from "@codemirror/state";
import {
Decoration,
type DecorationSet,
@@ -7,8 +10,6 @@ import {
ViewPlugin,
type ViewUpdate,
} from "@codemirror/view";
-import type { Extension, EditorState } from "@codemirror/state";
-import { RangeSetBuilder } from "@codemirror/state";
import type { Observable } from "@/core/state/observable";
import type { TracebackInfo } from "@/utils/traceback";
import { cellIdState } from "./state";
diff --git a/frontend/src/core/codemirror/cm.ts b/frontend/src/core/codemirror/cm.ts
index c40e211a03..017dd2e0d6 100644
--- a/frontend/src/core/codemirror/cm.ts
+++ b/frontend/src/core/codemirror/cm.ts
@@ -3,17 +3,16 @@ import {
acceptCompletion,
closeBrackets,
closeBracketsKeymap,
- startCompletion,
- moveCompletionSelection,
completionStatus,
+ moveCompletionSelection,
+ startCompletion,
} from "@codemirror/autocomplete";
import {
history,
historyKeymap,
- indentWithTab,
indentMore,
+ indentWithTab,
} from "@codemirror/commands";
-import { lintGutter } from "@codemirror/lint";
import {
bracketMatching,
defaultHighlightStyle,
@@ -23,54 +22,52 @@ import {
indentUnit,
syntaxHighlighting,
} from "@codemirror/language";
+import { lintGutter } from "@codemirror/lint";
+import { EditorState, type Extension, Prec } from "@codemirror/state";
import {
drawSelection,
dropCursor,
+ EditorView,
highlightActiveLine,
highlightActiveLineGutter,
highlightSpecialChars,
- lineNumbers,
keymap,
+ lineNumbers,
rectangularSelection,
tooltips,
- EditorView,
} from "@codemirror/view";
-
-import { EditorState, type Extension, Prec } from "@codemirror/state";
+import { aiExtension } from "@marimo-team/codemirror-ai";
+import type { Theme } from "../../theme/useTheme";
+import type { CellId } from "../cells/ids";
import type {
CompletionConfig,
DiagnosticsConfig,
KeymapConfig,
LSPConfig,
} from "../config/config-schema";
-import type { Theme } from "../../theme/useTheme";
-
-import { findReplaceBundle } from "./find-replace/extension";
+import { getFeatureFlag } from "../config/feature-flag";
+import type { HotkeyProvider } from "../hotkeys/hotkeys";
+import { store } from "../state/jotai";
+import { requestEditCompletion } from "./ai/request";
import { cellBundle } from "./cells/extensions";
-import type { CellId } from "../cells/ids";
-import { keymapBundle } from "./keymaps/keymaps";
-import { scrollActiveLineIntoView } from "./extensions";
-import { copilotBundle } from "./copilot/extension";
+import type { CodemirrorCellActions } from "./cells/state";
+import { jupyterHelpExtension } from "./compat/jupyter";
import { hintTooltip } from "./completion/hints";
-import { adaptiveLanguageConfiguration } from "./language/extension";
+import { completionKeymap } from "./completion/keymap";
+import { cellConfigExtension } from "./config/extension";
+import { copilotBundle } from "./copilot/extension";
import { historyCompartment } from "./editing/extensions";
+import { scrollActiveLineIntoView } from "./extensions";
+import { findReplaceBundle } from "./find-replace/extension";
import { goToDefinitionBundle } from "./go-to-definition/extension";
-import type { HotkeyProvider } from "../hotkeys/hotkeys";
-import { lightTheme } from "./theme/light";
-import { darkTheme } from "./theme/dark";
+import { keymapBundle } from "./keymaps/keymaps";
+import { getCurrentLanguageAdapter } from "./language/commands";
+import { adaptiveLanguageConfiguration } from "./language/extension";
import { dndBundle } from "./misc/dnd";
-import { jupyterHelpExtension } from "./compat/jupyter";
import { pasteBundle } from "./misc/paste";
-
-import { requestEditCompletion } from "./ai/request";
-import { getCurrentLanguageAdapter } from "./language/commands";
-import { aiExtension } from "@marimo-team/codemirror-ai";
-import { getFeatureFlag } from "../config/feature-flag";
-import type { CodemirrorCellActions } from "./cells/state";
-import { cellConfigExtension } from "./config/extension";
-import { completionKeymap } from "./completion/keymap";
import { dynamicReadonly } from "./readonly/extension";
-import { store } from "../state/jotai";
+import { darkTheme } from "./theme/dark";
+import { lightTheme } from "./theme/light";
export interface CodeMirrorSetupOpts {
cellId: CellId;
diff --git a/frontend/src/core/codemirror/compat/__tests__/jupyter.test.ts b/frontend/src/core/codemirror/compat/__tests__/jupyter.test.ts
index 65e843b2f8..0a54404cab 100644
--- a/frontend/src/core/codemirror/compat/__tests__/jupyter.test.ts
+++ b/frontend/src/core/codemirror/compat/__tests__/jupyter.test.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach } from "vitest";
-import { jupyterHelpExtension } from "../jupyter";
+
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { store } from "@/core/state/jotai";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import { toast } from "@/components/ui/use-toast";
import { saveUserConfig } from "@/core/network/requests";
+import { store } from "@/core/state/jotai";
+import { jupyterHelpExtension } from "../jupyter";
// Mock dependencies
vi.mock("@/core/state/jotai", () => ({
diff --git a/frontend/src/core/codemirror/compat/jupyter.tsx b/frontend/src/core/codemirror/compat/jupyter.tsx
index 4ff0248e7a..27d9e02b0a 100644
--- a/frontend/src/core/codemirror/compat/jupyter.tsx
+++ b/frontend/src/core/codemirror/compat/jupyter.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { toast } from "../../../components/ui/use-toast";
-import { store } from "@/core/state/jotai";
-import { chromeAtom } from "@/components/editor/chrome/state";
-import { saveUserConfig } from "@/core/network/requests";
-import type { UserConfig } from "@/core/config/config-schema";
-import { userConfigAtom } from "@/core/config/config";
import { PACKAGES_INPUT_ID } from "@/components/editor/chrome/panels/constants";
+import { chromeAtom } from "@/components/editor/chrome/state";
import { Kbd } from "@/components/ui/kbd";
+import { userConfigAtom } from "@/core/config/config";
+import type { UserConfig } from "@/core/config/config-schema";
+import { saveUserConfig } from "@/core/network/requests";
+import { store } from "@/core/state/jotai";
+import { toast } from "../../../components/ui/use-toast";
interface ReplaceCommand {
match: string;
diff --git a/frontend/src/core/codemirror/completion/Autocompleter.ts b/frontend/src/core/codemirror/completion/Autocompleter.ts
index 6fe0774a12..c295f78ff4 100644
--- a/frontend/src/core/codemirror/completion/Autocompleter.ts
+++ b/frontend/src/core/codemirror/completion/Autocompleter.ts
@@ -1,14 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { CompletionResult } from "@codemirror/autocomplete";
-
+import type { Tooltip } from "@codemirror/view";
+import { DeferredRequestRegistry } from "@/core/network/DeferredRequestRegistry";
+import { sendCodeCompletionRequest } from "@/core/network/requests";
+import type { CodeCompletionRequest } from "@/core/network/types";
import type {
CompletionOption,
CompletionResultMessage,
} from "../../kernel/messages";
-import { sendCodeCompletionRequest } from "@/core/network/requests";
-import type { Tooltip } from "@codemirror/view";
-import { DeferredRequestRegistry } from "@/core/network/DeferredRequestRegistry";
-import type { CodeCompletionRequest } from "@/core/network/types";
import "../../../components/editor/documentation.css";
function constructCompletionInfoNode(
diff --git a/frontend/src/core/codemirror/completion/__tests__/hints.test.ts b/frontend/src/core/codemirror/completion/__tests__/hints.test.ts
index 3e3b7f0f9c..26508c645d 100644
--- a/frontend/src/core/codemirror/completion/__tests__/hints.test.ts
+++ b/frontend/src/core/codemirror/completion/__tests__/hints.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { Text } from "@codemirror/state";
import { describe, expect, it } from "vitest";
import { getPositionAtWordBounds } from "../hints";
-import { Text } from "@codemirror/state";
const doc = Text.of([
"# Update the data",
diff --git a/frontend/src/core/codemirror/completion/__tests__/keymap.test.ts b/frontend/src/core/codemirror/completion/__tests__/keymap.test.ts
index d2f0d413b9..b4d555cf49 100644
--- a/frontend/src/core/codemirror/completion/__tests__/keymap.test.ts
+++ b/frontend/src/core/codemirror/completion/__tests__/keymap.test.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, vi } from "vitest";
+
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
+import { describe, expect, it, vi } from "vitest";
import { completionKeymap } from "../keymap";
describe("completionKeymap", () => {
diff --git a/frontend/src/core/codemirror/completion/completer.ts b/frontend/src/core/codemirror/completion/completer.ts
index 45353c7156..9349d96a39 100644
--- a/frontend/src/core/codemirror/completion/completer.ts
+++ b/frontend/src/core/codemirror/completion/completer.ts
@@ -4,12 +4,11 @@ import type {
CompletionResult,
CompletionSource,
} from "@codemirror/autocomplete";
-
-import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
-import { Logger } from "../../../utils/Logger";
import { type CellId, HTMLCellId } from "@/core/cells/ids";
-import { store } from "@/core/state/jotai";
import { documentationAtom } from "@/core/documentation/state";
+import { store } from "@/core/state/jotai";
+import { Logger } from "../../../utils/Logger";
+import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
/**
* Completion source for Python, using Jedi.
diff --git a/frontend/src/core/codemirror/completion/hints.ts b/frontend/src/core/codemirror/completion/hints.ts
index 0cce293f24..3878098e8e 100644
--- a/frontend/src/core/codemirror/completion/hints.ts
+++ b/frontend/src/core/codemirror/completion/hints.ts
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { HTMLCellId } from "@/core/cells/ids";
-import { EditorView, hoverTooltip } from "@codemirror/view";
-import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
-import { Logger } from "@/utils/Logger";
+
import type { EditorState, Text } from "@codemirror/state";
+import { EditorView, hoverTooltip } from "@codemirror/view";
import { debounce } from "lodash-es";
-import { documentationAtom } from "@/core/documentation/state";
-import { store } from "@/core/state/jotai";
import { chromeAtom } from "@/components/editor/chrome/state";
-import type { LSPConfig } from "@/core/config/config-schema";
+import { HTMLCellId } from "@/core/cells/ids";
import { hasCapability } from "@/core/config/capabilities";
+import type { LSPConfig } from "@/core/config/config-schema";
+import { documentationAtom } from "@/core/documentation/state";
+import { store } from "@/core/state/jotai";
+import { Logger } from "@/utils/Logger";
+import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
export function hintTooltip(lspConfig: LSPConfig) {
return [
diff --git a/frontend/src/core/codemirror/completion/keymap.ts b/frontend/src/core/codemirror/completion/keymap.ts
index 7b70a03c82..df27154c2b 100644
--- a/frontend/src/core/codemirror/completion/keymap.ts
+++ b/frontend/src/core/codemirror/completion/keymap.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Prec, type Extension } from "@codemirror/state";
+
import {
closeCompletion,
completionKeymap as defaultCompletionKeymap,
} from "@codemirror/autocomplete";
-import { keymap } from "@codemirror/view";
+import { type Extension, Prec } from "@codemirror/state";
import type { EditorView } from "@codemirror/view";
+import { keymap } from "@codemirror/view";
import { isInVimMode } from "../utils";
export function completionKeymap(): Extension {
diff --git a/frontend/src/core/codemirror/completion/variable-completions.ts b/frontend/src/core/codemirror/completion/variable-completions.ts
index 98c8038e2f..edff10ed86 100644
--- a/frontend/src/core/codemirror/completion/variable-completions.ts
+++ b/frontend/src/core/codemirror/completion/variable-completions.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { Variables, Variable } from "@/core/variables/types";
import type { Completion } from "@codemirror/autocomplete";
+import type { Variable, Variables } from "@/core/variables/types";
/**
* Gets completions for variables defined in the notebook.
diff --git a/frontend/src/core/codemirror/config/extension.ts b/frontend/src/core/codemirror/config/extension.ts
index 23a3ad2bb9..9ed2d85dbb 100644
--- a/frontend/src/core/codemirror/config/extension.ts
+++ b/frontend/src/core/codemirror/config/extension.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { CellId } from "@/core/cells/ids";
import type {
CompletionConfig,
DiagnosticsConfig,
LSPConfig,
} from "@/core/config/config-schema";
import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import type { CellId } from "@/core/cells/ids";
import { singleFacet } from "../facet";
import type { PlaceholderType } from "./types";
diff --git a/frontend/src/core/codemirror/copilot/__tests__/copilot.test.ts b/frontend/src/core/codemirror/copilot/__tests__/copilot.test.ts
index 3c5e302517..a1e2bf6a0a 100644
--- a/frontend/src/core/codemirror/copilot/__tests__/copilot.test.ts
+++ b/frontend/src/core/codemirror/copilot/__tests__/copilot.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { exportedForTesting } from "../extension";
+
import { EditorView } from "@codemirror/view";
+import { describe, expect, it } from "vitest";
import type { InlineCompletionList } from "vscode-languageserver-protocol";
+import { exportedForTesting } from "../extension";
const { getCopilotRequest, getSuggestion } = exportedForTesting;
diff --git a/frontend/src/core/codemirror/copilot/__tests__/getCode.test.ts b/frontend/src/core/codemirror/copilot/__tests__/getCode.test.ts
index 0e39116c00..805f0df67e 100644
--- a/frontend/src/core/codemirror/copilot/__tests__/getCode.test.ts
+++ b/frontend/src/core/codemirror/copilot/__tests__/getCode.test.ts
@@ -1,19 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { getTopologicalCellIds } from "../getCodes";
-import { notebookAtom } from "@/core/cells/cells";
-import { variablesAtom } from "@/core/variables/state";
-import { store } from "@/core/state/jotai";
-import { MultiColumn } from "@/utils/id-tree";
-import type { CellId } from "@/core/cells/ids";
-import type { VariableName, Variables } from "@/core/variables/types";
-import { getCodes } from "../getCodes";
+
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-
+import { describe, expect, it } from "vitest";
+import { notebookAtom } from "@/core/cells/cells";
+import type { CellId } from "@/core/cells/ids";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { store } from "@/core/state/jotai";
+import { variablesAtom } from "@/core/variables/state";
+import type { VariableName, Variables } from "@/core/variables/types";
+import { MultiColumn } from "@/utils/id-tree";
import { cellConfigExtension } from "../../config/extension";
import { adaptiveLanguageConfiguration } from "../../language/extension";
+import { getCodes, getTopologicalCellIds } from "../getCodes";
+
const Cells = {
cell1: "cell1" as CellId,
cell2: "cell2" as CellId,
diff --git a/frontend/src/core/codemirror/copilot/client.ts b/frontend/src/core/codemirror/copilot/client.ts
index 4d78a2d5f3..050c27fb26 100644
--- a/frontend/src/core/codemirror/copilot/client.ts
+++ b/frontend/src/core/codemirror/copilot/client.ts
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { once } from "@/utils/once";
+
import { languageServerWithClient } from "@marimo-team/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 type { JSONRPCRequestData } from "@open-rpc/client-js/build/Request";
-import { waitForEnabledCopilot } from "./state";
-import { Logger } from "@/utils/Logger";
+import { Transport } from "@open-rpc/client-js/build/transports/Transport";
import { toast } from "@/components/ui/use-toast";
import { waitForConnectionOpen } from "@/core/network/connection";
import { getRuntimeManager } from "@/core/runtime/config";
+import { Logger } from "@/utils/Logger";
+import { once } from "@/utils/once";
+import { CopilotLanguageServerClient } from "./language-server";
+import { waitForEnabledCopilot } from "./state";
// Dummy file for the copilot language server
export const COPILOT_FILENAME = "/__marimo_copilot__.py";
diff --git a/frontend/src/core/codemirror/copilot/copilot-config.tsx b/frontend/src/core/codemirror/copilot/copilot-config.tsx
index 0c5d469231..aa2cba7179 100644
--- a/frontend/src/core/codemirror/copilot/copilot-config.tsx
+++ b/frontend/src/core/codemirror/copilot/copilot-config.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useAtom } from "jotai";
-import { copilotSignedInState, isGitHubCopilotSignedInState } from "./state";
+import { CheckIcon, CopyIcon, Loader2Icon, XIcon } from "lucide-react";
import { memo, useState } from "react";
-import { getCopilotClient } from "./client";
import { Button, buttonVariants } from "@/components/ui/button";
-import { CheckIcon, CopyIcon, Loader2Icon, XIcon } from "lucide-react";
-import { ExternalLink } from "@/components/ui/links";
import { Label } from "@/components/ui/label";
+import { ExternalLink } from "@/components/ui/links";
import { toast } from "@/components/ui/use-toast";
import { copyToClipboard } from "@/utils/copy";
import { Logger } from "@/utils/Logger";
+import { getCopilotClient } from "./client";
+import { copilotSignedInState, isGitHubCopilotSignedInState } from "./state";
import type { GitHubCopilotStatus } from "./types";
export const CopilotConfig = memo(() => {
diff --git a/frontend/src/core/codemirror/copilot/extension.ts b/frontend/src/core/codemirror/copilot/extension.ts
index d3580e1d50..f2200beff7 100644
--- a/frontend/src/core/codemirror/copilot/extension.ts
+++ b/frontend/src/core/codemirror/copilot/extension.ts
@@ -1,37 +1,37 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
Compartment,
- Prec,
type EditorState,
type Extension,
+ Prec,
type Text,
} from "@codemirror/state";
+import type { EditorView } from "@codemirror/view";
import { keymap } from "@codemirror/view";
-import { COPILOT_FILENAME, copilotServer, getCopilotClient } from "./client";
import {
inlineCompletion,
rejectInlineCompletion,
} from "@marimo-team/codemirror-ai";
import {
copilotPlugin as codeiumCopilotPlugin,
- Language,
codeiumOtherDocumentsConfig,
+ Language,
} from "@valtown/codemirror-codeium";
-import { isCopilotEnabled } from "./state";
-import { getCodes } from "./getCodes";
-import type { CompletionConfig } from "@/core/config/config-schema";
-import { Logger } from "@/utils/Logger";
-import { languageAdapterState } from "../language/extension";
-import { API } from "@/core/network/api";
-import type { AiInlineCompletionRequest } from "@/core/kernel/messages";
-import type { EditorView } from "@codemirror/view";
-import { isInVimMode } from "../utils";
import {
- InlineCompletionTriggerKind,
type InlineCompletionItem,
type InlineCompletionList,
type InlineCompletionParams,
+ InlineCompletionTriggerKind,
} from "vscode-languageserver-protocol";
+import type { CompletionConfig } from "@/core/config/config-schema";
+import type { AiInlineCompletionRequest } from "@/core/kernel/messages";
+import { API } from "@/core/network/api";
+import { Logger } from "@/utils/Logger";
+import { languageAdapterState } from "../language/extension";
+import { isInVimMode } from "../utils";
+import { COPILOT_FILENAME, copilotServer, getCopilotClient } from "./client";
+import { getCodes } from "./getCodes";
+import { isCopilotEnabled } from "./state";
const copilotCompartment = new Compartment();
diff --git a/frontend/src/core/codemirror/copilot/getCodes.ts b/frontend/src/core/codemirror/copilot/getCodes.ts
index 451b89ff05..d5b7189936 100644
--- a/frontend/src/core/codemirror/copilot/getCodes.ts
+++ b/frontend/src/core/codemirror/copilot/getCodes.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { getAllEditorViews, notebookAtom } from "@/core/cells/cells";
-import { getEditorCodeAsPython } from "../language/utils";
+import type { CellId } from "@/core/cells/ids";
import { store } from "@/core/state/jotai";
import { variablesAtom } from "@/core/variables/state";
-import type { CellId } from "@/core/cells/ids";
import { Objects } from "@/utils/objects";
+import { getEditorCodeAsPython } from "../language/utils";
export function getCodes(otherCode: string) {
const codes = getOtherCellsCode(otherCode);
diff --git a/frontend/src/core/codemirror/copilot/language-server.ts b/frontend/src/core/codemirror/copilot/language-server.ts
index bf9a4b7e57..56ec6e981f 100644
--- a/frontend/src/core/codemirror/copilot/language-server.ts
+++ b/frontend/src/core/codemirror/copilot/language-server.ts
@@ -1,4 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { LanguageServerClient } from "@marimo-team/codemirror-languageserver";
+import { throttle } from "lodash-es";
import type {
CompletionItem,
CompletionList,
@@ -12,20 +15,18 @@ import type {
InlineCompletionParams,
} from "vscode-languageserver-protocol";
import { VersionedTextDocumentIdentifier } from "vscode-languageserver-protocol";
-import { LanguageServerClient } from "@marimo-team/codemirror-languageserver";
+import { Logger } from "@/utils/Logger";
+import { getCodes } from "./getCodes";
+import {
+ clearGitHubCopilotLoadingVersion,
+ isCopilotEnabled,
+ setGitHubCopilotLoadingVersion,
+} from "./state";
import type {
GitHubCopilotSignInConfirmParams,
GitHubCopilotSignInInitiateResult,
GitHubCopilotStatusResult,
} from "./types";
-import {
- isCopilotEnabled,
- setGitHubCopilotLoadingVersion,
- clearGitHubCopilotLoadingVersion,
-} from "./state";
-import { getCodes } from "./getCodes";
-import { Logger } from "@/utils/Logger";
-import { throttle } from "lodash-es";
const logger = Logger.get("@github/copilot-language-server");
diff --git a/frontend/src/core/codemirror/copilot/state.ts b/frontend/src/core/codemirror/copilot/state.ts
index aa7b224456..c7a2fca9d5 100644
--- a/frontend/src/core/codemirror/copilot/state.ts
+++ b/frontend/src/core/codemirror/copilot/state.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom } from "jotai";
+import { atomWithStorage } from "jotai/utils";
import {
getResolvedMarimoConfig,
resolvedMarimoConfigAtom,
} from "@/core/config/config";
import { store, waitFor } from "@/core/state/jotai";
-import { atom } from "jotai";
-import { atomWithStorage } from "jotai/utils";
const KEY = "marimo:copilot:signedIn";
diff --git a/frontend/src/core/codemirror/editing/__tests__/commands.test.ts b/frontend/src/core/codemirror/editing/__tests__/commands.test.ts
index b962ac2254..f95f5d8751 100644
--- a/frontend/src/core/codemirror/editing/__tests__/commands.test.ts
+++ b/frontend/src/core/codemirror/editing/__tests__/commands.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach } from "vitest";
-import type { EditorView } from "@codemirror/view";
-import { makeBulkCommand, foldAllBulk, unfoldAllBulk } from "../commands";
+
import { foldAll, unfoldAll } from "@codemirror/language";
+import type { EditorView } from "@codemirror/view";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { foldAllBulk, makeBulkCommand, unfoldAllBulk } from "../commands";
vi.mock("@codemirror/language", () => ({
foldAll: vi.fn(),
diff --git a/frontend/src/core/codemirror/editing/__tests__/debugging.test.ts b/frontend/src/core/codemirror/editing/__tests__/debugging.test.ts
index 9e1f673374..829c04db59 100644
--- a/frontend/src/core/codemirror/editing/__tests__/debugging.test.ts
+++ b/frontend/src/core/codemirror/editing/__tests__/debugging.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, beforeEach, afterEach } from "vitest";
+
+import { python } from "@codemirror/lang-python";
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { python } from "@codemirror/lang-python";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { insertDebuggerAtLine } from "../debugging";
describe("insertDebuggerAtLine", () => {
diff --git a/frontend/src/core/codemirror/editing/commands.ts b/frontend/src/core/codemirror/editing/commands.ts
index 949f3d929b..256db3eefc 100644
--- a/frontend/src/core/codemirror/editing/commands.ts
+++ b/frontend/src/core/codemirror/editing/commands.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { foldAll, unfoldAll } from "@codemirror/language";
-import type { EditorView, Command } from "@codemirror/view";
+import type { Command, EditorView } from "@codemirror/view";
import type { Nullable } from "vitest";
export type BulkCommand = (targets: Array<Nullable<EditorView>>) => boolean;
diff --git a/frontend/src/core/codemirror/editing/debugging.ts b/frontend/src/core/codemirror/editing/debugging.ts
index ce7e139710..7f806f2f21 100644
--- a/frontend/src/core/codemirror/editing/debugging.ts
+++ b/frontend/src/core/codemirror/editing/debugging.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Logger } from "@/utils/Logger";
+
import { EditorView } from "@codemirror/view";
+import { Logger } from "@/utils/Logger";
export function insertDebuggerAtLine(view: EditorView, line: number): boolean {
// Get the document
diff --git a/frontend/src/core/codemirror/extensions.ts b/frontend/src/core/codemirror/extensions.ts
index bd861fd1e1..85297907d1 100644
--- a/frontend/src/core/codemirror/extensions.ts
+++ b/frontend/src/core/codemirror/extensions.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { EditorView, keymap } from "@codemirror/view";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { invariant } from "@/utils/invariant";
+import { smartScrollIntoView } from "../../utils/scroll";
+import { cellActionsState, cellIdState } from "./cells/state";
import { formatEditorViews, formattingChangeEffect } from "./format";
import {
getCurrentLanguageAdapter,
toggleToLanguage,
} from "./language/commands";
-import { smartScrollIntoView } from "../../utils/scroll";
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { invariant } from "@/utils/invariant";
-import { cellActionsState, cellIdState } from "./cells/state";
/**
* Add a keymap to format the code in the editor.
diff --git a/frontend/src/core/codemirror/find-replace/extension.ts b/frontend/src/core/codemirror/find-replace/extension.ts
index e74278012a..4c2f5454b2 100644
--- a/frontend/src/core/codemirror/find-replace/extension.ts
+++ b/frontend/src/core/codemirror/find-replace/extension.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+
import {
highlightSelectionMatches,
selectNextOccurrence,
} from "@codemirror/search";
import { keymap } from "@codemirror/view";
-import { closeFindReplacePanel, openFindReplacePanel } from "./state";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import {
highlightTheme,
searchHighlighter,
searchState,
} from "./search-highlight";
+import { closeFindReplacePanel, openFindReplacePanel } from "./state";
export function findReplaceBundle(hotkeys: HotkeyProvider) {
return [
diff --git a/frontend/src/core/codemirror/find-replace/navigate.ts b/frontend/src/core/codemirror/find-replace/navigate.ts
index b0c806d9d1..ae7c8b4a94 100644
--- a/frontend/src/core/codemirror/find-replace/navigate.ts
+++ b/frontend/src/core/codemirror/find-replace/navigate.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { store } from "@/core/state/jotai";
+
import { SearchQuery } from "@codemirror/search";
import { EditorSelection } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { findReplaceAtom } from "./state";
import { getAllEditorViews } from "@/core/cells/cells";
-import { type QueryType, asQueryCreator } from "./query";
+import { store } from "@/core/state/jotai";
+import { asQueryCreator, type QueryType } from "./query";
+import { findReplaceAtom } from "./state";
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 4225fe7157..831ceae9d2 100644
--- a/frontend/src/core/codemirror/find-replace/query.ts
+++ b/frontend/src/core/codemirror/find-replace/query.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { invariant } from "@/utils/invariant";
+
import type { SearchCursor, SearchQuery } from "@codemirror/search";
import type { EditorState } from "@codemirror/state";
+import { invariant } from "@/utils/invariant";
type SearchResult = typeof SearchCursor.prototype.value;
diff --git a/frontend/src/core/codemirror/find-replace/search-highlight.ts b/frontend/src/core/codemirror/find-replace/search-highlight.ts
index 080c6059aa..ae307188a9 100644
--- a/frontend/src/core/codemirror/find-replace/search-highlight.ts
+++ b/frontend/src/core/codemirror/find-replace/search-highlight.ts
@@ -3,15 +3,15 @@ import { SearchQuery } from "@codemirror/search";
import { RangeSetBuilder, StateEffect, StateField } from "@codemirror/state";
import {
Decoration,
- ViewPlugin,
type DecorationSet,
EditorView,
+ ViewPlugin,
type ViewUpdate,
} from "@codemirror/view";
-import { type QueryType, asQueryCreator } from "./query";
+import { getAllEditorViews } from "@/core/cells/cells";
import { store } from "@/core/state/jotai";
+import { asQueryCreator, type QueryType } from "./query";
import { findReplaceAtom } from "./state";
-import { getAllEditorViews } from "@/core/cells/cells";
const setSearchQuery = StateEffect.define<SearchQuery>();
diff --git a/frontend/src/core/codemirror/find-replace/state.ts b/frontend/src/core/codemirror/find-replace/state.ts
index 08446301b2..f14a493b84 100644
--- a/frontend/src/core/codemirror/find-replace/state.ts
+++ b/frontend/src/core/codemirror/find-replace/state.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { store } from "@/core/state/jotai";
+
import type { EditorView } from "@codemirror/view";
import { atomWithReducer } from "jotai/utils";
+import { store } from "@/core/state/jotai";
interface FindReplaceState {
findText: string;
diff --git a/frontend/src/core/codemirror/format.ts b/frontend/src/core/codemirror/format.ts
index 6b2d6b45f0..f15027623e 100644
--- a/frontend/src/core/codemirror/format.ts
+++ b/frontend/src/core/codemirror/format.ts
@@ -1,22 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { getIndentUnit } from "@codemirror/language";
+import { StateEffect } from "@codemirror/state";
import type { EditorView } from "@codemirror/view";
-import type { CellId } from "../cells/ids";
+import { Logger } from "@/utils/Logger";
import { Objects } from "../../utils/objects";
-import { sendFormat } from "../network/requests";
import { getNotebook } from "../cells/cells";
+import type { CellId } from "../cells/ids";
import { notebookCellEditorViews } from "../cells/utils";
+import { getResolvedMarimoConfig } from "../config/config";
+import { sendFormat } from "../network/requests";
+import { cellActionsState } from "./cells/state";
+import { cellIdState } from "./config/extension";
+import { languageAdapterState } from "./language/extension";
import {
getEditorCodeAsPython,
updateEditorCodeFromPython,
} from "./language/utils";
-import { StateEffect } from "@codemirror/state";
-import { getResolvedMarimoConfig } from "../config/config";
-import { cellActionsState } from "./cells/state";
-import { languageAdapterState } from "./language/extension";
-import { Logger } from "@/utils/Logger";
-import { cellIdState } from "./config/extension";
-import { getIndentUnit } from "@codemirror/language";
export const formattingChangeEffect = StateEffect.define<boolean>();
diff --git a/frontend/src/core/codemirror/go-to-definition/__tests__/commands.test.ts b/frontend/src/core/codemirror/go-to-definition/__tests__/commands.test.ts
index e9c619503b..d7184104d8 100644
--- a/frontend/src/core/codemirror/go-to-definition/__tests__/commands.test.ts
+++ b/frontend/src/core/codemirror/go-to-definition/__tests__/commands.test.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { python } from "@codemirror/lang-python";
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { describe, afterEach, test, expect } from "vitest";
+import { afterEach, describe, expect, test } from "vitest";
import { goToVariableDefinition } from "../commands";
-import { python } from "@codemirror/lang-python";
function createEditor(content: string) {
const state = EditorState.create({
diff --git a/frontend/src/core/codemirror/go-to-definition/commands.ts b/frontend/src/core/codemirror/go-to-definition/commands.ts
index a09e9a6367..878ede847d 100644
--- a/frontend/src/core/codemirror/go-to-definition/commands.ts
+++ b/frontend/src/core/codemirror/go-to-definition/commands.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EditorView } from "@codemirror/view";
+
import { syntaxTree } from "@codemirror/language";
+import { EditorView } from "@codemirror/view";
function goToPosition(view: EditorView, from: number): void {
view.focus();
diff --git a/frontend/src/core/codemirror/go-to-definition/extension.ts b/frontend/src/core/codemirror/go-to-definition/extension.ts
index 8cf34e676c..ad4c7cb44f 100644
--- a/frontend/src/core/codemirror/go-to-definition/extension.ts
+++ b/frontend/src/core/codemirror/go-to-definition/extension.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { EditorView } from "@codemirror/view";
-import { underlineField, createUnderlinePlugin } from "./underline";
+import { createUnderlinePlugin, underlineField } from "./underline";
import { goToDefinition } from "./utils";
/**
diff --git a/frontend/src/core/codemirror/go-to-definition/underline.ts b/frontend/src/core/codemirror/go-to-definition/underline.ts
index 724f3e620e..73d348d4cc 100644
--- a/frontend/src/core/codemirror/go-to-definition/underline.ts
+++ b/frontend/src/core/codemirror/go-to-definition/underline.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { syntaxTree } from "@codemirror/language";
+import { StateEffect, StateField } from "@codemirror/state";
import {
- EditorView,
Decoration,
type DecorationSet,
+ EditorView,
ViewPlugin,
type ViewUpdate,
} from "@codemirror/view";
-import { StateField, StateEffect } from "@codemirror/state";
-import { syntaxTree } from "@codemirror/language";
import type { TreeCursor } from "@lezer/common";
// Decoration
diff --git a/frontend/src/core/codemirror/go-to-definition/utils.ts b/frontend/src/core/codemirror/go-to-definition/utils.ts
index ac9aa1f341..469e75bac4 100644
--- a/frontend/src/core/codemirror/go-to-definition/utils.ts
+++ b/frontend/src/core/codemirror/go-to-definition/utils.ts
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { closeCompletion } from "@codemirror/autocomplete";
import type { EditorState } from "@codemirror/state";
import { closeHoverTooltips, type EditorView } from "@codemirror/view";
-import { getPositionAtWordBounds } from "../completion/hints";
-import type { VariableName, Variables } from "../../variables/types";
-import { store } from "../../state/jotai";
+import type { CellId } from "@/core/cells/ids";
import { notebookAtom } from "../../cells/cells";
+import { store } from "../../state/jotai";
import { variablesAtom } from "../../variables/state";
-import type { CellId } from "@/core/cells/ids";
-import { goToVariableDefinition, goToLine } from "./commands";
-import { closeCompletion } from "@codemirror/autocomplete";
+import type { VariableName, Variables } from "../../variables/types";
+import { getPositionAtWordBounds } from "../completion/hints";
+import { goToLine, goToVariableDefinition } from "./commands";
/**
* Get the word under the cursor.
diff --git a/frontend/src/core/codemirror/keymaps/__tests__/keymaps.test.ts b/frontend/src/core/codemirror/keymaps/__tests__/keymaps.test.ts
index 7e48c9e79e..827d61de28 100644
--- a/frontend/src/core/codemirror/keymaps/__tests__/keymaps.test.ts
+++ b/frontend/src/core/codemirror/keymaps/__tests__/keymaps.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+
import { defaultKeymap as originalDefaultKeymap } from "@codemirror/commands";
-import { visibleForTesting } from "../keymaps";
+import { describe, expect, it } from "vitest";
import { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { visibleForTesting } from "../keymaps";
const { defaultKeymap, defaultVimKeymap, overrideKeymap, OVERRIDDEN_COMMANDS } =
visibleForTesting;
diff --git a/frontend/src/core/codemirror/keymaps/__tests__/vimrc.test.ts b/frontend/src/core/codemirror/keymaps/__tests__/vimrc.test.ts
index 6aa0edf3e8..38d2071dc9 100644
--- a/frontend/src/core/codemirror/keymaps/__tests__/vimrc.test.ts
+++ b/frontend/src/core/codemirror/keymaps/__tests__/vimrc.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, vi } from "vitest";
-import { parseVimrc } from "../vimrc";
+
// @ts-expect-error: no declaration file
import dedent from "string-dedent";
+import { describe, expect, it, vi } from "vitest";
+import { parseVimrc } from "../vimrc";
describe("parseVimrc", () => {
it("should parse mappings with no mode", () => {
diff --git a/frontend/src/core/codemirror/keymaps/keymaps.ts b/frontend/src/core/codemirror/keymaps/keymaps.ts
index 37806ddba6..664cec9c0d 100644
--- a/frontend/src/core/codemirror/keymaps/keymaps.ts
+++ b/frontend/src/core/codemirror/keymaps/keymaps.ts
@@ -1,9 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { KeymapConfig } from "@/core/config/config-schema";
-import { logNever } from "@/utils/assertNever";
+
import {
- defaultKeymap as originalDefaultKeymap,
insertNewlineAndIndent,
+ defaultKeymap as originalDefaultKeymap,
toggleBlockComment,
toggleComment,
} from "@codemirror/commands";
@@ -15,10 +14,12 @@ import {
keymap,
} from "@codemirror/view";
import { getCM, vim } from "@replit/codemirror-vim";
-import { vimKeymapExtension } from "./vim";
+import type { KeymapConfig } from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { logNever } from "@/utils/assertNever";
import { once } from "@/utils/once";
import { cellActionsState } from "../cells/state";
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { vimKeymapExtension } from "./vim";
export const KEYMAP_PRESETS = ["default", "vim"] as const;
diff --git a/frontend/src/core/codemirror/keymaps/vim.ts b/frontend/src/core/codemirror/keymaps/vim.ts
index bbc28d1460..f2852ada85 100644
--- a/frontend/src/core/codemirror/keymaps/vim.ts
+++ b/frontend/src/core/codemirror/keymaps/vim.ts
@@ -1,27 +1,27 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { Extension } from "@codemirror/state";
+import { type EditorView, keymap, ViewPlugin } from "@codemirror/view";
import {
type CodeMirror,
type CodeMirrorV,
getCM,
Vim,
} from "@replit/codemirror-vim";
-import { type EditorView, keymap, ViewPlugin } from "@codemirror/view";
+import { resolvedMarimoConfigAtom } from "@/core/config/config";
+import { sendFileDetails } from "@/core/network/requests";
+import { store } from "@/core/state/jotai";
+import { onIdle } from "@/utils/idle";
+import { invariant } from "@/utils/invariant";
+import { Logger } from "@/utils/Logger";
+import { once } from "@/utils/once";
+import { cellActionsState, cellIdState } from "../cells/state";
+import { goToDefinitionAtCursorPosition } from "../go-to-definition/utils";
import {
isAtEndOfEditor,
isAtStartOfEditor,
isInVimNormalMode,
} from "../utils";
-import { invariant } from "@/utils/invariant";
-import type { Extension } from "@codemirror/state";
-import { Logger } from "@/utils/Logger";
-import { goToDefinitionAtCursorPosition } from "../go-to-definition/utils";
-import { once } from "@/utils/once";
-import { onIdle } from "@/utils/idle";
-import { cellActionsState, cellIdState } from "../cells/state";
-import { sendFileDetails } from "@/core/network/requests";
-import { store } from "@/core/state/jotai";
-import { resolvedMarimoConfigAtom } from "@/core/config/config";
import { parseVimrc, type VimCommand } from "./vimrc";
export function vimKeymapExtension(): Extension[] {
diff --git a/frontend/src/core/codemirror/language/LanguageAdapters.ts b/frontend/src/core/codemirror/language/LanguageAdapters.ts
index 6883db194c..6e887e49a3 100644
--- a/frontend/src/core/codemirror/language/LanguageAdapters.ts
+++ b/frontend/src/core/codemirror/language/LanguageAdapters.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { LanguageAdapter, LanguageAdapterType } from "./types";
-import { PythonLanguageAdapter } from "./languages/python";
+
import { MarkdownLanguageAdapter } from "./languages/markdown";
+import { PythonLanguageAdapter } from "./languages/python";
import { SQLLanguageAdapter } from "./languages/sql";
+import type { LanguageAdapter, LanguageAdapterType } from "./types";
export const LanguageAdapters: Record<LanguageAdapterType, LanguageAdapter> = {
// Getters to prevent circular dependencies
diff --git a/frontend/src/core/codemirror/language/__tests__/ast.test.ts b/frontend/src/core/codemirror/language/__tests__/ast.test.ts
index 6edb8e99d9..b586675b21 100644
--- a/frontend/src/core/codemirror/language/__tests__/ast.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/ast.test.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { parseArgsKwargs } from "../utils/ast";
-import { parser } from "@lezer/python";
+
import type { TreeCursor } from "@lezer/common";
+import { parser } from "@lezer/python";
+import { describe, expect, it } from "vitest";
+import { parseArgsKwargs } from "../utils/ast";
function moveToArgList(cursor: TreeCursor) {
cursor.next();
diff --git a/frontend/src/core/codemirror/language/__tests__/extension.test.ts b/frontend/src/core/codemirror/language/__tests__/extension.test.ts
index 3425971742..4f90c110b1 100644
--- a/frontend/src/core/codemirror/language/__tests__/extension.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/extension.test.ts
@@ -1,18 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
import { describe, expect, it } from "vitest";
+import type { CellId } from "@/core/cells/ids";
+import { DUCKDB_ENGINE } from "@/core/datasets/data-source-connections";
+import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { cellConfigExtension } from "../../config/extension";
import {
adaptiveLanguageConfiguration,
getInitialLanguageAdapter,
languageAdapterState,
switchLanguage,
} from "../extension";
-import { EditorState } from "@codemirror/state";
-import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { EditorView } from "@codemirror/view";
-import type { CellId } from "@/core/cells/ids";
-import { cellConfigExtension } from "../../config/extension";
import { languageMetadataField } from "../metadata";
-import { DUCKDB_ENGINE } from "@/core/datasets/data-source-connections";
function createState(content: string, selection?: { anchor: number }) {
const state = EditorState.create({
diff --git a/frontend/src/core/codemirror/language/__tests__/indentOneTab.test.ts b/frontend/src/core/codemirror/language/__tests__/indentOneTab.test.ts
index aa4d01d30f..c889a4136d 100644
--- a/frontend/src/core/codemirror/language/__tests__/indentOneTab.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/indentOneTab.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { indentOneTab } from "../utils/indentOneTab";
describe("indentOneTab", () => {
diff --git a/frontend/src/core/codemirror/language/__tests__/markdown.test.ts b/frontend/src/core/codemirror/language/__tests__/markdown.test.ts
index 64f2e1eb72..eb69f804c2 100644
--- a/frontend/src/core/codemirror/language/__tests__/markdown.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/markdown.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, beforeEach } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
import {
MarkdownLanguageAdapter,
type MarkdownLanguageAdapterMetadata,
diff --git a/frontend/src/core/codemirror/language/__tests__/sql.test.ts b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
index c3f5927276..25245b0bbe 100644
--- a/frontend/src/core/codemirror/language/__tests__/sql.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
@@ -1,21 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, afterEach, beforeEach } from "vitest";
-import {
- SQLCompletionStore,
- SQLLanguageAdapter,
- type SQLLanguageAdapterMetadata,
-} from "../languages/sql";
-import { store } from "@/core/state/jotai";
+
+import { PostgreSQL } from "@codemirror/lang-sql";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
- dataSourceConnectionsAtom,
+ type ConnectionName,
DUCKDB_ENGINE,
+ dataSourceConnectionsAtom,
setLatestEngineSelected,
- type ConnectionName,
} from "@/core/datasets/data-source-connections";
-import type { DataSourceConnection } from "@/core/kernel/messages";
-import { PostgreSQL } from "@codemirror/lang-sql";
import { datasetsAtom } from "@/core/datasets/state";
import type { DatasetsState } from "@/core/datasets/types";
+import type { DataSourceConnection } from "@/core/kernel/messages";
+import { store } from "@/core/state/jotai";
+import {
+ SQLCompletionStore,
+ SQLLanguageAdapter,
+ type SQLLanguageAdapterMetadata,
+} from "../languages/sql";
const adapter = new SQLLanguageAdapter();
diff --git a/frontend/src/core/codemirror/language/__tests__/utils.test.ts b/frontend/src/core/codemirror/language/__tests__/utils.test.ts
index a5b39a5253..d42c4a0554 100644
--- a/frontend/src/core/codemirror/language/__tests__/utils.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/utils.test.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- getEditorCodeAsPython,
- updateEditorCodeFromPython,
- splitEditor,
-} from "../utils";
+
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
-import { describe, it, expect } from "vitest";
-import { adaptiveLanguageConfiguration, switchLanguage } from "../extension";
-import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { describe, expect, it } from "vitest";
import type { CellId } from "@/core/cells/ids";
+import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
import { cellConfigExtension } from "../../config/extension";
+import { adaptiveLanguageConfiguration, switchLanguage } from "../extension";
+import {
+ getEditorCodeAsPython,
+ splitEditor,
+ updateEditorCodeFromPython,
+} from "../utils";
function createEditor(doc: string) {
return new EditorView({
diff --git a/frontend/src/core/codemirror/language/commands.ts b/frontend/src/core/codemirror/language/commands.ts
index c2825f9414..8d4bef6f74 100644
--- a/frontend/src/core/codemirror/language/commands.ts
+++ b/frontend/src/core/codemirror/language/commands.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { EditorView } from "@codemirror/view";
-import { getEditorCodeAsPython } from "./utils";
import { languageAdapterState, switchLanguage } from "./extension";
import { LanguageAdapters } from "./LanguageAdapters";
import type { LanguageAdapterType } from "./types";
+import { getEditorCodeAsPython } from "./utils";
/**
* Get the current mode of the editor view.
diff --git a/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts b/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts
index e5c7813cb6..eac6282204 100644
--- a/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts
+++ b/frontend/src/core/codemirror/language/embedded/__tests__/embedded-python.test.ts
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, beforeEach } from "vitest";
-import { parsePython, variableCompletionSource } from "../embedded-python";
-import { EditorState } from "@codemirror/state";
+
+import type { CompletionContext } from "@codemirror/autocomplete";
import { python } from "@codemirror/lang-python";
+import { EditorState } from "@codemirror/state";
+import type { InlineContext } from "@lezer/markdown";
+import { beforeEach, describe, expect, it } from "vitest";
+import type { CellId } from "@/core/cells/ids";
import { store } from "@/core/state/jotai";
import { variablesAtom } from "@/core/variables/state";
-import type { Variables, VariableName } from "@/core/variables/types";
-import type { CellId } from "@/core/cells/ids";
-import type { CompletionContext } from "@codemirror/autocomplete";
-import type { InlineContext } from "@lezer/markdown";
+import type { VariableName, Variables } from "@/core/variables/types";
+import { parsePython, variableCompletionSource } from "../embedded-python";
const IS_ACTIVE = () => true;
diff --git a/frontend/src/core/codemirror/language/embedded/embedded-python.ts b/frontend/src/core/codemirror/language/embedded/embedded-python.ts
index a9e2c0b717..f445b7eaf2 100644
--- a/frontend/src/core/codemirror/language/embedded/embedded-python.ts
+++ b/frontend/src/core/codemirror/language/embedded/embedded-python.ts
@@ -1,15 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { parseMixed, type Parser } from "@lezer/common";
-import { tags } from "@lezer/highlight";
-import type { InlineContext, MarkdownConfig } from "@lezer/markdown";
-import { python } from "@codemirror/lang-python";
-
-import { store } from "@/core/state/jotai";
import type {
CompletionContext,
CompletionResult,
} from "@codemirror/autocomplete";
+import { python } from "@codemirror/lang-python";
+import { type Parser, parseMixed } from "@lezer/common";
+import { tags } from "@lezer/highlight";
+import type { InlineContext, MarkdownConfig } from "@lezer/markdown";
+import { store } from "@/core/state/jotai";
import { variablesAtom } from "@/core/variables/state";
import { getVariableCompletions } from "../../completion/variable-completions";
diff --git a/frontend/src/core/codemirror/language/embedded/latex.ts b/frontend/src/core/codemirror/language/embedded/latex.ts
index eda32cd858..26deb63b78 100644
--- a/frontend/src/core/codemirror/language/embedded/latex.ts
+++ b/frontend/src/core/codemirror/language/embedded/latex.ts
@@ -29,7 +29,7 @@
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import { parseMixed, type Parser } from "@lezer/common";
+import { type Parser, parseMixed } from "@lezer/common";
import { tags } from "@lezer/highlight";
import type {
DelimiterType,
@@ -81,7 +81,7 @@ const DELIMITERS = Object.keys(DELIMITER_LENGTH).reduce<
* @returns Markdown extension
*/
export function parseLatex(latexParser: Parser): MarkdownConfig {
- const defineNodes = new Array<NodeSpec>();
+ const defineNodes: NodeSpec[] = [];
Object.keys(DELIMITER_LENGTH).forEach((name) => {
defineNodes.push(
{
diff --git a/frontend/src/core/codemirror/language/extension.ts b/frontend/src/core/codemirror/language/extension.ts
index e17a40eafa..b38490897d 100644
--- a/frontend/src/core/codemirror/language/extension.ts
+++ b/frontend/src/core/codemirror/language/extension.ts
@@ -1,18 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { history } from "@codemirror/commands";
import {
Compartment,
EditorSelection,
StateEffect,
StateField,
} from "@codemirror/state";
-import type { LanguageAdapter } from "./types";
import { type EditorView, keymap, showPanel } from "@codemirror/view";
-import { clamp } from "@/utils/math";
+import type { CellId } from "@/core/cells/ids";
import type {
CompletionConfig,
DiagnosticsConfig,
LSPConfig,
} from "@/core/config/config-schema";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { clamp } from "@/utils/math";
import {
cellIdState,
completionConfigState,
@@ -22,16 +25,14 @@ import {
} from "../config/extension";
import type { PlaceholderType } from "../config/types";
import { historyCompartment } from "../editing/extensions";
-import { history } from "@codemirror/commands";
import { formattingChangeEffect } from "../format";
-import { getEditorCodeAsPython } from "./utils";
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import { getLanguageAdapters, LanguageAdapters } from "./LanguageAdapters";
import { createPanel } from "../react-dom/createPanel";
-import { LanguagePanelComponent } from "./panel/panel";
-import type { CellId } from "@/core/cells/ids";
+import { getLanguageAdapters, LanguageAdapters } from "./LanguageAdapters";
import type { LanguageMetadata } from "./metadata";
import { languageMetadataField, setLanguageMetadata } from "./metadata";
+import { LanguagePanelComponent } from "./panel/panel";
+import type { LanguageAdapter } from "./types";
+import { getEditorCodeAsPython } from "./utils";
/**
* Compartment to keep track of the current language and extension.
diff --git a/frontend/src/core/codemirror/language/languages/markdown.ts b/frontend/src/core/codemirror/language/languages/markdown.ts
index 6340baf81b..a5c7176fb0 100644
--- a/frontend/src/core/codemirror/language/languages/markdown.ts
+++ b/frontend/src/core/codemirror/language/languages/markdown.ts
@@ -1,32 +1,33 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { Extension } from "@codemirror/state";
-import type { LanguageAdapter } from "../types";
+
+import { autocompletion } from "@codemirror/autocomplete";
import { markdown, markdownLanguage } from "@codemirror/lang-markdown";
import { python, pythonLanguage } from "@codemirror/lang-python";
+import { StreamLanguage } from "@codemirror/language";
import { languages } from "@codemirror/language-data";
import { stexMath } from "@codemirror/legacy-modes/mode/stex";
+import type { Extension } from "@codemirror/state";
+import { type EditorView, ViewPlugin } from "@codemirror/view";
// @ts-expect-error: no declaration file
import dedent from "string-dedent";
-import { autocompletion } from "@codemirror/autocomplete";
-import { enhancedMarkdownExtension } from "../../markdown/extension";
+import type { CellId } from "@/core/cells/ids";
import type { CompletionConfig } from "@/core/config/config-schema";
import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { markdownAutoRunExtension } from "../../cells/extensions";
+import { pythonCompletionSource } from "../../completion/completer";
+import { conditionalCompletion } from "../../completion/utils";
+import type { PlaceholderType } from "../../config/types";
+import { markdownCompletionSources } from "../../markdown/completions";
+import { enhancedMarkdownExtension } from "../../markdown/extension";
+import { parsePython } from "../embedded/embedded-python";
+import { parseLatex } from "../embedded/latex";
+import { languageMetadataField } from "../metadata";
+import type { LanguageAdapter } from "../types";
import {
QUOTE_PREFIX_KINDS,
type QuotePrefixKind,
splitQuotePrefix,
} from "../utils/quotes";
-import { markdownAutoRunExtension } from "../../cells/extensions";
-import type { PlaceholderType } from "../../config/types";
-import type { CellId } from "@/core/cells/ids";
-import { parseLatex } from "../embedded/latex";
-import { StreamLanguage } from "@codemirror/language";
-import { parsePython } from "../embedded/embedded-python";
-import { conditionalCompletion } from "../../completion/utils";
-import { pythonCompletionSource } from "../../completion/completer";
-import { markdownCompletionSources } from "../../markdown/completions";
-import { type EditorView, ViewPlugin } from "@codemirror/view";
-import { languageMetadataField } from "../metadata";
export interface MarkdownLanguageAdapterMetadata {
quotePrefix: QuotePrefixKind;
diff --git a/frontend/src/core/codemirror/language/languages/python.ts b/frontend/src/core/codemirror/language/languages/python.ts
index d3db46511b..3ed2d2bdbd 100644
--- a/frontend/src/core/codemirror/language/languages/python.ts
+++ b/frontend/src/core/codemirror/language/languages/python.ts
@@ -1,47 +1,48 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type Extension, Prec } from "@codemirror/state";
-import type { LanguageAdapter } from "../types";
+
+import { autocompletion } from "@codemirror/autocomplete";
import {
- pythonLanguage,
- localCompletionSource,
globalCompletion,
+ localCompletionSource,
+ pythonLanguage,
} from "@codemirror/lang-python";
import {
- foldNodeProp,
foldInside,
+ foldNodeProp,
LanguageSupport,
} from "@codemirror/language";
+import { type Extension, Prec } from "@codemirror/state";
+import {
+ documentUri,
+ LanguageServerClient,
+ languageServerWithClient,
+} from "@marimo-team/codemirror-languageserver";
+import { WebSocketTransport } from "@open-rpc/client-js";
+import type { CellId } from "@/core/cells/ids";
+import { hasCapability } from "@/core/config/capabilities";
import type {
CompletionConfig,
DiagnosticsConfig,
LSPConfig,
} from "@/core/config/config-schema";
+import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import type { PlaceholderType } from "../../config/types";
-import {
- smartPlaceholderExtension,
- clickablePlaceholderExtension,
-} from "../../placeholder/extensions";
-import {
- LanguageServerClient,
- languageServerWithClient,
- documentUri,
-} from "@marimo-team/codemirror-languageserver";
-import { WebSocketTransport } from "@open-rpc/client-js";
-import { NotebookLanguageServerClient } from "../../lsp/notebook-lsp";
+import { waitForConnectionOpen } from "@/core/network/connection";
+import { openFile } from "@/core/network/requests";
+import { getRuntimeManager } from "@/core/runtime/config";
+import { Logger } from "@/utils/Logger";
import { once } from "@/utils/once";
-import { autocompletion } from "@codemirror/autocomplete";
-import { pythonCompletionSource } from "../../completion/completer";
-import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
import { Paths } from "@/utils/paths";
-import type { CellId } from "@/core/cells/ids";
import { cellActionsState } from "../../cells/state";
-import { openFile } from "@/core/network/requests";
-import { Logger } from "@/utils/Logger";
+import { pythonCompletionSource } from "../../completion/completer";
+import type { PlaceholderType } from "../../config/types";
+import { NotebookLanguageServerClient } from "../../lsp/notebook-lsp";
import { CellDocumentUri } from "../../lsp/types";
-import { hasCapability } from "@/core/config/capabilities";
-import { getRuntimeManager } from "@/core/runtime/config";
-import { waitForConnectionOpen } from "@/core/network/connection";
+import {
+ clickablePlaceholderExtension,
+ smartPlaceholderExtension,
+} from "../../placeholder/extensions";
+import type { LanguageAdapter } from "../types";
const pylspTransport = once(() => {
const runtimeManager = getRuntimeManager();
diff --git a/frontend/src/core/codemirror/language/languages/sql.ts b/frontend/src/core/codemirror/language/languages/sql.ts
index 6c3086eab9..8d2967b4f5 100644
--- a/frontend/src/core/codemirror/language/languages/sql.ts
+++ b/frontend/src/core/codemirror/language/languages/sql.ts
@@ -1,45 +1,46 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { Extension } from "@codemirror/state";
-import type { LanguageAdapter } from "../types";
-// @ts-expect-error: no declaration file
-import dedent from "string-dedent";
-import { indentOneTab } from "../utils/indentOneTab";
+
import {
autocompletion,
type CompletionSource,
} from "@codemirror/autocomplete";
-import { store } from "@/core/state/jotai";
-import type { QuotePrefixKind } from "../utils/quotes";
-import { MarkdownLanguageAdapter } from "./markdown";
import {
- dataConnectionsMapAtom,
- dataSourceConnectionsAtom,
- DUCKDB_ENGINE,
- setLatestEngineSelected,
- type ConnectionName,
-} from "@/core/datasets/data-source-connections";
-import { parser } from "@lezer/python";
-import type { SyntaxNode, TreeCursor } from "@lezer/common";
-import { parseArgsKwargs } from "../utils/ast";
-import { Logger } from "@/utils/Logger";
-import {
- sql,
- StandardSQL,
+ keywordCompletionSource,
+ MSSQL,
+ MySQL,
+ PostgreSQL,
type SQLConfig,
- schemaCompletionSource,
type SQLDialect,
- PostgreSQL,
- MySQL,
SQLite,
- MSSQL,
- keywordCompletionSource,
+ StandardSQL,
+ schemaCompletionSource,
+ sql,
} from "@codemirror/lang-sql";
-import { LRUCache } from "@/utils/lru";
-import type { DataSourceConnection } from "@/core/kernel/messages";
+import type { Extension } from "@codemirror/state";
+import type { SyntaxNode, TreeCursor } from "@lezer/common";
+import { parser } from "@lezer/python";
+// @ts-expect-error: no declaration file
+import dedent from "string-dedent";
import { isSchemaless } from "@/components/datasources/utils";
+import {
+ type ConnectionName,
+ DUCKDB_ENGINE,
+ dataConnectionsMapAtom,
+ dataSourceConnectionsAtom,
+ setLatestEngineSelected,
+} from "@/core/datasets/data-source-connections";
import { datasetTablesAtom } from "@/core/datasets/state";
+import type { DataSourceConnection } from "@/core/kernel/messages";
+import { store } from "@/core/state/jotai";
+import { Logger } from "@/utils/Logger";
+import { LRUCache } from "@/utils/lru";
import { variableCompletionSource } from "../embedded/embedded-python";
import { languageMetadataField } from "../metadata";
+import type { LanguageAdapter } from "../types";
+import { parseArgsKwargs } from "../utils/ast";
+import { indentOneTab } from "../utils/indentOneTab";
+import type { QuotePrefixKind } from "../utils/quotes";
+import { MarkdownLanguageAdapter } from "./markdown";
export interface SQLLanguageAdapterMetadata {
dataframeName: string;
diff --git a/frontend/src/core/codemirror/language/metadata.ts b/frontend/src/core/codemirror/language/metadata.ts
index f93c3d9245..ba126785da 100644
--- a/frontend/src/core/codemirror/language/metadata.ts
+++ b/frontend/src/core/codemirror/language/metadata.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { StateField, StateEffect, type EditorState } from "@codemirror/state";
+import { type EditorState, StateEffect, StateField } from "@codemirror/state";
import type { EditorView } from "@codemirror/view";
/**
diff --git a/frontend/src/core/codemirror/language/panel/panel.tsx b/frontend/src/core/codemirror/language/panel/panel.tsx
index 022c89a0db..49328cf064 100644
--- a/frontend/src/core/codemirror/language/panel/panel.tsx
+++ b/frontend/src/core/codemirror/language/panel/panel.tsx
@@ -1,23 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { EditorView } from "@codemirror/view";
-import { SQLLanguageAdapter } from "../languages/sql";
-import { normalizeName } from "@/core/cells/names";
-import { useAutoGrowInputProps } from "@/hooks/useAutoGrowInputProps";
import { InfoIcon, PaintRollerIcon } from "lucide-react";
-
-import { formatSQL } from "../../format";
import { Button } from "@/components/ui/button";
+import { Checkbox } from "@/components/ui/checkbox";
import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { normalizeName } from "@/core/cells/names";
+import { useAutoGrowInputProps } from "@/hooks/useAutoGrowInputProps";
+import { formatSQL } from "../../format";
+import { languageAdapterState } from "../extension";
import { MarkdownLanguageAdapter } from "../languages/markdown";
-import type { QuotePrefixKind } from "../utils/quotes";
-import { Checkbox } from "@/components/ui/checkbox";
+import { SQLLanguageAdapter } from "../languages/sql";
import {
type LanguageMetadata,
languageMetadataField,
updateLanguageMetadata,
} from "../metadata";
import type { LanguageMetadataOf } from "../types";
-import { languageAdapterState } from "../extension";
+import type { QuotePrefixKind } from "../utils/quotes";
import { getQuotePrefix, MarkdownQuotePrefixTooltip } from "./markdown";
import { SQLEngineSelect } from "./sql";
diff --git a/frontend/src/core/codemirror/language/panel/sql.tsx b/frontend/src/core/codemirror/language/panel/sql.tsx
index 6888263082..4297ebde16 100644
--- a/frontend/src/core/codemirror/language/panel/sql.tsx
+++ b/frontend/src/core/codemirror/language/panel/sql.tsx
@@ -1,12 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import {
- type ConnectionName,
- dataConnectionsMapAtom,
- INTERNAL_SQL_ENGINES,
- setLatestEngineSelected,
-} from "@/core/datasets/data-source-connections";
+
import { useAtomValue } from "jotai";
import { AlertCircle, CircleHelpIcon } from "lucide-react";
+import { transformDisplayName } from "@/components/databases/display";
+import { DatabaseLogo } from "@/components/databases/icon";
import {
Select,
SelectContent,
@@ -17,10 +14,14 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { DatabaseLogo } from "@/components/databases/icon";
-import { transformDisplayName } from "@/components/databases/display";
-import { useNonce } from "@/hooks/useNonce";
+import {
+ type ConnectionName,
+ dataConnectionsMapAtom,
+ INTERNAL_SQL_ENGINES,
+ setLatestEngineSelected,
+} from "@/core/datasets/data-source-connections";
import type { DataSourceConnection } from "@/core/kernel/messages";
+import { useNonce } from "@/hooks/useNonce";
interface SelectProps {
selectedEngine: ConnectionName;
diff --git a/frontend/src/core/codemirror/language/types.ts b/frontend/src/core/codemirror/language/types.ts
index 9237c7d917..8617e1d9f4 100644
--- a/frontend/src/core/codemirror/language/types.ts
+++ b/frontend/src/core/codemirror/language/types.ts
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import type { Extension } from "@codemirror/state";
+import type { CellId } from "@/core/cells/ids";
import type {
CompletionConfig,
DiagnosticsConfig,
LSPConfig,
} from "@/core/config/config-schema";
import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
-import type { Extension } from "@codemirror/state";
import type { PlaceholderType } from "../config/types";
-import type { CellId } from "@/core/cells/ids";
/**
* A language adapter is a class that can transform code from one language to
diff --git a/frontend/src/core/codemirror/language/utils.ts b/frontend/src/core/codemirror/language/utils.ts
index dd082f069f..8e9145df41 100644
--- a/frontend/src/core/codemirror/language/utils.ts
+++ b/frontend/src/core/codemirror/language/utils.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { EditorState } from "@codemirror/state";
import type { EditorView } from "@codemirror/view";
import { languageAdapterState } from "./extension";
-import type { EditorState } from "@codemirror/state";
import { languageMetadataField } from "./metadata";
/**
diff --git a/frontend/src/core/codemirror/language/utils/ast.ts b/frontend/src/core/codemirror/language/utils/ast.ts
index e1093acc70..745c4c1874 100644
--- a/frontend/src/core/codemirror/language/utils/ast.ts
+++ b/frontend/src/core/codemirror/language/utils/ast.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Logger } from "@/utils/Logger";
+
import type { SyntaxNode, TreeCursor } from "@lezer/common";
+import { Logger } from "@/utils/Logger";
const SYNTAX_TOKENS = new Set(["(", "[", "{", ",", ")", "]", "}"]);
diff --git a/frontend/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts b/frontend/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts
index 1a1193d3ad..fb29199102 100644
--- a/frontend/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts
+++ b/frontend/src/core/codemirror/lsp/__tests__/notebook-lsp.test.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { describe, it, expect, vi, beforeEach, type Mocked } from "vitest";
-import { createNotebookLens } from "../lens";
-import * as LSP from "vscode-languageserver-protocol";
-import { NotebookLanguageServerClient } from "../notebook-lsp";
-import { CellDocumentUri, type ILanguageServerClient } from "../types";
-import type { CellId } from "@/core/cells/ids";
+
import { EditorView } from "@codemirror/view";
import {
type LanguageServerClient,
languageServerWithClient,
} from "@marimo-team/codemirror-languageserver";
+import { beforeEach, describe, expect, it, type Mocked, vi } from "vitest";
+import * as LSP from "vscode-languageserver-protocol";
+import type { CellId } from "@/core/cells/ids";
+import { createNotebookLens } from "../lens";
+import { NotebookLanguageServerClient } from "../notebook-lsp";
+import { CellDocumentUri, type ILanguageServerClient } from "../types";
const Cells = {
cell1: "cell1" as CellId,
diff --git a/frontend/src/core/codemirror/lsp/lens.ts b/frontend/src/core/codemirror/lsp/lens.ts
index 072ace84d3..c741e2566a 100644
--- a/frontend/src/core/codemirror/lsp/lens.ts
+++ b/frontend/src/core/codemirror/lsp/lens.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type * as LSP from "vscode-languageserver-protocol";
import type { CellId } from "@/core/cells/ids";
import { Logger } from "@/utils/Logger";
import { Objects } from "@/utils/objects";
-import type * as LSP from "vscode-languageserver-protocol";
export interface NotebookLens {
/** The ids of the cells in the notebook */
diff --git a/frontend/src/core/codemirror/lsp/notebook-lsp.ts b/frontend/src/core/codemirror/lsp/notebook-lsp.ts
index 978dfff1fe..5644cbf22d 100644
--- a/frontend/src/core/codemirror/lsp/notebook-lsp.ts
+++ b/frontend/src/core/codemirror/lsp/notebook-lsp.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { EditorView } from "@codemirror/view";
import type * as LSP from "vscode-languageserver-protocol";
-import { getTopologicalCodes } from "../copilot/getCodes";
-import { createNotebookLens } from "./lens";
-import { CellDocumentUri, type ILanguageServerClient } from "./types";
+import type { CellId } from "@/core/cells/ids";
import { invariant } from "@/utils/invariant";
import { Logger } from "@/utils/Logger";
import { LRUCache } from "@/utils/lru";
-import type { CellId } from "@/core/cells/ids";
-import type { EditorView } from "@codemirror/view";
+import { getTopologicalCodes } from "../copilot/getCodes";
+import { createNotebookLens } from "./lens";
+import { CellDocumentUri, type ILanguageServerClient } from "./types";
import { getLSPDocument } from "./utils";
export class NotebookLanguageServerClient implements ILanguageServerClient {
diff --git a/frontend/src/core/codemirror/lsp/types.ts b/frontend/src/core/codemirror/lsp/types.ts
index e495d556d5..9f7e374b04 100644
--- a/frontend/src/core/codemirror/lsp/types.ts
+++ b/frontend/src/core/codemirror/lsp/types.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { LanguageServerClient } from "@marimo-team/codemirror-languageserver";
+import type { DocumentUri } from "vscode-languageserver-protocol";
import type { CellId } from "@/core/cells/ids";
import { invariant } from "@/utils/invariant";
import type { TypedString } from "@/utils/typed";
-import type { LanguageServerClient } from "@marimo-team/codemirror-languageserver";
-import type { DocumentUri } from "vscode-languageserver-protocol";
export type ILanguageServerClient = {
[key in keyof LanguageServerClient]: LanguageServerClient[key];
diff --git a/frontend/src/core/codemirror/markdown/__tests__/commands.test.ts b/frontend/src/core/codemirror/markdown/__tests__/commands.test.ts
index 46ccd839fd..7f139cbfca 100644
--- a/frontend/src/core/codemirror/markdown/__tests__/commands.test.ts
+++ b/frontend/src/core/codemirror/markdown/__tests__/commands.test.ts
@@ -1,14 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { EditorState, EditorView, basicSetup } from "@uiw/react-codemirror";
+import { basicSetup, EditorState, EditorView } from "@uiw/react-codemirror";
import {
- describe,
+ afterAll,
afterEach,
- test,
+ beforeEach,
+ describe,
expect,
+ test,
vi,
- beforeEach,
- afterAll,
} from "vitest";
+import { sendCreateFileOrFolder } from "@/core/network/requests";
+import { filenameAtom } from "@/core/saving/file-state";
+import { store } from "@/core/state/jotai";
import {
insertBlockquote,
insertBoldMarker,
@@ -20,9 +23,6 @@ import {
insertTextFile,
insertUL,
} from "../commands";
-import { sendCreateFileOrFolder } from "@/core/network/requests";
-import { filenameAtom } from "@/core/saving/file-state";
-import { store } from "@/core/state/jotai";
function createEditor(content: string) {
const state = EditorState.create({
diff --git a/frontend/src/core/codemirror/markdown/commands.ts b/frontend/src/core/codemirror/markdown/commands.ts
index b6e282bba1..8c30d57d54 100644
--- a/frontend/src/core/codemirror/markdown/commands.ts
+++ b/frontend/src/core/codemirror/markdown/commands.ts
@@ -1,9 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { toast } from "@/components/ui/use-toast";
-import { sendCreateFileOrFolder } from "@/core/network/requests";
-import { filenameAtom } from "@/core/saving/file-state";
-import { store } from "@/core/state/jotai";
-import { Paths, type FilePath } from "@/utils/paths";
+
import {
EditorSelection,
type SelectionRange,
@@ -11,6 +7,11 @@ import {
Transaction,
} from "@codemirror/state";
import type { EditorView } from "@codemirror/view";
+import { toast } from "@/components/ui/use-toast";
+import { sendCreateFileOrFolder } from "@/core/network/requests";
+import { filenameAtom } from "@/core/saving/file-state";
+import { store } from "@/core/state/jotai";
+import { type FilePath, Paths } from "@/utils/paths";
function hasSelection(view: EditorView) {
return !view.state.selection.main.empty;
diff --git a/frontend/src/core/codemirror/markdown/completions.ts b/frontend/src/core/codemirror/markdown/completions.ts
index 525e2d480b..89afa2634a 100644
--- a/frontend/src/core/codemirror/markdown/completions.ts
+++ b/frontend/src/core/codemirror/markdown/completions.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { Completion, CompletionSource } from "@codemirror/autocomplete";
import { once } from "@/utils/once";
-import type { CompletionSource, Completion } from "@codemirror/autocomplete";
const emojiCompletionSource: CompletionSource = async (context) => {
// Check if the cursor is at a position where an emoji can be inserted
diff --git a/frontend/src/core/codemirror/markdown/extension.ts b/frontend/src/core/codemirror/markdown/extension.ts
index 0ddaecc655..351d678b70 100644
--- a/frontend/src/core/codemirror/markdown/extension.ts
+++ b/frontend/src/core/codemirror/markdown/extension.ts
@@ -1,5 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { type Extension, Prec } from "@codemirror/state";
+import { EditorView, keymap } from "@codemirror/view";
+import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
import {
insertBlockquote,
insertBoldMarker,
@@ -11,8 +13,6 @@ import {
insertTextFile,
insertUL,
} from "./commands";
-import { EditorView, keymap } from "@codemirror/view";
-import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
export function enhancedMarkdownExtension(
hotkeys: HotkeyProvider,
diff --git a/frontend/src/core/codemirror/misc/__tests__/dnd.test.ts b/frontend/src/core/codemirror/misc/__tests__/dnd.test.ts
index 13b5b12109..d025462fd8 100644
--- a/frontend/src/core/codemirror/misc/__tests__/dnd.test.ts
+++ b/frontend/src/core/codemirror/misc/__tests__/dnd.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { EditorView } from "@codemirror/view";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { dndBundle } from "../dnd";
-import { describe, beforeEach, afterEach, it, expect } from "vitest";
describe("dnd", () => {
let view: EditorView;
diff --git a/frontend/src/core/codemirror/misc/__tests__/paste.test.ts b/frontend/src/core/codemirror/misc/__tests__/paste.test.ts
index f07d00f676..e3153bec34 100644
--- a/frontend/src/core/codemirror/misc/__tests__/paste.test.ts
+++ b/frontend/src/core/codemirror/misc/__tests__/paste.test.ts
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi } from "vitest";
-import { extractCells, pasteBundle } from "../paste";
-import { EditorView } from "@codemirror/view";
+
import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import { describe, expect, it, vi } from "vitest";
import {
- cellActionsState,
type CodemirrorCellActions,
+ cellActionsState,
} from "../../cells/state";
+import { extractCells, pasteBundle } from "../paste";
describe("extractCells", () => {
it("returns empty array for non-marimo text", () => {
diff --git a/frontend/src/core/codemirror/placeholder/__tests__/extensions.test.ts b/frontend/src/core/codemirror/placeholder/__tests__/extensions.test.ts
index 510b7619d2..a4df0062e7 100644
--- a/frontend/src/core/codemirror/placeholder/__tests__/extensions.test.ts
+++ b/frontend/src/core/codemirror/placeholder/__tests__/extensions.test.ts
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
-import { EditorView } from "@codemirror/view";
+
import { EditorState } from "@codemirror/state";
+import { EditorView } from "@codemirror/view";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
- smartPlaceholderExtension,
clickablePlaceholderExtension,
+ smartPlaceholderExtension,
} from "../extensions";
describe("smartPlaceholderExtension", () => {
diff --git a/frontend/src/core/codemirror/react-dom/createPanel.tsx b/frontend/src/core/codemirror/react-dom/createPanel.tsx
index d5fa35b574..eab667977a 100644
--- a/frontend/src/core/codemirror/react-dom/createPanel.tsx
+++ b/frontend/src/core/codemirror/react-dom/createPanel.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { store } from "@/core/state/jotai";
+
import type { EditorView, Panel } from "@codemirror/view";
import { Provider } from "jotai";
-import { type Root, createRoot } from "react-dom/client";
+import { createRoot, type Root } from "react-dom/client";
+import { store } from "@/core/state/jotai";
/**
* Bridge between Codemirror panels and React
diff --git a/frontend/src/core/codemirror/readonly/extension.test.ts b/frontend/src/core/codemirror/readonly/extension.test.ts
index 3eb9154bba..56308b4a5d 100644
--- a/frontend/src/core/codemirror/readonly/extension.test.ts
+++ b/frontend/src/core/codemirror/readonly/extension.test.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { EditorView } from "@codemirror/view";
+
import { EditorState } from "@codemirror/state";
-import { dynamicReadonly, isEditorReadonly } from "./extension";
-import { connectionAtom } from "../../network/connection";
+import { EditorView } from "@codemirror/view";
import { createStore } from "jotai";
+import { describe, expect, it } from "vitest";
import { WebSocketState } from "@/core/websocket/types";
+import { connectionAtom } from "../../network/connection";
+import { dynamicReadonly, isEditorReadonly } from "./extension";
function makeStoreWithConnection(
state: WebSocketState.CONNECTING | WebSocketState.OPEN,
diff --git a/frontend/src/core/codemirror/readonly/extension.ts b/frontend/src/core/codemirror/readonly/extension.ts
index abc28869a8..e003b3de68 100644
--- a/frontend/src/core/codemirror/readonly/extension.ts
+++ b/frontend/src/core/codemirror/readonly/extension.ts
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Compartment, EditorState, StateEffect } from "@codemirror/state";
import { ViewPlugin } from "@codemirror/view";
-import { WebSocketState } from "../../websocket/types";
-import { connectionAtom } from "../../network/connection";
import type { createStore } from "jotai";
import {
isAppConnected,
isAppConnecting,
} from "@/core/websocket/connection-utils";
+import { connectionAtom } from "../../network/connection";
+import { WebSocketState } from "../../websocket/types";
/**
* State effect for updating readonly status based on connection
diff --git a/frontend/src/core/codemirror/rtc/extension.ts b/frontend/src/core/codemirror/rtc/extension.ts
index a02b4f21b6..3e3cb9c982 100644
--- a/frontend/src/core/codemirror/rtc/extension.ts
+++ b/frontend/src/core/codemirror/rtc/extension.ts
@@ -1,43 +1,45 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Awareness, LoroDoc, LoroMap, LoroText } from "loro-crdt";
-import type { CellId } from "@/core/cells/ids";
-import { isWasm } from "@/core/wasm/utils";
import type { Extension } from "@codemirror/state";
+import { EditorView, ViewPlugin } from "@codemirror/view";
+import { atom } from "jotai";
+import { isEqual } from "lodash-es";
+import { Awareness, LoroDoc, LoroMap, LoroText } from "loro-crdt";
import ReconnectingWebSocket from "partysocket/ws";
+import type { CellId } from "@/core/cells/ids";
import { getSessionId } from "@/core/kernel/session";
+import { getInitialAppMode } from "@/core/mode";
+import { waitForConnectionOpen } from "@/core/network/connection";
+import { isRtcEnabled, usernameAtom } from "@/core/rtc/state";
+import { getRuntimeManager } from "@/core/runtime/config";
+import { store } from "@/core/state/jotai";
+import { isWasm } from "@/core/wasm/utils";
+import { invariant } from "@/utils/invariant";
+import { Logger } from "@/utils/Logger";
import { once } from "@/utils/once";
-import { loroSyncAnnotation, loroSyncPlugin } from "./loro/sync";
-import { EditorView, ViewPlugin } from "@codemirror/view";
import {
getInitialLanguageAdapter,
languageAdapterState,
setLanguageAdapter,
switchLanguage,
} from "../language/extension";
-import type { LanguageAdapterType } from "../language/types";
-import { atom } from "jotai";
-import { waitForConnectionOpen } from "@/core/network/connection";
-import { store } from "@/core/state/jotai";
-import { Logger } from "@/utils/Logger";
-import { loroCursorTheme, RemoteAwarenessPlugin } from "./loro/awareness";
-import type { AwarenessState, ScopeId, Uid } from "./loro/awareness";
-import { AwarenessPlugin } from "./loro/awareness";
-import { createSelectionLayer } from "./loro/awareness";
-import { createCursorLayer } from "./loro/awareness";
-import { remoteAwarenessStateField } from "./loro/awareness";
-import type { UserState } from "./loro/awareness";
-import { isRtcEnabled, usernameAtom } from "@/core/rtc/state";
-import { getColor } from "./loro/colors";
import {
languageMetadataField,
setLanguageMetadata,
updateLanguageMetadata,
} from "../language/metadata";
-import { invariant } from "@/utils/invariant";
-import { isEqual } from "lodash-es";
-import { getInitialAppMode } from "@/core/mode";
-import { getRuntimeManager } from "@/core/runtime/config";
+import type { LanguageAdapterType } from "../language/types";
+import type { AwarenessState, ScopeId, Uid, UserState } from "./loro/awareness";
+import {
+ AwarenessPlugin,
+ createCursorLayer,
+ createSelectionLayer,
+ loroCursorTheme,
+ RemoteAwarenessPlugin,
+ remoteAwarenessStateField,
+} from "./loro/awareness";
+import { getColor } from "./loro/colors";
+import { loroSyncAnnotation, loroSyncPlugin } from "./loro/sync";
const logger = Logger.get("rtc");
const awarenessLogger = logger.get("awareness").disabled();
diff --git a/frontend/src/core/codemirror/rtc/loro/awareness.ts b/frontend/src/core/codemirror/rtc/loro/awareness.ts
index 49b1d43784..669cbf5fb9 100644
--- a/frontend/src/core/codemirror/rtc/loro/awareness.ts
+++ b/frontend/src/core/codemirror/rtc/loro/awareness.ts
@@ -1,13 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
import {
+ Annotation,
+ EditorSelection,
+ type Extension,
+ type SelectionRange,
+ StateEffect,
+ StateField,
+} from "@codemirror/state";
+import {
+ Direction,
EditorView,
- type PluginValue,
- type ViewUpdate,
- layer,
type LayerMarker,
+ layer,
+ type PluginValue,
type Rect,
- Direction,
RectangleMarker,
+ type ViewUpdate,
} from "@codemirror/view";
import {
type Awareness,
@@ -18,14 +27,6 @@ import {
type PeerID,
type Subscription,
} from "loro-crdt";
-import {
- Annotation,
- EditorSelection,
- type Extension,
- type SelectionRange,
- StateEffect,
- StateField,
-} from "@codemirror/state";
import type { TypedString } from "@/utils/typed";
export type ScopeId = TypedString<"loro:scope">;
@@ -478,7 +479,7 @@ const getCursorState = (
if (!anchorCursor) {
throw new Error("cursor head not found");
}
- let headCursor = undefined;
+ let headCursor: Uint8Array | undefined;
if (head !== undefined) {
headCursor = getTextFromDoc(doc).getCursor(head)?.encode();
}
diff --git a/frontend/src/core/codemirror/rtc/loro/sync.ts b/frontend/src/core/codemirror/rtc/loro/sync.ts
index b49d95b898..43f8258fa7 100644
--- a/frontend/src/core/codemirror/rtc/loro/sync.ts
+++ b/frontend/src/core/codemirror/rtc/loro/sync.ts
@@ -6,9 +6,9 @@
// - filter diffs by path
import type { Extension } from "@codemirror/state";
-import { ViewPlugin } from "@codemirror/view";
import { Annotation, type ChangeSpec } from "@codemirror/state";
import type { EditorView, PluginValue, ViewUpdate } from "@codemirror/view";
+import { ViewPlugin } from "@codemirror/view";
import type {
LoroDoc,
LoroEventBatch,
diff --git a/frontend/src/core/codemirror/theme/__tests__/light.test.ts b/frontend/src/core/codemirror/theme/__tests__/light.test.ts
index 9620f191eb..eb25de009f 100644
--- a/frontend/src/core/codemirror/theme/__tests__/light.test.ts
+++ b/frontend/src/core/codemirror/theme/__tests__/light.test.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { tags as t, type Tag } from "@lezer/highlight";
+
+import { type Tag, tags as t } from "@lezer/highlight";
+import { describe, expect, it } from "vitest";
import { lightTheme } from "../light";
// Helper function to get theme configuration from the source
diff --git a/frontend/src/core/codemirror/theme/dark.ts b/frontend/src/core/codemirror/theme/dark.ts
index 6991dd6a65..3a8fdce6c8 100644
--- a/frontend/src/core/codemirror/theme/dark.ts
+++ b/frontend/src/core/codemirror/theme/dark.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { createTheme } from "thememirror";
+
import { tags as t } from "@lezer/highlight";
+import { createTheme } from "thememirror";
export const darkTheme = createTheme({
variant: "dark",
diff --git a/frontend/src/core/codemirror/theme/light.ts b/frontend/src/core/codemirror/theme/light.ts
index fc4e559290..740d8b881d 100644
--- a/frontend/src/core/codemirror/theme/light.ts
+++ b/frontend/src/core/codemirror/theme/light.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { createTheme } from "thememirror";
+
import { tags as t } from "@lezer/highlight";
+import { createTheme } from "thememirror";
export const lightTheme = createTheme({
variant: "light",
diff --git a/frontend/src/core/config/__tests__/config-schema.test.ts b/frontend/src/core/config/__tests__/config-schema.test.ts
index 8e5e6f8fd9..0356811d90 100644
--- a/frontend/src/core/config/__tests__/config-schema.test.ts
+++ b/frontend/src/core/config/__tests__/config-schema.test.ts
@@ -1,14 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, test } from "vitest";
+
import { createStore } from "jotai";
+import { expect, test } from "vitest";
+import {
+ configOverridesAtom,
+ resolvedMarimoConfigAtom,
+ userConfigAtom,
+} from "../config";
import {
AppConfigSchema,
type UserConfig,
UserConfigSchema,
} from "../config-schema";
-import { resolvedMarimoConfigAtom } from "../config";
-import { userConfigAtom } from "../config";
-import { configOverridesAtom } from "../config";
test("default AppConfig", () => {
const defaultConfig = AppConfigSchema.parse({});
diff --git a/frontend/src/core/config/config-schema.ts b/frontend/src/core/config/config-schema.ts
index d05ff34b81..70b568e09a 100644
--- a/frontend/src/core/config/config-schema.ts
+++ b/frontend/src/core/config/config-schema.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
+import { invariant } from "@/utils/invariant";
import { Logger } from "@/utils/Logger";
import type { MarimoConfig } from "../network/types";
-import { invariant } from "@/utils/invariant";
// This has to be defined in the same file as the zod schema to satisfy zod
export const PackageManagerNames = [
diff --git a/frontend/src/core/config/config.ts b/frontend/src/core/config/config.ts
index fbe32fa1af..525b7ff594 100644
--- a/frontend/src/core/config/config.ts
+++ b/frontend/src/core/config/config.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom, useAtom, useAtomValue, useSetAtom } from "jotai";
+import { merge } from "lodash-es";
+import { OverridingHotkeyProvider } from "../hotkeys/hotkeys";
+import { store } from "../state/jotai";
import {
type AppConfig,
- type UserConfig,
parseAppConfig,
parseUserConfig,
+ type UserConfig,
} from "./config-schema";
-import { store } from "../state/jotai";
-import { OverridingHotkeyProvider } from "../hotkeys/hotkeys";
-import { merge } from "lodash-es";
/**
* Atom for storing the user config.
diff --git a/frontend/src/core/config/feature-flag.tsx b/frontend/src/core/config/feature-flag.tsx
index f34067d64d..3db7e1dec1 100644
--- a/frontend/src/core/config/feature-flag.tsx
+++ b/frontend/src/core/config/feature-flag.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { repl } from "@/utils/repl";
import type { UserConfig } from "vite";
+import { repl } from "@/utils/repl";
import { saveUserConfig } from "../network/requests";
import { getResolvedMarimoConfig } from "./config";
diff --git a/frontend/src/core/config/if-capability.tsx b/frontend/src/core/config/if-capability.tsx
index 1a95e19de4..6896efeed8 100644
--- a/frontend/src/core/config/if-capability.tsx
+++ b/frontend/src/core/config/if-capability.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
import React from "react";
import type { Capabilities } from "../kernel/messages";
-import { useAtomValue } from "jotai";
import { capabilitiesAtom } from "./capabilities";
interface Props {
diff --git a/frontend/src/core/datasets/__tests__/all-tables.test.ts b/frontend/src/core/datasets/__tests__/all-tables.test.ts
index 28afbffc41..82b02c336d 100644
--- a/frontend/src/core/datasets/__tests__/all-tables.test.ts
+++ b/frontend/src/core/datasets/__tests__/all-tables.test.ts
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { beforeEach, describe, expect, it, vi } from "vitest";
-import { datasetsAtom } from "../state";
+import { store } from "@/core/state/jotai";
import {
allTablesAtom,
- dataSourceConnectionsAtom,
DUCKDB_ENGINE,
+ dataSourceConnectionsAtom,
} from "../data-source-connections";
-import { store } from "@/core/state/jotai";
+import { datasetsAtom } from "../state";
import type { DatasetsState } from "../types";
describe("allTablesAtom", () => {
diff --git a/frontend/src/core/datasets/__tests__/data-source.test.ts b/frontend/src/core/datasets/__tests__/data-source.test.ts
index a4e84215a5..69534adbd0 100644
--- a/frontend/src/core/datasets/__tests__/data-source.test.ts
+++ b/frontend/src/core/datasets/__tests__/data-source.test.ts
@@ -1,5 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, it, describe, beforeEach } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
+import type { DataTable } from "@/core/kernel/messages";
+import type { VariableName } from "@/core/variables/types";
import {
type ConnectionName,
type DataSourceConnection,
@@ -8,8 +10,6 @@ import {
INTERNAL_SQL_ENGINES,
type SQLTableContext,
} from "../data-source-connections";
-import type { VariableName } from "@/core/variables/types";
-import type { DataTable } from "@/core/kernel/messages";
const { reducer, initialState } = exportedForTesting;
diff --git a/frontend/src/core/datasets/data-source-connections.ts b/frontend/src/core/datasets/data-source-connections.ts
index 2b0a032218..df08d5a347 100644
--- a/frontend/src/core/datasets/data-source-connections.ts
+++ b/frontend/src/core/datasets/data-source-connections.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { atom } from "jotai";
+import { isSchemaless } from "@/components/datasources/utils";
import { createReducerAndAtoms } from "@/utils/createReducer";
+import { Logger } from "@/utils/Logger";
+import type { TypedString } from "@/utils/typed";
import type {
DataSourceConnection as DataSourceConnectionType,
DataTable,
} from "../kernel/messages";
-import type { TypedString } from "@/utils/typed";
-import type { VariableName } from "../variables/types";
-import { atom } from "jotai";
import { store } from "../state/jotai";
+import type { VariableName } from "../variables/types";
import { datasetTablesAtom } from "./state";
-import { Logger } from "@/utils/Logger";
-import { isSchemaless } from "@/components/datasources/utils";
export type ConnectionName = TypedString<"ConnectionName">;
diff --git a/frontend/src/core/datasets/request-registry.ts b/frontend/src/core/datasets/request-registry.ts
index b502d91201..e7507ffc44 100644
--- a/frontend/src/core/datasets/request-registry.ts
+++ b/frontend/src/core/datasets/request-registry.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { SQLTablePreview, SQLTableListPreview } from "../kernel/messages";
+import type { SQLTableListPreview, SQLTablePreview } from "../kernel/messages";
import { DeferredRequestRegistry } from "../network/DeferredRequestRegistry";
import { previewSQLTable, previewSQLTableList } from "../network/requests";
import type {
- PreviewSQLTableRequest,
PreviewSQLTableListRequest,
+ PreviewSQLTableRequest,
} from "../network/types";
// We make a request to the backend to preview the table, passing in Engine, DB, Schema, and Table
diff --git a/frontend/src/core/datasets/state.ts b/frontend/src/core/datasets/state.ts
index fab4627216..4cd1f7c1e7 100644
--- a/frontend/src/core/datasets/state.ts
+++ b/frontend/src/core/datasets/state.ts
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { createReducerAndAtoms } from "@/utils/createReducer";
-import type { DatasetsState } from "./types";
import { atom, useAtomValue } from "jotai";
-import type { VariableName } from "../variables/types";
+import { createReducerAndAtoms } from "@/utils/createReducer";
import type {
DataColumnPreview,
OperationMessageData,
} from "../kernel/messages";
import { previewDatasetColumn } from "../network/requests";
+import type { VariableName } from "../variables/types";
+import type { DatasetsState } from "./types";
function initialState(): DatasetsState {
return {
diff --git a/frontend/src/core/dom/__tests__/outline.test.ts b/frontend/src/core/dom/__tests__/outline.test.ts
index 2606c6182b..008303969d 100644
--- a/frontend/src/core/dom/__tests__/outline.test.ts
+++ b/frontend/src/core/dom/__tests__/outline.test.ts
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
+import type { Outline } from "@/core/cells/outline";
import {
canCollapseOutline,
findCollapseRange,
mergeOutlines,
parseOutline,
} from "../outline";
-import type { Outline } from "@/core/cells/outline";
describe("parseOutline", () => {
it("can parse html outline", () => {
diff --git a/frontend/src/core/dom/htmlUtils.ts b/frontend/src/core/dom/htmlUtils.ts
index b25f935a7e..43bc216fab 100644
--- a/frontend/src/core/dom/htmlUtils.ts
+++ b/frontend/src/core/dom/htmlUtils.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { assertExists } from "@/utils/assertExists";
-import type { UIElementRegistry } from "./uiregistry";
import { jsonParseWithSpecialChar } from "@/utils/json/json-parser";
import { Objects } from "@/utils/objects";
import { UIElementId } from "../cells/ids";
-import { isWasm } from "../wasm/utils";
import { PyodideRouter } from "../wasm/router";
+import { isWasm } from "../wasm/utils";
+import type { UIElementRegistry } from "./uiregistry";
/**
* Parse an attribute value as JSON.
diff --git a/frontend/src/core/dom/outline.ts b/frontend/src/core/dom/outline.ts
index 75b0776905..3bb12c6028 100644
--- a/frontend/src/core/dom/outline.ts
+++ b/frontend/src/core/dom/outline.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { invariant } from "@/utils/invariant";
import { Logger } from "@/utils/Logger";
-import type { OutputMessage } from "../kernel/messages";
import type { Outline, OutlineItem } from "../cells/outline";
-import { invariant } from "@/utils/invariant";
+import type { OutputMessage } from "../kernel/messages";
// Tags that we don't want to include in the outline
const excludedTags = ["marimo-carousel", "marimo-tabs", "marimo-accordion"];
diff --git a/frontend/src/core/dom/ui-element.ts b/frontend/src/core/dom/ui-element.ts
index 07b2200bd7..bb2b432ac6 100644
--- a/frontend/src/core/dom/ui-element.ts
+++ b/frontend/src/core/dom/ui-element.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { isCustomMarimoElement } from "@/plugins/core/registerReactComponent";
-import { Logger } from "../../utils/Logger";
import { Functions } from "../../utils/functions";
+import { Logger } from "../../utils/Logger";
import { UIElementId } from "../cells/ids";
import { defineCustomElement } from "./defineCustomElement";
import {
diff --git a/frontend/src/core/dom/uiregistry.ts b/frontend/src/core/dom/uiregistry.ts
index 6be8cd075e..32ce056c38 100644
--- a/frontend/src/core/dom/uiregistry.ts
+++ b/frontend/src/core/dom/uiregistry.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { byteStringToDataView } from "@/utils/data-views";
+import type { Base64String } from "@/utils/json/base64";
+import { typedAtob } from "@/utils/json/base64";
import { Logger } from "@/utils/Logger";
import type { CellId, UIElementId } from "../cells/ids";
import {
- type ValueType,
MarimoIncomingMessageEvent,
MarimoValueReadyEvent,
MarimoValueUpdateEvent,
+ type ValueType,
} from "./events";
import { parseInitialValue } from "./htmlUtils";
-import { byteStringToDataView } from "@/utils/data-views";
-import type { Base64String } from "@/utils/json/base64";
-import { typedAtob } from "@/utils/json/base64";
interface UIElementEntry {
objectId: string;
diff --git a/frontend/src/core/edit-app.tsx b/frontend/src/core/edit-app.tsx
index 8a278c9342..6aaca170d9 100644
--- a/frontend/src/core/edit-app.tsx
+++ b/frontend/src/core/edit-app.tsx
@@ -1,42 +1,41 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect } from "react";
-
-import { sendComponentValues, sendInterrupt } from "@/core/network/requests";
+import { usePrevious } from "@dnd-kit/utilities";
+import { TooltipProvider } from "@radix-ui/react-tooltip";
+import { useAtomValue, useSetAtom } from "jotai";
+import { useEffect } from "react";
import { Controls } from "@/components/editor/controls/Controls";
+import { AppHeader } from "@/components/editor/header/app-header";
import { FilenameForm } from "@/components/editor/header/filename-form";
-import { WebSocketState } from "./websocket/types";
-import { useMarimoWebSocket } from "./websocket/useMarimoWebSocket";
+import { sendComponentValues, sendInterrupt } from "@/core/network/requests";
+import { cn } from "@/utils/cn";
+import { Paths } from "@/utils/paths";
+import { AppContainer } from "../components/editor/app-container";
+import {
+ useRunAllCells,
+ useRunStaleCells,
+} from "../components/editor/cell/useRunCells";
+import { CellArray } from "../components/editor/renderers/CellArray";
+import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
+import { useHotkey } from "../hooks/useHotkey";
import {
- notebookIsRunningAtom,
- useCellActions,
cellIdsAtom,
- numColumnsAtom,
hasCellsAtom,
+ notebookIsRunningAtom,
+ numColumnsAtom,
+ useCellActions,
} from "./cells/cells";
import { CellEffects } from "./cells/effects";
import type { AppConfig, UserConfig } from "./config/config-schema";
-import { viewStateAtom } from "./mode";
-import { useHotkey } from "../hooks/useHotkey";
-import { CellArray } from "../components/editor/renderers/CellArray";
import { RuntimeState } from "./kernel/RuntimeState";
-import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
-import { useAtomValue, useSetAtom } from "jotai";
-import {
- useRunAllCells,
- useRunStaleCells,
-} from "../components/editor/cell/useRunCells";
-import { cn } from "@/utils/cn";
-import { useFilename } from "./saving/filename";
import { getSessionId } from "./kernel/session";
-import { AppHeader } from "@/components/editor/header/app-header";
-import { AppContainer } from "../components/editor/app-container";
-import { useJotaiEffect } from "./state/jotai";
-import { Paths } from "@/utils/paths";
import { useTogglePresenting } from "./layout/useTogglePresenting";
-import { usePrevious } from "@dnd-kit/utilities";
-import { TooltipProvider } from "@radix-ui/react-tooltip";
+import { viewStateAtom } from "./mode";
+import { useFilename } from "./saving/filename";
import { lastSavedNotebookAtom } from "./saving/state";
+import { useJotaiEffect } from "./state/jotai";
+import { WebSocketState } from "./websocket/types";
+import { useMarimoWebSocket } from "./websocket/useMarimoWebSocket";
interface AppProps {
/**
diff --git a/frontend/src/core/errors/__tests__/errors.test.ts b/frontend/src/core/errors/__tests__/errors.test.ts
index 8439c90c7e..6bd9351dc7 100644
--- a/frontend/src/core/errors/__tests__/errors.test.ts
+++ b/frontend/src/core/errors/__tests__/errors.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { getAutoFixes, getImportCode } from "../errors";
+import { describe, expect, it } from "vitest";
import type { MarimoError } from "@/core/kernel/messages";
+import { getAutoFixes, getImportCode } from "../errors";
describe("getImportCode", () => {
it("returns simple import for same name", () => {
diff --git a/frontend/src/core/errors/__tests__/utils.test.ts b/frontend/src/core/errors/__tests__/utils.test.ts
index 0dfc68db9f..5c7c6e5ba5 100644
--- a/frontend/src/core/errors/__tests__/utils.test.ts
+++ b/frontend/src/core/errors/__tests__/utils.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import { wrapInFunction } from "../utils";
describe("wrapInFunction", () => {
diff --git a/frontend/src/core/errors/errors.ts b/frontend/src/core/errors/errors.ts
index e06ef2413b..c66051ffe5 100644
--- a/frontend/src/core/errors/errors.ts
+++ b/frontend/src/core/errors/errors.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { EditorView } from "@codemirror/view";
+import { invariant } from "@/utils/invariant";
import type { CellId } from "../cells/ids";
import type { MarimoError } from "../kernel/messages";
import { wrapInFunction } from "./utils";
-import { invariant } from "@/utils/invariant";
export interface AutoFix {
title: string;
diff --git a/frontend/src/core/errors/state.ts b/frontend/src/core/errors/state.ts
index 95be08e096..51c250a543 100644
--- a/frontend/src/core/errors/state.ts
+++ b/frontend/src/core/errors/state.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { createReducerAndAtoms } from "@/utils/createReducer";
import { useAtomValue } from "jotai";
-import type { Banner } from "../kernel/messages";
-import { generateUUID } from "@/utils/uuid";
+import { createReducerAndAtoms } from "@/utils/createReducer";
import type { Identified } from "@/utils/typed";
+import { generateUUID } from "@/utils/uuid";
+import type { Banner } from "../kernel/messages";
interface BannerState {
banners: Array<Identified<Banner>>;
diff --git a/frontend/src/core/errors/utils.ts b/frontend/src/core/errors/utils.ts
index bfc3c2c666..9e68510563 100644
--- a/frontend/src/core/errors/utils.ts
+++ b/frontend/src/core/errors/utils.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { parser } from "@lezer/python";
import type { SyntaxNode, Tree } from "@lezer/common";
+import { parser } from "@lezer/python";
function getLastStatement(tree: Tree): SyntaxNode | null {
let lastStmt: SyntaxNode | null = null;
diff --git a/frontend/src/core/export/hooks.ts b/frontend/src/core/export/hooks.ts
index 037fe62e8c..c3855986f3 100644
--- a/frontend/src/core/export/hooks.ts
+++ b/frontend/src/core/export/hooks.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useAtomValue } from "jotai";
+import { appConfigAtom } from "@/core/config/config";
import { useInterval } from "@/hooks/useInterval";
+import { connectionAtom } from "../network/connection";
import {
autoExportAsHTML,
- autoExportAsMarkdown,
autoExportAsIPYNB,
+ autoExportAsMarkdown,
} from "../network/requests";
import { VirtualFileTracker } from "../static/virtual-file-tracker";
-import { connectionAtom } from "../network/connection";
import { WebSocketState } from "../websocket/types";
-import { appConfigAtom } from "@/core/config/config";
const DELAY = 5000; // 5 seconds;
diff --git a/frontend/src/core/hotkeys/__tests__/shortcuts.test.ts b/frontend/src/core/hotkeys/__tests__/shortcuts.test.ts
index 33740ec68a..980d0a82fe 100644
--- a/frontend/src/core/hotkeys/__tests__/shortcuts.test.ts
+++ b/frontend/src/core/hotkeys/__tests__/shortcuts.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
+import { describe, expect, it } from "vitest";
import { parseShortcut } from "../shortcuts";
describe("parseShortcut", () => {
diff --git a/frontend/src/core/hotkeys/actions.ts b/frontend/src/core/hotkeys/actions.ts
index 74eba291ec..ea83326b29 100644
--- a/frontend/src/core/hotkeys/actions.ts
+++ b/frontend/src/core/hotkeys/actions.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom, useAtomValue, useSetAtom } from "jotai";
-import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
import useEvent from "react-use-event-hook";
+import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
/**
* Map of registered keyboard shortcuts and their callbacks.
diff --git a/frontend/src/core/islands/bridge.ts b/frontend/src/core/islands/bridge.ts
index f0ac99b3ef..41d54c42e5 100644
--- a/frontend/src/core/islands/bridge.ts
+++ b/frontend/src/core/islands/bridge.ts
@@ -1,19 +1,20 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import type { EditRequests, RunRequests } from "../network/types";
-import { Deferred } from "@/utils/Deferred";
-import { getMarimoVersion } from "../meta/globals";
+
import { getWorkerRPC } from "@/core/wasm/rpc";
-import type { OperationMessage } from "../kernel/messages";
-import type { JsonString } from "@/utils/json/base64";
+import { Deferred } from "@/utils/Deferred";
import { throwNotImplemented } from "@/utils/functions";
-import type { WorkerSchema } from "./worker/worker";
-import workerUrl from "./worker/worker.tsx?worker&url";
-
-import { createMarimoFile, parseMarimoIslandApps } from "./parse";
+import type { JsonString } from "@/utils/json/base64";
import { Logger } from "@/utils/Logger";
+import type { OperationMessage } from "../kernel/messages";
+import { getMarimoVersion } from "../meta/globals";
+import type { EditRequests, RunRequests } from "../network/types";
import { store } from "../state/jotai";
+
+import { createMarimoFile, parseMarimoIslandApps } from "./parse";
import { islandsInitializedAtom } from "./state";
+import type { WorkerSchema } from "./worker/worker";
+import workerUrl from "./worker/worker.tsx?worker&url";
export class IslandsPyodideBridge implements RunRequests, EditRequests {
/**
diff --git a/frontend/src/core/islands/components/output-wrapper.tsx b/frontend/src/core/islands/components/output-wrapper.tsx
index be8505aa03..5e54be94bb 100644
--- a/frontend/src/core/islands/components/output-wrapper.tsx
+++ b/frontend/src/core/islands/components/output-wrapper.tsx
@@ -1,4 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
+import { selectAtom } from "jotai/utils";
+import { CopyIcon, Loader2Icon, PlayIcon } from "lucide-react";
+import React, {
+ type JSX,
+ type PropsWithChildren,
+ useCallback,
+ useState,
+} from "react";
import { OutputRenderer } from "@/components/editor/Output";
import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
@@ -10,15 +20,6 @@ import { sendRun } from "@/core/network/requests";
import { useEventListener } from "@/hooks/useEventListener";
import { copyToClipboard } from "@/utils/copy";
import { Logger } from "@/utils/Logger";
-import { useAtomValue } from "jotai";
-import { selectAtom } from "jotai/utils";
-import { CopyIcon, Loader2Icon, PlayIcon } from "lucide-react";
-import React, {
- type PropsWithChildren,
- useCallback,
- useState,
- type JSX,
-} 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 ab93e1d659..ef0ae98e92 100644
--- a/frontend/src/core/islands/components/web-components.tsx
+++ b/frontend/src/core/islands/components/web-components.tsx
@@ -1,17 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Provider } from "jotai";
+import { isValidElement, type JSX } from "react";
+import ReactDOM, { type Root } from "react-dom/client";
+import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import { notebookAtom } from "@/core/cells/cells";
+import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
+import { renderHTML } from "@/plugins/core/RenderHTML";
import { invariant } from "@/utils/invariant";
import type { CellId } from "../../cells/ids";
import { store } from "../../state/jotai";
-import ReactDOM, { type Root } from "react-dom/client";
-import { isValidElement, type JSX } from "react";
import { extractIslandCodeFromEmbed } from "../parse";
import { MarimoOutputWrapper } from "./output-wrapper";
-import { Provider } from "jotai";
-import { renderHTML } from "@/plugins/core/RenderHTML";
-import { TooltipProvider } from "@/components/ui/tooltip";
-import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
-import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
-import { notebookAtom } from "@/core/cells/cells";
/**
* A custom element that renders the output of a marimo cell
diff --git a/frontend/src/core/islands/main.ts b/frontend/src/core/islands/main.ts
index b82ca03f3b..2942d15de0 100644
--- a/frontend/src/core/islands/main.ts
+++ b/frontend/src/core/islands/main.ts
@@ -2,41 +2,41 @@
import "./islands.css";
import "iconify-icon";
+import { toast } from "@/components/ui/use-toast";
+import { renderHTML } from "@/plugins/core/RenderHTML";
import { initializePlugins } from "@/plugins/plugins";
-import { IslandsPyodideBridge } from "./bridge";
-import { store } from "../state/jotai";
+import { logNever } from "@/utils/assertNever";
+import { Functions } from "@/utils/functions";
+import type { Base64String } from "@/utils/json/base64";
+import { jsonParseWithSpecialChar } from "@/utils/json/json-parser";
+import { Logger } from "@/utils/Logger";
import {
createNotebookActions,
notebookAtom,
notebookReducer,
} from "../cells/cells";
-import { toast } from "@/components/ui/use-toast";
-import { renderHTML } from "@/plugins/core/RenderHTML";
-import { logNever } from "@/utils/assertNever";
-import { jsonParseWithSpecialChar } from "@/utils/json/json-parser";
+import type { UIElementId } from "../cells/ids";
+import { defineCustomElement } from "../dom/defineCustomElement";
+import { MarimoValueInputEvent } from "../dom/events";
+import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
import { FUNCTIONS_REGISTRY } from "../functions/FunctionRegistry";
import {
+ handleCellOperation,
handleKernelReady,
handleRemoveUIElements,
- handleCellOperation,
} from "../kernel/handlers";
import { queryParamHandlers } from "../kernel/queryParamHandlers";
-import { Logger } from "@/utils/Logger";
-import { Functions } from "@/utils/functions";
-import { defineCustomElement } from "../dom/defineCustomElement";
-import { MarimoIslandElement } from "./components/web-components";
import { RuntimeState } from "../kernel/RuntimeState";
-import { sendComponentValues } from "../network/requests";
import type { RequestId } from "../network/DeferredRequestRegistry";
-import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
-import type { UIElementId } from "../cells/ids";
-import { MarimoValueInputEvent } from "../dom/events";
+import { sendComponentValues } from "../network/requests";
+import { store } from "../state/jotai";
+import { IslandsPyodideBridge } from "./bridge";
+import { MarimoIslandElement } from "./components/web-components";
import {
shouldShowIslandsWarningIndicatorAtom,
userTriedToInteractWithIslandsAtom,
} from "./state";
import { dismissIslandsLoadingToast, toastIslandsLoading } from "./toast";
-import type { Base64String } from "@/utils/json/base64";
/**
* Main entry point for the js bundle for embedded marimo apps.
diff --git a/frontend/src/core/islands/worker/controller.ts b/frontend/src/core/islands/worker/controller.ts
index 6fc2858ebe..3463a57fcc 100644
--- a/frontend/src/core/islands/worker/controller.ts
+++ b/frontend/src/core/islands/worker/controller.ts
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
-import { Logger } from "../../../utils/Logger";
import { defaultUserConfig } from "@/core/config/config-schema";
-import type { SerializedBridge } from "@/core/wasm/worker/types";
import type { OperationMessage } from "@/core/kernel/messages";
-import type { JsonString } from "@/utils/json/base64";
import { DefaultWasmController } from "@/core/wasm/worker/bootstrap";
import { WasmFileSystem } from "@/core/wasm/worker/fs";
+import type { SerializedBridge } from "@/core/wasm/worker/types";
+import type { JsonString } from "@/utils/json/base64";
+import { Logger } from "../../../utils/Logger";
export class ReadonlyWasmController extends DefaultWasmController {
override async bootstrap(opts: {
diff --git a/frontend/src/core/islands/worker/worker.tsx b/frontend/src/core/islands/worker/worker.tsx
index 6a092687a7..3501131921 100644
--- a/frontend/src/core/islands/worker/worker.tsx
+++ b/frontend/src/core/islands/worker/worker.tsx
@@ -1,24 +1,24 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
-import { Deferred } from "../../../utils/Deferred";
-import { prettyError } from "../../../utils/errors";
import {
- createWorkerParentTransport,
createRPC,
createRPCRequestHandler,
+ createWorkerParentTransport,
type RPCSchema,
} from "rpc-anywhere";
-import { invariant } from "../../../utils/invariant";
+import type { OperationMessage } from "@/core/kernel/messages";
import type { ParentSchema } from "@/core/wasm/rpc";
import { TRANSPORT_ID } from "@/core/wasm/worker/constants";
+import { getPyodideVersion } from "@/core/wasm/worker/getPyodideVersion";
import { MessageBuffer } from "@/core/wasm/worker/message-buffer";
-import type { SerializedBridge, RawBridge } from "@/core/wasm/worker/types";
-import { ReadonlyWasmController } from "./controller";
-import type { OperationMessage } from "@/core/kernel/messages";
+import type { RawBridge, SerializedBridge } from "@/core/wasm/worker/types";
import type { JsonString } from "@/utils/json/base64";
import { Logger } from "@/utils/Logger";
-import { getPyodideVersion } from "@/core/wasm/worker/getPyodideVersion";
+import { Deferred } from "../../../utils/Deferred";
+import { prettyError } from "../../../utils/errors";
+import { invariant } from "../../../utils/invariant";
+import { ReadonlyWasmController } from "./controller";
declare const self: Window & {
pyodide: PyodideInterface;
diff --git a/frontend/src/core/kernel/RuntimeState.ts b/frontend/src/core/kernel/RuntimeState.ts
index 2533631bc8..18cc2a0168 100644
--- a/frontend/src/core/kernel/RuntimeState.ts
+++ b/frontend/src/core/kernel/RuntimeState.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Logger } from "@/utils/Logger";
import {
MarimoValueReadyEvent,
type MarimoValueReadyEventType,
} from "../dom/events";
import { UI_ELEMENT_REGISTRY, type UIElementRegistry } from "../dom/uiregistry";
import type { RunRequests } from "../network/types";
-import { Logger } from "@/utils/Logger";
/**
* Manager to track running cells.
diff --git a/frontend/src/core/kernel/__tests__/RuntimeState.test.ts b/frontend/src/core/kernel/__tests__/RuntimeState.test.ts
index ba00e13b45..8d83c58a5a 100644
--- a/frontend/src/core/kernel/__tests__/RuntimeState.test.ts
+++ b/frontend/src/core/kernel/__tests__/RuntimeState.test.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { UIElementRegistry } from "@/core/dom/uiregistry";
+
import {
- describe,
beforeEach,
+ describe,
expect,
- vi,
- test,
type MockedFunction,
+ test,
+ vi,
} from "vitest";
-import { RuntimeState } from "../RuntimeState";
-import type { RunRequests } from "@/core/network/types";
import { MarimoValueReadyEvent } from "@/core/dom/events";
+import { UIElementRegistry } from "@/core/dom/uiregistry";
+import type { RunRequests } from "@/core/network/types";
+import { RuntimeState } from "../RuntimeState";
const addEventListenerSpy = vi.spyOn(document, "addEventListener");
const removeEventListenerSpy = vi.spyOn(document, "removeEventListener");
diff --git a/frontend/src/core/kernel/__tests__/handlers.test.ts b/frontend/src/core/kernel/__tests__/handlers.test.ts
index 9abd9e9495..42343d20d6 100644
--- a/frontend/src/core/kernel/__tests__/handlers.test.ts
+++ b/frontend/src/core/kernel/__tests__/handlers.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/unbound-method */
-import { describe, it, expect, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import { queryParamHandlers } from "../queryParamHandlers";
// Helper to set up URL and searchParams
diff --git a/frontend/src/core/kernel/handlers.ts b/frontend/src/core/kernel/handlers.ts
index 57fda1ebac..8059a91dc8 100644
--- a/frontend/src/core/kernel/handlers.ts
+++ b/frontend/src/core/kernel/handlers.ts
@@ -1,23 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { deserializeLayout } from "@/components/editor/renderers/plugins";
+import type { LayoutType } from "@/components/editor/renderers/types";
import { Objects } from "@/utils/objects";
+import type { CellId, UIElementId } from "../cells/ids";
+import { type CellData, createCell } from "../cells/types";
+import { type AppConfig, AppConfigSchema } from "../config/config-schema";
import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
import {
+ initialLayoutState,
type LayoutData,
type LayoutState,
- initialLayoutState,
} from "../layout/layout";
import { sendInstantiate } from "../network/requests";
+import { VirtualFileTracker } from "../static/virtual-file-tracker";
import type {
Capabilities,
CellMessage,
OperationMessageData,
} from "./messages";
-import type { LayoutType } from "@/components/editor/renderers/types";
-import { AppConfigSchema, type AppConfig } from "../config/config-schema";
-import { type CellData, createCell } from "../cells/types";
-import { VirtualFileTracker } from "../static/virtual-file-tracker";
-import type { CellId, UIElementId } from "../cells/ids";
export function handleKernelReady(
data: OperationMessageData<"kernel-ready">,
diff --git a/frontend/src/core/kernel/session.ts b/frontend/src/core/kernel/session.ts
index 3807401340..685c864205 100644
--- a/frontend/src/core/kernel/session.ts
+++ b/frontend/src/core/kernel/session.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { init } from "@paralleldrive/cuid2";
+import { Logger } from "@/utils/Logger";
import type { TypedString } from "@/utils/typed";
import { updateQueryParams } from "@/utils/urls";
-import { Logger } from "@/utils/Logger";
import { KnownQueryParams } from "../constants";
export type SessionId = TypedString<"SessionId">;
diff --git a/frontend/src/core/layout/layout.ts b/frontend/src/core/layout/layout.ts
index 3d558e9a60..d05f9615b5 100644
--- a/frontend/src/core/layout/layout.ts
+++ b/frontend/src/core/layout/layout.ts
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
import type { GridLayout } from "@/components/editor/renderers/grid-layout/types";
+import { cellRendererPlugins } from "@/components/editor/renderers/plugins";
import type { LayoutType } from "@/components/editor/renderers/types";
-import { useAtomValue } from "jotai";
import { createReducerAndAtoms } from "@/utils/createReducer";
-import { cellRendererPlugins } from "@/components/editor/renderers/plugins";
+import { Logger } from "@/utils/Logger";
import { getNotebook } from "../cells/cells";
import { notebookCells } from "../cells/utils";
import { store } from "../state/jotai";
-import { Logger } from "@/utils/Logger";
export type LayoutData = GridLayout | undefined;
diff --git a/frontend/src/core/layout/useTogglePresenting.ts b/frontend/src/core/layout/useTogglePresenting.ts
index bcc4f452b0..cfc5ed2546 100644
--- a/frontend/src/core/layout/useTogglePresenting.ts
+++ b/frontend/src/core/layout/useTogglePresenting.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useSetAtom } from "jotai";
import { useCallback } from "react";
import { type CellId, HTMLCellId } from "../cells/ids";
import { toggleAppMode, viewStateAtom } from "../mode";
-import { useSetAtom } from "jotai";
/**
* Toggle the notebook's presentation state and scroll to current visible cell
diff --git a/frontend/src/core/mode.ts b/frontend/src/core/mode.ts
index 9131be1dd6..3cb4700cfc 100644
--- a/frontend/src/core/mode.ts
+++ b/frontend/src/core/mode.ts
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import type { CellId } from "./cells/ids";
-import { store } from "./state/jotai";
-import { assertExists } from "@/utils/assertExists";
import { isIslands } from "@/core/islands/utils";
+import { assertExists } from "@/utils/assertExists";
import { invariant } from "@/utils/invariant";
+import type { CellId } from "./cells/ids";
+import { store } from "./state/jotai";
/**
* This is the internal mode.
diff --git a/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts b/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
index 514a6e4809..da50d67a15 100644
--- a/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
+++ b/frontend/src/core/network/__tests__/DeferredRequestRegistry.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeEach, expect, vi, describe, it } from "vitest";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import {
DeferredRequestRegistry,
type RequestId,
diff --git a/frontend/src/core/network/api.ts b/frontend/src/core/network/api.ts
index cb8ee2e2e5..de1e0bfea7 100644
--- a/frontend/src/core/network/api.ts
+++ b/frontend/src/core/network/api.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Logger } from "../../utils/Logger";
+
import { createMarimoClient } from "@marimo-team/marimo-api";
+import { Logger } from "../../utils/Logger";
import { getRuntimeManager } from "../runtime/config";
import type { RuntimeManager } from "../runtime/runtime";
diff --git a/frontend/src/core/network/connection.ts b/frontend/src/core/network/connection.ts
index dff8073a89..283fdd8be0 100644
--- a/frontend/src/core/network/connection.ts
+++ b/frontend/src/core/network/connection.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
-import { type ConnectionStatus, WebSocketState } from "../websocket/types";
import { waitFor } from "../state/jotai";
+import { type ConnectionStatus, WebSocketState } from "../websocket/types";
/**
* Atom for storing the connection status.
diff --git a/frontend/src/core/network/requests-network.ts b/frontend/src/core/network/requests-network.ts
index a0c3d32ff3..48dcaa7378 100644
--- a/frontend/src/core/network/requests-network.ts
+++ b/frontend/src/core/network/requests-network.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { once } from "lodash-es";
import { getRuntimeManager } from "../runtime/config";
import { API, createClientWithRuntimeManager } from "./api";
import { waitForConnectionOpen } from "./connection";
-import type { RunRequests, EditRequests } from "./types";
-import { once } from "lodash-es";
+import type { EditRequests, RunRequests } from "./types";
const { handleResponse, handleResponseReturnNull } = API;
diff --git a/frontend/src/core/network/requests-static.ts b/frontend/src/core/network/requests-static.ts
index 5819e649b3..33386abeab 100644
--- a/frontend/src/core/network/requests-static.ts
+++ b/frontend/src/core/network/requests-static.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { toast } from "@/components/ui/use-toast";
-import type { EditRequests, RunRequests } from "./types";
import { Logger } from "@/utils/Logger";
+import type { EditRequests, RunRequests } from "./types";
export function createStaticRequests(): EditRequests & RunRequests {
const throwNotInEditMode = () => {
diff --git a/frontend/src/core/network/requests-toasting.ts b/frontend/src/core/network/requests-toasting.ts
index 50b4b106ae..12512ee476 100644
--- a/frontend/src/core/network/requests-toasting.ts
+++ b/frontend/src/core/network/requests-toasting.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { toast } from "@/components/ui/use-toast";
-import type { EditRequests, RequestKey, RunRequests } from "./types";
-import { Logger } from "@/utils/Logger";
import { prettyError } from "@/utils/errors";
+import { Logger } from "@/utils/Logger";
+import type { EditRequests, RequestKey, RunRequests } from "./types";
export function createErrorToastingRequests(
delegate: EditRequests & RunRequests,
diff --git a/frontend/src/core/network/requests.ts b/frontend/src/core/network/requests.ts
index d5bc1b58c3..da8e6810f7 100644
--- a/frontend/src/core/network/requests.ts
+++ b/frontend/src/core/network/requests.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { IslandsPyodideBridge } from "../islands/bridge";
import { isIslands } from "../islands/utils";
+import { isStaticNotebook } from "../static/static-state";
import { PyodideBridge } from "../wasm/bridge";
import { isWasm } from "../wasm/utils";
-import { isStaticNotebook } from "../static/static-state";
import { createNetworkRequests } from "./requests-network";
import { createStaticRequests } from "./requests-static";
import { createErrorToastingRequests } from "./requests-toasting";
diff --git a/frontend/src/core/network/types.ts b/frontend/src/core/network/types.ts
index f8ec5ecba0..ab07739095 100644
--- a/frontend/src/core/network/types.ts
+++ b/frontend/src/core/network/types.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { paths, components } from "@marimo-team/marimo-api";
+import type { components, paths } from "@marimo-team/marimo-api";
import type { CellId } from "../cells/ids";
export type schemas = components["schemas"];
diff --git a/frontend/src/core/rtc/state.ts b/frontend/src/core/rtc/state.ts
index 1e2c1078f4..d0c35d83f7 100644
--- a/frontend/src/core/rtc/state.ts
+++ b/frontend/src/core/rtc/state.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atomWithStorage } from "jotai/utils";
-import { getFeatureFlag } from "../config/feature-flag";
import { once } from "lodash-es";
+import { getFeatureFlag } from "../config/feature-flag";
/**
* The username for the current user when using real-time collaboration.
diff --git a/frontend/src/core/run-app.tsx b/frontend/src/core/run-app.tsx
index baa051a066..d1ba370eaa 100644
--- a/frontend/src/core/run-app.tsx
+++ b/frontend/src/core/run-app.tsx
@@ -1,17 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { useAtomValue } from "jotai";
import { useEffect } from "react";
-
+import { AppContainer } from "@/components/editor/app-container";
+import { AppHeader } from "@/components/editor/header/app-header";
+import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
import { notebookIsRunningAtom, useCellActions } from "./cells/cells";
import type { AppConfig } from "./config/config-schema";
import { RuntimeState } from "./kernel/RuntimeState";
-import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
-import { useAtomValue } from "jotai";
-import { AppContainer } from "@/components/editor/app-container";
-import { AppHeader } from "@/components/editor/header/app-header";
import { getSessionId } from "./kernel/session";
-import { useMarimoWebSocket } from "./websocket/useMarimoWebSocket";
import { sendComponentValues } from "./network/requests";
+import { useMarimoWebSocket } from "./websocket/useMarimoWebSocket";
interface AppProps {
appConfig: AppConfig;
diff --git a/frontend/src/core/runtime/__tests__/config.test.ts b/frontend/src/core/runtime/__tests__/config.test.ts
index 5ee2204400..f6181361d7 100644
--- a/frontend/src/core/runtime/__tests__/config.test.ts
+++ b/frontend/src/core/runtime/__tests__/config.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { beforeEach, describe, expect, it, type Mocked, vi } from "vitest";
-import { asRemoteURL, getRuntimeManager } from "../config";
import { store } from "@/core/state/jotai";
+import { asRemoteURL, getRuntimeManager } from "../config";
import type { RuntimeManager } from "../runtime";
// Mock the store
diff --git a/frontend/src/core/runtime/__tests__/createWsUrl.test.ts b/frontend/src/core/runtime/__tests__/createWsUrl.test.ts
index fc5f3728b7..d14d0de4c9 100644
--- a/frontend/src/core/runtime/__tests__/createWsUrl.test.ts
+++ b/frontend/src/core/runtime/__tests__/createWsUrl.test.ts
@@ -2,8 +2,8 @@
import { describe, expect, it } from "vitest";
import { KnownQueryParams } from "@/core/constants";
-import { RuntimeManager } from "../runtime";
import type { SessionId } from "@/core/kernel/session";
+import { RuntimeManager } from "../runtime";
describe("RuntimeManager.getWsURL", () => {
it("should return a URL with the wss protocol when the baseURI uses https", () => {
diff --git a/frontend/src/core/runtime/__tests__/runtime.test.ts b/frontend/src/core/runtime/__tests__/runtime.test.ts
index d01d908ced..9462c3e768 100644
--- a/frontend/src/core/runtime/__tests__/runtime.test.ts
+++ b/frontend/src/core/runtime/__tests__/runtime.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it, vi } from "vitest";
-import { RuntimeManager } from "../runtime";
-import type { RuntimeConfig } from "../types";
import type { SessionId } from "@/core/kernel/session";
import { Logger } from "@/utils/Logger";
+import { RuntimeManager } from "../runtime";
+import type { RuntimeConfig } from "../types";
// Mock the session module
vi.mock("@/core/kernel/session", () => ({
diff --git a/frontend/src/core/runtime/config.ts b/frontend/src/core/runtime/config.ts
index 1d4c310798..b5a6ccf046 100644
--- a/frontend/src/core/runtime/config.ts
+++ b/frontend/src/core/runtime/config.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom, useAtomValue } from "jotai";
-import type { RuntimeConfig } from "./types";
-import { RuntimeManager } from "./runtime";
import { store } from "../state/jotai";
+import { RuntimeManager } from "./runtime";
+import type { RuntimeConfig } from "./types";
function getBaseURI(): string {
const url = new URL(document.baseURI);
diff --git a/frontend/src/core/runtime/runtime.ts b/frontend/src/core/runtime/runtime.ts
index e4376c686e..f54abbfccb 100644
--- a/frontend/src/core/runtime/runtime.ts
+++ b/frontend/src/core/runtime/runtime.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { RuntimeConfig } from "./types";
+import { Deferred } from "@/utils/Deferred";
import { Logger } from "@/utils/Logger";
-import { getSessionId, type SessionId } from "../kernel/session";
import { KnownQueryParams } from "../constants";
-import { Deferred } from "@/utils/Deferred";
+import { getSessionId, type SessionId } from "../kernel/session";
+import type { RuntimeConfig } from "./types";
export class RuntimeManager {
private initialHealthyCheck = new Deferred<void>();
@@ -131,9 +131,7 @@ export class RuntimeManager {
}
}
- async init(options?: {
- disableRetryDelay?: boolean;
- }) {
+ async init(options?: { disableRetryDelay?: boolean }) {
let retries = 0;
const maxRetries = 6;
const baseDelay = 1000;
diff --git a/frontend/src/core/saving/filename.ts b/frontend/src/core/saving/filename.ts
index fbbbef7dad..08b1d8db40 100644
--- a/frontend/src/core/saving/filename.ts
+++ b/frontend/src/core/saving/filename.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { useAtom, useAtomValue, useSetAtom } from "jotai";
-import { sendRename } from "../network/requests";
+import useEvent from "react-use-event-hook";
+import { useImperativeModal } from "@/components/modal/ImperativeModal";
import { Paths } from "@/utils/paths";
import { updateQueryParams } from "@/utils/urls";
-import useEvent from "react-use-event-hook";
+import { getAppConfig } from "../config/config";
import { KnownQueryParams } from "../constants";
-import { WebSocketState } from "../websocket/types";
-import { useImperativeModal } from "@/components/modal/ImperativeModal";
import { connectionAtom } from "../network/connection";
-import { getAppConfig } from "../config/config";
+import { sendRename } from "../network/requests";
+import { WebSocketState } from "../websocket/types";
import { filenameAtom } from "./file-state";
export function useFilename() {
diff --git a/frontend/src/core/saving/save-component.tsx b/frontend/src/core/saving/save-component.tsx
index f8ec02edab..562752817d 100644
--- a/frontend/src/core/saving/save-component.tsx
+++ b/frontend/src/core/saving/save-component.tsx
@@ -1,40 +1,39 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState } from "react";
-
-import { sendSave } from "@/core/network/requests";
+import { useAtom, useAtomValue, useSetAtom, useStore } from "jotai";
+import { SaveIcon } from "lucide-react";
+import { useState } from "react";
import { FilenameInput } from "@/components/editor/header/filename-input";
-import { WebSocketState } from "../websocket/types";
-import { useNotebook, getCellConfigs, getNotebook } from "../cells/cells";
-import { notebookCells } from "../cells/utils";
+import { Button as ControlButton } from "@/components/editor/inputs/Inputs";
+import { RecoveryButton } from "@/components/editor/RecoveryButton";
+import { renderShortcut } from "@/components/shortcuts/renderShortcut";
+import { Tooltip } from "@/components/ui/tooltip";
+import { sendSave } from "@/core/network/requests";
+import { useEventListener } from "@/hooks/useEventListener";
+import { useHotkey } from "@/hooks/useHotkey";
import { useImperativeModal } from "../../components/modal/ImperativeModal";
+import { Button } from "../../components/ui/button";
import {
DialogContent,
DialogFooter,
DialogTitle,
} from "../../components/ui/dialog";
import { Label } from "../../components/ui/label";
-import { Button } from "../../components/ui/button";
import { useEvent } from "../../hooks/useEvent";
import { Logger } from "../../utils/Logger";
-import { useAutoSave } from "./useAutoSave";
-import { getSerializedLayout, layoutStateAtom } from "../layout/layout";
-import { useAtom, useAtomValue, useSetAtom, useStore } from "jotai";
+import { getCellConfigs, getNotebook, useNotebook } from "../cells/cells";
+import { notebookCells } from "../cells/utils";
import { formatAll } from "../codemirror/format";
-import { useFilename, useUpdateFilename } from "./filename";
-import { filenameAtom } from "./file-state";
-import { connectionAtom } from "../network/connection";
import { autoSaveConfigAtom } from "../config/config";
-import { lastSavedNotebookAtom, needsSaveAtom } from "./state";
-import { Tooltip } from "@/components/ui/tooltip";
-import { RecoveryButton } from "@/components/editor/RecoveryButton";
-import { renderShortcut } from "@/components/shortcuts/renderShortcut";
-import { SaveIcon } from "lucide-react";
-import { useHotkey } from "@/hooks/useHotkey";
-import { Button as ControlButton } from "@/components/editor/inputs/Inputs";
import { useAutoExport } from "../export/hooks";
-import { useEventListener } from "@/hooks/useEventListener";
+import { getSerializedLayout, layoutStateAtom } from "../layout/layout";
import { kioskModeAtom } from "../mode";
+import { connectionAtom } from "../network/connection";
+import { WebSocketState } from "../websocket/types";
+import { filenameAtom } from "./file-state";
+import { useFilename, useUpdateFilename } from "./filename";
+import { lastSavedNotebookAtom, needsSaveAtom } from "./state";
+import { useAutoSave } from "./useAutoSave";
interface SaveNotebookProps {
kioskMode: boolean;
diff --git a/frontend/src/core/saving/state.ts b/frontend/src/core/saving/state.ts
index cfd1746250..63536faef8 100644
--- a/frontend/src/core/saving/state.ts
+++ b/frontend/src/core/saving/state.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { atom } from "jotai";
+import { isEqual } from "lodash-es";
+import { arrayShallowEquals } from "@/utils/arrays";
+import { type NotebookState, notebookAtom } from "../cells/cells";
import { type LayoutState, layoutStateAtom } from "../layout/layout";
import type { CellConfig } from "../network/types";
-import { arrayShallowEquals } from "@/utils/arrays";
-import { isEqual } from "lodash-es";
-import { notebookAtom, type NotebookState } from "../cells/cells";
export interface LastSavedNotebook {
codes: string[];
diff --git a/frontend/src/core/saving/useAutoSave.ts b/frontend/src/core/saving/useAutoSave.ts
index 163e92060c..161de1c138 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 { type ConnectionStatus, WebSocketState } from "../websocket/types";
import type { UserConfig } from "../config/config-schema";
import type { CellConfig } from "../network/types";
+import { type ConnectionStatus, WebSocketState } from "../websocket/types";
export function useAutoSave(opts: {
codes: string[];
diff --git a/frontend/src/core/state/__tests__/jotai.test.ts b/frontend/src/core/state/__tests__/jotai.test.ts
index 3dfafc98cf..1ab825bdc4 100644
--- a/frontend/src/core/state/__tests__/jotai.test.ts
+++ b/frontend/src/core/state/__tests__/jotai.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { store, waitFor } from "../jotai";
import { atom } from "jotai";
+import { describe, expect, it } from "vitest";
+import { store, waitFor } from "../jotai";
describe("waitFor function", () => {
it("should resolve when the atom satisfies the predicate", async () => {
diff --git a/frontend/src/core/state/jotai.ts b/frontend/src/core/state/jotai.ts
index 8df34284c6..635d282cae 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, type Atom, createStore, useStore } from "jotai";
+import { type Atom, atom, createStore, useStore } from "jotai";
import { isEqual } from "lodash-es";
import { useEffect } from "react";
diff --git a/frontend/src/core/static/__tests__/files.test.ts b/frontend/src/core/static/__tests__/files.test.ts
index e50c096cc9..e2f608cb8b 100644
--- a/frontend/src/core/static/__tests__/files.test.ts
+++ b/frontend/src/core/static/__tests__/files.test.ts
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
// @vitest-environment jsdom
-import { describe, expect, it, vi, beforeAll, afterAll } from "vitest";
-import { patchFetch, patchVegaLoader } from "../files";
-import type { DataURLString } from "@/utils/json/base64";
-import { createLoader } from "@/plugins/impl/vega/vega-loader";
+
import http from "node:http";
+import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
+import { createLoader } from "@/plugins/impl/vega/vega-loader";
+import type { DataURLString } from "@/utils/json/base64";
+import { patchFetch, patchVegaLoader } from "../files";
// Start a tiny server to serve virtual files
const server = http.createServer((request, response) => {
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 cead8eea10..b34082edc7 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 { describe, expect, it } from "vitest";
import type { CellId } from "@/core/cells/ids";
import type { OutputMessage } from "@/core/kernel/messages";
+import { findVirtualFiles, VirtualFileTracker } from "../virtual-file-tracker";
describe("findVirtualFiles", () => {
it("should return a set containing all virtual file paths in a string", () => {
diff --git a/frontend/src/core/static/download-html.ts b/frontend/src/core/static/download-html.ts
index 100ffe6e8a..0af3dadc8d 100644
--- a/frontend/src/core/static/download-html.ts
+++ b/frontend/src/core/static/download-html.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { exportAsHTML } from "../network/requests";
+
import { downloadBlob } from "@/utils/download";
+import { Filenames } from "@/utils/filenames";
import { Paths } from "@/utils/paths";
+import { exportAsHTML } from "../network/requests";
import { VirtualFileTracker } from "./virtual-file-tracker";
-import { Filenames } from "@/utils/filenames";
/**
* Downloads the current notebook as an HTML file.
diff --git a/frontend/src/core/static/files.ts b/frontend/src/core/static/files.ts
index 4fd430e33c..f133303bc2 100644
--- a/frontend/src/core/static/files.ts
+++ b/frontend/src/core/static/files.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { StaticVirtualFiles } from "./types";
-import { getStaticVirtualFiles } from "./static-state";
-import { Logger } from "@/utils/Logger";
import type { Loader } from "@/plugins/impl/vega/vega-loader";
+import { Logger } from "@/utils/Logger";
+import { getStaticVirtualFiles } from "./static-state";
+import type { StaticVirtualFiles } from "./types";
/**
* Patch fetch to resolve virtual files
diff --git a/frontend/src/core/static/virtual-file-tracker.ts b/frontend/src/core/static/virtual-file-tracker.ts
index 08ed59cf71..32ffeede53 100644
--- a/frontend/src/core/static/virtual-file-tracker.ts
+++ b/frontend/src/core/static/virtual-file-tracker.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { CellMessage } from "../kernel/messages";
+
import type { CellId } from "../cells/ids";
+import type { CellMessage } from "../kernel/messages";
// 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/state.ts b/frontend/src/core/variables/state.ts
index 5d6039a6c5..2a12ce1325 100644
--- a/frontend/src/core/variables/state.ts
+++ b/frontend/src/core/variables/state.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { useAtomValue } from "jotai";
import { createReducerAndAtoms } from "@/utils/createReducer";
import type { Variable, VariableName, Variables } from "./types";
-import { useAtomValue } from "jotai";
function initialState(): Variables {
return {};
diff --git a/frontend/src/core/variables/types.ts b/frontend/src/core/variables/types.ts
index c5a0cd17a4..e024bd31db 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 type { CellId } from "../cells/ids";
import type { TypedString } from "../../utils/typed";
+import type { CellId } from "../cells/ids";
export type VariableName = TypedString<"VariableName">;
diff --git a/frontend/src/core/vscode/vscode-bindings.ts b/frontend/src/core/vscode/vscode-bindings.ts
index bb1d166ebc..3469f2b3a8 100644
--- a/frontend/src/core/vscode/vscode-bindings.ts
+++ b/frontend/src/core/vscode/vscode-bindings.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { Logger } from "@/utils/Logger";
-import { isWasm } from "../wasm/utils";
-import { isPlatformMac } from "../hotkeys/shortcuts";
import { KnownQueryParams } from "../constants";
+import { isPlatformMac } from "../hotkeys/shortcuts";
+import { isWasm } from "../wasm/utils";
export const isEmbedded =
// eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
diff --git a/frontend/src/core/wasm/PyodideLoader.tsx b/frontend/src/core/wasm/PyodideLoader.tsx
index 20f16e180f..ebeaf43bc7 100644
--- a/frontend/src/core/wasm/PyodideLoader.tsx
+++ b/frontend/src/core/wasm/PyodideLoader.tsx
@@ -1,17 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { useAtomValue } from "jotai";
import type React from "react";
import type { PropsWithChildren } from "react";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { isWasm } from "./utils";
-import { PyodideBridge } from "./bridge";
import { LargeSpinner } from "@/components/icons/large-spinner";
-import { useAtomValue } from "jotai";
-import { hasAnyOutputAtom, wasmInitializationAtom } from "./state";
-import { getInitialAppMode } from "../mode";
-import { hasQueryParam } from "@/utils/urls";
-import { KnownQueryParams } from "../constants";
import { showCodeInRunModeAtom } from "@/core/meta/state";
import { store } from "@/core/state/jotai";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { hasQueryParam } from "@/utils/urls";
+import { KnownQueryParams } from "../constants";
+import { getInitialAppMode } from "../mode";
+import { PyodideBridge } from "./bridge";
+import { hasAnyOutputAtom, wasmInitializationAtom } from "./state";
+import { isWasm } from "./utils";
/**
* HOC to load Pyodide before rendering children, if necessary.
diff --git a/frontend/src/core/wasm/__tests__/router.test.ts b/frontend/src/core/wasm/__tests__/router.test.ts
index 7d09397a97..cb3276d582 100644
--- a/frontend/src/core/wasm/__tests__/router.test.ts
+++ b/frontend/src/core/wasm/__tests__/router.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/unbound-method */
-import { beforeEach, afterEach, expect, test, describe, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { PyodideRouter } from "../router";
describe("URLPyodideRouter", () => {
diff --git a/frontend/src/core/wasm/__tests__/share.test.ts b/frontend/src/core/wasm/__tests__/share.test.ts
index f041e2007c..c30c0e2067 100644
--- a/frontend/src/core/wasm/__tests__/share.test.ts
+++ b/frontend/src/core/wasm/__tests__/share.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { createShareableLink } from "../share";
import { compressToEncodedURIComponent } from "lz-string";
+import { describe, expect, it } from "vitest";
+import { createShareableLink } from "../share";
describe("createShareableLink", () => {
it("should return a URL with the base URL when no code is provided", () => {
diff --git a/frontend/src/core/wasm/__tests__/state.test.ts b/frontend/src/core/wasm/__tests__/state.test.ts
index cfdb680378..05bc07990a 100644
--- a/frontend/src/core/wasm/__tests__/state.test.ts
+++ b/frontend/src/core/wasm/__tests__/state.test.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
-import { store } from "@/core/state/jotai";
-import { hasAnyOutputAtom } from "../state";
-import { notebookAtom } from "@/core/cells/cells";
+
+import { createRef } from "react";
+import { describe, expect, it } from "vitest";
import type { NotebookState } from "@/core/cells/cells";
-import { MultiColumn, CollapsibleTree } from "@/utils/id-tree";
-import type { OutputMessage } from "@/core/kernel/messages";
+import { notebookAtom } from "@/core/cells/cells";
import type { CellId } from "@/core/cells/ids";
-import { createRef } from "react";
-import { createCellRuntimeState } from "@/core/cells/types";
-import { createCell } from "@/core/cells/types";
+import { createCell, createCellRuntimeState } from "@/core/cells/types";
+import type { OutputMessage } from "@/core/kernel/messages";
+import { store } from "@/core/state/jotai";
+import { CollapsibleTree, MultiColumn } from "@/utils/id-tree";
+import { hasAnyOutputAtom } from "../state";
describe("hasAnyOutputAtom", () => {
const createNotebookState = (
diff --git a/frontend/src/core/wasm/__tests__/store.test.ts b/frontend/src/core/wasm/__tests__/store.test.ts
index a46d11fd7a..11424b3138 100644
--- a/frontend/src/core/wasm/__tests__/store.test.ts
+++ b/frontend/src/core/wasm/__tests__/store.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/unbound-method */
-import { expect, describe, it, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import {
- localStorageFileStore,
- domElementFileStore,
CompositeFileStore,
+ domElementFileStore,
+ localStorageFileStore,
} from "../store";
describe("localStorageFileStore", () => {
diff --git a/frontend/src/core/wasm/bridge.ts b/frontend/src/core/wasm/bridge.ts
index d26c28de4f..3e0aff5de3 100644
--- a/frontend/src/core/wasm/bridge.ts
+++ b/frontend/src/core/wasm/bridge.ts
@@ -1,6 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import { toast } from "@/components/ui/use-toast";
+import { userConfigAtom } from "@/core/config/config";
+import { Deferred } from "@/utils/Deferred";
+import { throwNotImplemented } from "@/utils/functions";
import { Logger } from "@/utils/Logger";
+import { reloadSafe } from "@/utils/reload-safe";
+import { generateUUID } from "@/utils/uuid";
+import { notebookIsRunningAtom } from "../cells/cells";
+import { getMarimoVersion } from "../meta/globals";
+import { getInitialAppMode } from "../mode";
+import { API } from "../network/api";
import type {
EditRequests,
ExportAsHTMLRequest,
@@ -16,26 +27,16 @@ import type {
SaveUserConfigurationRequest,
Snippets,
} from "../network/types";
+import { store } from "../state/jotai";
import type { IReconnectingWebSocket } from "../websocket/types";
-import { fallbackFileStore, notebookFileStore } from "./store";
-import { isWasm } from "./utils";
-import { Deferred } from "@/utils/Deferred";
-import { createShareableLink } from "./share";
import { PyodideRouter } from "./router";
-import { getMarimoVersion } from "../meta/globals";
import { getWorkerRPC } from "./rpc";
-import { API } from "../network/api";
-import { throwNotImplemented } from "@/utils/functions";
-import type { WorkerSchema } from "./worker/worker";
-import type { SaveWorkerSchema } from "./worker/save-worker";
-import { toast } from "@/components/ui/use-toast";
-import { generateUUID } from "@/utils/uuid";
-import { store } from "../state/jotai";
-import { notebookIsRunningAtom } from "../cells/cells";
-import { getInitialAppMode } from "../mode";
+import { createShareableLink } from "./share";
import { wasmInitializationAtom } from "./state";
-import { reloadSafe } from "@/utils/reload-safe";
-import { userConfigAtom } from "@/core/config/config";
+import { fallbackFileStore, notebookFileStore } from "./store";
+import { isWasm } from "./utils";
+import type { SaveWorkerSchema } from "./worker/save-worker";
+import type { WorkerSchema } from "./worker/worker";
type SaveWorker = ReturnType<
typeof getWorkerRPC<SaveWorkerSchema>
diff --git a/frontend/src/core/wasm/rpc.ts b/frontend/src/core/wasm/rpc.ts
index e1ffbc4cc5..e95fc36f8d 100644
--- a/frontend/src/core/wasm/rpc.ts
+++ b/frontend/src/core/wasm/rpc.ts
@@ -1,13 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- createWorkerTransport,
createRPC,
- type RPCSchema,
+ createWorkerTransport,
type RPCOptions,
+ type RPCSchema,
} from "rpc-anywhere";
-
-import { TRANSPORT_ID } from "./worker/constants";
import { Logger } from "@/utils/Logger";
+import { TRANSPORT_ID } from "./worker/constants";
export type ParentSchema = RPCSchema<{
messages: {
diff --git a/frontend/src/core/wasm/store.ts b/frontend/src/core/wasm/store.ts
index a381585542..93b8cb6ba7 100644
--- a/frontend/src/core/wasm/store.ts
+++ b/frontend/src/core/wasm/store.ts
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TypedLocalStorage } from "@/utils/localStorage";
+
import {
- decompressFromEncodedURIComponent,
compressToEncodedURIComponent,
+ decompressFromEncodedURIComponent,
} from "lz-string";
+import { TypedLocalStorage } from "@/utils/localStorage";
import { PyodideRouter } from "./router";
export interface FileStore {
diff --git a/frontend/src/core/wasm/worker/bootstrap.ts b/frontend/src/core/wasm/worker/bootstrap.ts
index 3045818481..d541d0a296 100644
--- a/frontend/src/core/wasm/worker/bootstrap.ts
+++ b/frontend/src/core/wasm/worker/bootstrap.ts
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { loadPyodide, type PyodideInterface } from "pyodide";
-import { WasmFileSystem } from "./fs";
-import { Logger } from "../../../utils/Logger";
-import type { SerializedBridge, WasmController } from "./types";
-import { invariant } from "../../../utils/invariant";
import type { UserConfig } from "@/core/config/config-schema";
import type { OperationMessage } from "@/core/kernel/messages";
import type { JsonString } from "@/utils/json/base64";
+import { invariant } from "../../../utils/invariant";
+import { Logger } from "../../../utils/Logger";
+import { WasmFileSystem } from "./fs";
import { t } from "./tracer";
+import type { SerializedBridge, WasmController } from "./types";
const MAKE_SNAPSHOT = false;
diff --git a/frontend/src/core/wasm/worker/fs.ts b/frontend/src/core/wasm/worker/fs.ts
index 2d11cc4d75..15e33db7f3 100644
--- a/frontend/src/core/wasm/worker/fs.ts
+++ b/frontend/src/core/wasm/worker/fs.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
-import { getFS } from "./getFS";
import { decodeUtf8 } from "@/utils/strings";
+import { getFS } from "./getFS";
const NOTEBOOK_FILENAME = "notebook.py";
const HOME_DIR = "/marimo";
diff --git a/frontend/src/core/wasm/worker/save-worker.ts b/frontend/src/core/wasm/worker/save-worker.ts
index 29cb6e9a72..6b6112a59d 100644
--- a/frontend/src/core/wasm/worker/save-worker.ts
+++ b/frontend/src/core/wasm/worker/save-worker.ts
@@ -1,21 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
-import { prettyError } from "../../../utils/errors";
import {
- createWorkerParentTransport,
createRPC,
createRPCRequestHandler,
+ createWorkerParentTransport,
type RPCSchema,
} from "rpc-anywhere";
-import type { ParentSchema } from "../rpc";
+import type { SaveNotebookRequest } from "@/core/network/types";
+import { decodeUtf8 } from "@/utils/strings";
+import { prettyError } from "../../../utils/errors";
import { Logger } from "../../../utils/Logger";
+import type { ParentSchema } from "../rpc";
import { TRANSPORT_ID } from "./constants";
-import { getPyodideVersion } from "./getPyodideVersion";
-import type { SaveNotebookRequest } from "@/core/network/types";
import { WasmFileSystem } from "./fs";
import { getController } from "./getController";
-import { decodeUtf8 } from "@/utils/strings";
+import { getPyodideVersion } from "./getPyodideVersion";
/**
* Web worker responsible for saving the notebook.
diff --git a/frontend/src/core/wasm/worker/types.ts b/frontend/src/core/wasm/worker/types.ts
index 3364ce192d..9d0b456eca 100644
--- a/frontend/src/core/wasm/worker/types.ts
+++ b/frontend/src/core/wasm/worker/types.ts
@@ -1,5 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
+import type { UserConfig } from "@/core/config/config-schema";
+import type { OperationMessage } from "@/core/kernel/messages";
+import type { JsonString } from "@/utils/json/base64";
import type {
CodeCompletionRequest,
CopyNotebookRequest,
@@ -22,9 +25,6 @@ import type {
SaveUserConfigurationRequest,
Snippets,
} from "../../network/types";
-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/wasm/worker/worker.ts b/frontend/src/core/wasm/worker/worker.ts
index 3576123142..45e606d8dd 100644
--- a/frontend/src/core/wasm/worker/worker.ts
+++ b/frontend/src/core/wasm/worker/worker.ts
@@ -1,34 +1,34 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { PyodideInterface } from "pyodide";
-import type { RawBridge, SerializedBridge, WasmController } from "./types";
-import { Deferred } from "../../../utils/Deferred";
-import { WasmFileSystem } from "./fs";
-import { MessageBuffer } from "./message-buffer";
-import { prettyError } from "../../../utils/errors";
import {
- createWorkerParentTransport,
createRPC,
createRPCRequestHandler,
+ createWorkerParentTransport,
type RPCSchema,
} from "rpc-anywhere";
-import type { ParentSchema } from "../rpc";
-import { Logger } from "../../../utils/Logger";
-import { TRANSPORT_ID } from "./constants";
-import { invariant } from "../../../utils/invariant";
-import type { OperationMessage } from "@/core/kernel/messages";
-import type { JsonString } from "@/utils/json/base64";
import type { UserConfig } from "@/core/config/config-schema";
-import { getPyodideVersion } from "./getPyodideVersion";
-import { t } from "./tracer";
-import { once } from "@/utils/once";
-import { getController } from "./getController";
+import type { OperationMessage } from "@/core/kernel/messages";
import type {
ListPackagesResponse,
PackageOperationResponse,
SaveNotebookRequest,
} from "@/core/network/types";
+import type { JsonString } from "@/utils/json/base64";
+import { once } from "@/utils/once";
import { decodeUtf8 } from "@/utils/strings";
+import { Deferred } from "../../../utils/Deferred";
+import { prettyError } from "../../../utils/errors";
+import { invariant } from "../../../utils/invariant";
+import { Logger } from "../../../utils/Logger";
+import type { ParentSchema } from "../rpc";
+import { TRANSPORT_ID } from "./constants";
+import { WasmFileSystem } from "./fs";
+import { getController } from "./getController";
+import { getPyodideVersion } from "./getPyodideVersion";
+import { MessageBuffer } from "./message-buffer";
+import { t } from "./tracer";
+import type { RawBridge, SerializedBridge, WasmController } from "./types";
/**
* Web worker responsible for running the notebook.
diff --git a/frontend/src/core/websocket/useMarimoWebSocket.tsx b/frontend/src/core/websocket/useMarimoWebSocket.tsx
index 73c61fdd3a..6ee049aa25 100644
--- a/frontend/src/core/websocket/useMarimoWebSocket.tsx
+++ b/frontend/src/core/websocket/useMarimoWebSocket.tsx
@@ -1,60 +1,61 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { WebSocketClosedReason, WebSocketState } from "./types";
+
import { useAtom, useSetAtom } from "jotai";
-import { connectionAtom } from "../network/connection";
-import { useWebSocket } from "@/core/websocket/useWebSocket";
-import { logNever } from "@/utils/assertNever";
+import { useRef } from "react";
+import { useErrorBoundary } from "react-error-boundary";
+import { toast } from "@/components/ui/use-toast";
import { getNotebook, useCellActions } from "@/core/cells/cells";
import { AUTOCOMPLETER } from "@/core/codemirror/completion/Autocompleter";
import type { OperationMessage } from "@/core/kernel/messages";
-import type { CellData } from "../cells/types";
-import { useErrorBoundary } from "react-error-boundary";
-import { Logger } from "@/utils/Logger";
-import { type LayoutState, useLayoutActions } from "../layout/layout";
-import { useVariablesActions } from "../variables/state";
-import { toast } from "@/components/ui/use-toast";
+import { useWebSocket } from "@/core/websocket/useWebSocket";
import { renderHTML } from "@/plugins/core/RenderHTML";
-import { FUNCTIONS_REGISTRY } from "../functions/FunctionRegistry";
import {
- PreviewSQLTable,
- PreviewSQLTableList,
-} from "../datasets/request-registry";
+ handleWidgetMessage,
+ isMessageWidgetState,
+ MODEL_MANAGER,
+} from "@/plugins/impl/anywidget/model";
+import { logNever } from "@/utils/assertNever";
import { prettyError } from "@/utils/errors";
-import { isStaticNotebook } from "../static/static-state";
-import { useRef } from "react";
+import type { Base64String, JsonString } from "@/utils/json/base64";
import { jsonParseWithSpecialChar } from "@/utils/json/json-parser";
-import type { SessionId } from "../kernel/session";
-import { useBannersActions } from "../errors/state";
+import { Logger } from "@/utils/Logger";
+import { reloadSafe } from "@/utils/reload-safe";
import { useAlertActions } from "../alerts/state";
-import { useSetAppConfig } from "../config/config";
-import {
- handleCellOperation,
- handleKernelReady,
- handleRemoveUIElements,
-} from "../kernel/handlers";
-import { queryParamHandlers } from "../kernel/queryParamHandlers";
-import type { Base64String, JsonString } from "@/utils/json/base64";
-import { useDatasetsActions } from "../datasets/state";
-import type { RequestId } from "../network/DeferredRequestRegistry";
-import type { VariableName } from "../variables/types";
import type { CellId, UIElementId } from "../cells/ids";
-import { kioskModeAtom } from "../mode";
+import { useRunsActions } from "../cells/runs";
import { focusAndScrollCellOutputIntoView } from "../cells/scrollCellIntoView";
+import type { CellData } from "../cells/types";
import { capabilitiesAtom } from "../config/capabilities";
-import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
-import { reloadSafe } from "@/utils/reload-safe";
-import { useRunsActions } from "../cells/runs";
+import { useSetAppConfig } from "../config/config";
import {
type ConnectionName,
useDataSourceActions,
} from "../datasets/data-source-connections";
-import { SECRETS_REGISTRY } from "../secrets/request-registry";
import {
- handleWidgetMessage,
- isMessageWidgetState,
- MODEL_MANAGER,
-} from "@/plugins/impl/anywidget/model";
+ PreviewSQLTable,
+ PreviewSQLTableList,
+} from "../datasets/request-registry";
+import { useDatasetsActions } from "../datasets/state";
+import { UI_ELEMENT_REGISTRY } from "../dom/uiregistry";
+import { useBannersActions } from "../errors/state";
+import { FUNCTIONS_REGISTRY } from "../functions/FunctionRegistry";
+import {
+ handleCellOperation,
+ handleKernelReady,
+ handleRemoveUIElements,
+} from "../kernel/handlers";
+import { queryParamHandlers } from "../kernel/queryParamHandlers";
+import type { SessionId } from "../kernel/session";
+import { type LayoutState, useLayoutActions } from "../layout/layout";
+import { kioskModeAtom } from "../mode";
+import { connectionAtom } from "../network/connection";
+import type { RequestId } from "../network/DeferredRequestRegistry";
import { useRuntimeManager } from "../runtime/config";
+import { SECRETS_REGISTRY } from "../secrets/request-registry";
+import { isStaticNotebook } from "../static/static-state";
+import { useVariablesActions } from "../variables/state";
+import type { VariableName } from "../variables/types";
+import { WebSocketClosedReason, WebSocketState } from "./types";
/**
* WebSocket that connects to the Marimo kernel and handles incoming messages.
diff --git a/frontend/src/core/websocket/useWebSocket.tsx b/frontend/src/core/websocket/useWebSocket.tsx
index 67f49951a3..3b10b94e7a 100644
--- a/frontend/src/core/websocket/useWebSocket.tsx
+++ b/frontend/src/core/websocket/useWebSocket.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useState } from "react";
+
import ReconnectingWebSocket from "partysocket/ws";
-import type { IReconnectingWebSocket } from "./types";
-import { StaticWebsocket } from "./StaticWebsocket";
-import { isWasm } from "../wasm/utils";
-import { PyodideBridge, PyodideWebsocket } from "../wasm/bridge";
+import { useEffect, useState } from "react";
import { Logger } from "@/utils/Logger";
import { isStaticNotebook } from "../static/static-state";
+import { PyodideBridge, PyodideWebsocket } from "../wasm/bridge";
+import { isWasm } from "../wasm/utils";
+import { StaticWebsocket } from "./StaticWebsocket";
+import type { IReconnectingWebSocket } from "./types";
interface UseWebSocketOptions {
url: () => string;
diff --git a/frontend/src/css/globals.css b/frontend/src/css/globals.css
index 033d735f6b..8afe926f81 100644
--- a/frontend/src/css/globals.css
+++ b/frontend/src/css/globals.css
@@ -119,7 +119,9 @@
body {
@apply bg-background text-foreground;
- font-feature-settings: "rlig" 1, "calt" 1;
+ font-feature-settings:
+ "rlig" 1,
+ "calt" 1;
}
a.hyperlink {
diff --git a/frontend/src/css/katex-fonts.css b/frontend/src/css/katex-fonts.css
index 29a3260a6b..82e2f6e68c 100644
--- a/frontend/src/css/katex-fonts.css
+++ b/frontend/src/css/katex-fonts.css
@@ -3,7 +3,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_AMS-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_AMS-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_AMS-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_AMS-Regular.ttf") format("truetype");
}
@@ -13,7 +14,8 @@
font-style: normal;
font-display: block;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_Caligraphic-Bold.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Caligraphic-Bold.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Caligraphic-Bold.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Caligraphic-Bold.ttf") format("truetype");
}
@@ -23,7 +25,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Caligraphic-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Caligraphic-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Caligraphic-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Caligraphic-Regular.ttf") format("truetype");
}
@@ -33,7 +36,8 @@
font-style: normal;
font-display: block;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_Fraktur-Bold.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Fraktur-Bold.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Fraktur-Bold.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Fraktur-Bold.ttf") format("truetype");
}
@@ -43,7 +47,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Fraktur-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Fraktur-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Fraktur-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Fraktur-Regular.ttf") format("truetype");
}
@@ -53,7 +58,8 @@
font-style: normal;
font-display: block;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_Main-Bold.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Main-Bold.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Main-Bold.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Main-Bold.ttf") format("truetype");
}
@@ -62,7 +68,8 @@
font-family: "KaTeX_Main";
font-style: italic;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_Main-BoldItalic.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Main-BoldItalic.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Main-BoldItalic.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Main-BoldItalic.ttf") format("truetype");
}
@@ -71,7 +78,8 @@
font-family: "KaTeX_Main";
font-style: italic;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Main-Italic.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Main-Italic.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Main-Italic.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Main-Italic.ttf") format("truetype");
}
@@ -81,7 +89,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Main-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Main-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Main-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Main-Regular.ttf") format("truetype");
}
@@ -90,7 +99,8 @@
font-family: "KaTeX_Math";
font-style: italic;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_Math-BoldItalic.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Math-BoldItalic.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Math-BoldItalic.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Math-BoldItalic.ttf") format("truetype");
}
@@ -99,7 +109,8 @@
font-family: "KaTeX_Math";
font-style: italic;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Math-Italic.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Math-Italic.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Math-Italic.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Math-Italic.ttf") format("truetype");
}
@@ -109,7 +120,8 @@
font-style: normal;
font-display: block;
font-weight: 700;
- src: url("../fonts/KaTeX/KaTeX_SansSerif-Bold.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_SansSerif-Bold.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_SansSerif-Bold.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_SansSerif-Bold.ttf") format("truetype");
}
@@ -118,7 +130,8 @@
font-family: "KaTeX_SansSerif";
font-style: italic;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_SansSerif-Italic.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_SansSerif-Italic.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_SansSerif-Italic.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_SansSerif-Italic.ttf") format("truetype");
}
@@ -128,7 +141,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_SansSerif-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_SansSerif-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_SansSerif-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_SansSerif-Regular.ttf") format("truetype");
}
@@ -138,7 +152,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Script-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Script-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Script-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Script-Regular.ttf") format("truetype");
}
@@ -148,7 +163,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Size1-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Size1-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Size1-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Size1-Regular.ttf") format("truetype");
}
@@ -158,7 +174,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Size2-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Size2-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Size2-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Size2-Regular.ttf") format("truetype");
}
@@ -168,7 +185,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Size3-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Size3-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Size3-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Size3-Regular.ttf") format("truetype");
}
@@ -178,7 +196,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Size4-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Size4-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Size4-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Size4-Regular.ttf") format("truetype");
}
@@ -188,7 +207,8 @@
font-style: normal;
font-display: block;
font-weight: 400;
- src: url("../fonts/KaTeX/KaTeX_Typewriter-Regular.woff2") format("woff2"),
+ src:
+ url("../fonts/KaTeX/KaTeX_Typewriter-Regular.woff2") format("woff2"),
url("../fonts/KaTeX/KaTeX_Typewriter-Regular.woff") format("woff"),
url("../fonts/KaTeX/KaTeX_Typewriter-Regular.ttf") format("truetype");
}
diff --git a/frontend/src/css/md.css b/frontend/src/css/md.css
index 2c381462ed..328184441e 100644
--- a/frontend/src/css/md.css
+++ b/frontend/src/css/md.css
@@ -6,8 +6,7 @@
.markdown p:last-child,
/* This is needed when markdown is used inside buttons or labels */
- .markdown
- .paragraph:last-child {
+.markdown .paragraph:last-child {
margin-block-end: 0;
}
@@ -133,7 +132,9 @@ button .prose.prose {
border-top-left-radius: var(--radius);
border-top-right-radius: var(--radius);
cursor: pointer;
- transition: background-color var(--transition), color var(--transition);
+ transition:
+ background-color var(--transition),
+ color var(--transition);
color: var(--muted-foreground);
}
diff --git a/frontend/src/hooks/__tests__/useBoolean.test.tsx b/frontend/src/hooks/__tests__/useBoolean.test.tsx
index 432ef8a10b..830742bdd2 100644
--- a/frontend/src/hooks/__tests__/useBoolean.test.tsx
+++ b/frontend/src/hooks/__tests__/useBoolean.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, vi } from "vitest";
-import { renderHook, act } from "@testing-library/react";
+
+import { act, renderHook } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
import { useBoolean } from "../useBoolean";
describe("useBoolean", () => {
diff --git a/frontend/src/hooks/__tests__/useDebounce.test.tsx b/frontend/src/hooks/__tests__/useDebounce.test.tsx
index 008520fb43..d358c66171 100644
--- a/frontend/src/hooks/__tests__/useDebounce.test.tsx
+++ b/frontend/src/hooks/__tests__/useDebounce.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, vi, beforeEach, afterEach } from "vitest";
-import { renderHook, act } from "@testing-library/react";
+
+import { act, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
useDebounce,
useDebounceControlledState,
diff --git a/frontend/src/hooks/__tests__/useEventListener.test.tsx b/frontend/src/hooks/__tests__/useEventListener.test.tsx
index e3f1316116..feb92faf47 100644
--- a/frontend/src/hooks/__tests__/useEventListener.test.tsx
+++ b/frontend/src/hooks/__tests__/useEventListener.test.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, beforeEach, vi } from "vitest";
+
import { renderHook } from "@testing-library/react";
import { useRef } from "react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
import {
type HTMLElementNotDerivedFromRef,
isRefObject,
diff --git a/frontend/src/hooks/__tests__/useInternalStateWithSync.test.tsx b/frontend/src/hooks/__tests__/useInternalStateWithSync.test.tsx
index ab06b20b98..85369e73ed 100644
--- a/frontend/src/hooks/__tests__/useInternalStateWithSync.test.tsx
+++ b/frontend/src/hooks/__tests__/useInternalStateWithSync.test.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { renderHook, act } from "@testing-library/react";
+import { act, renderHook } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
import { useInternalStateWithSync } from "../useInternalStateWithSync";
-import { describe, it, expect, vi } from "vitest";
describe("useInternalStateWithSync", () => {
it("should initialize with the given initial value", () => {
diff --git a/frontend/src/hooks/__tests__/useInterval.test.tsx b/frontend/src/hooks/__tests__/useInterval.test.tsx
index 13d97df931..d170e6ee20 100644
--- a/frontend/src/hooks/__tests__/useInterval.test.tsx
+++ b/frontend/src/hooks/__tests__/useInterval.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, vi, beforeEach, afterEach } from "vitest";
+
import { renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useInterval } from "../useInterval";
describe("useInterval", () => {
diff --git a/frontend/src/hooks/__tests__/usePackageMetadata.test.tsx b/frontend/src/hooks/__tests__/usePackageMetadata.test.tsx
index 3b2c46d33e..76554539a1 100644
--- a/frontend/src/hooks/__tests__/usePackageMetadata.test.tsx
+++ b/frontend/src/hooks/__tests__/usePackageMetadata.test.tsx
@@ -1,12 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, beforeAll, afterEach, afterAll, expect } from "vitest";
+
+import { renderHook, waitFor } from "@testing-library/react";
import * as msw from "msw";
import { setupServer } from "msw/node";
-import { renderHook, waitFor } from "@testing-library/react";
+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
import {
- usePackageMetadata,
type PyPiPackageResponse,
+ usePackageMetadata,
} from "../usePackageMetadata";
function createPackageMock(options: {
diff --git a/frontend/src/hooks/__tests__/useResizeHandle.test.tsx b/frontend/src/hooks/__tests__/useResizeHandle.test.tsx
index f35a3c7923..cd473ec3b2 100644
--- a/frontend/src/hooks/__tests__/useResizeHandle.test.tsx
+++ b/frontend/src/hooks/__tests__/useResizeHandle.test.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { renderHook, act, render } from "@testing-library/react";
+import { act, render, renderHook } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
import { useResizeHandle } from "../useResizeHandle";
-import { describe, it, expect, vi } from "vitest";
describe("useResizeHandle", () => {
it("should initialize with correct refs and style", () => {
diff --git a/frontend/src/hooks/__tests__/useResizeObserver.test.tsx b/frontend/src/hooks/__tests__/useResizeObserver.test.tsx
index cd6efc2ca0..1d321d858d 100644
--- a/frontend/src/hooks/__tests__/useResizeObserver.test.tsx
+++ b/frontend/src/hooks/__tests__/useResizeObserver.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, beforeEach, vi, expect, it, afterAll } from "vitest";
+
import { renderHook } from "@testing-library/react";
+import { afterAll, beforeEach, describe, expect, it, vi } from "vitest";
import { useResizeObserver } from "../useResizeObserver";
describe("useResizeObserver", () => {
diff --git a/frontend/src/hooks/__tests__/useTimer.test.tsx b/frontend/src/hooks/__tests__/useTimer.test.tsx
index 5bffc4fbae..82d1c710d1 100644
--- a/frontend/src/hooks/__tests__/useTimer.test.tsx
+++ b/frontend/src/hooks/__tests__/useTimer.test.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it, vi, beforeEach, afterEach } from "vitest";
-import { renderHook, act } from "@testing-library/react";
+
+import { act, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useTimer } from "../useTimer";
describe("useTimer", () => {
diff --git a/frontend/src/hooks/debug.ts b/frontend/src/hooks/debug.ts
index dbc625266d..28fcdf48a9 100644
--- a/frontend/src/hooks/debug.ts
+++ b/frontend/src/hooks/debug.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable react-hooks/rules-of-hooks */
-import { useRef, useEffect, useMemo } from "react";
+
import { dequal } from "dequal";
+import { useEffect, useMemo, useRef } from "react";
import { Logger } from "@/utils/Logger";
/**
diff --git a/frontend/src/hooks/useAsyncData.ts b/frontend/src/hooks/useAsyncData.ts
index 02c7b4313b..bad6aae530 100644
--- a/frontend/src/hooks/useAsyncData.ts
+++ b/frontend/src/hooks/useAsyncData.ts
@@ -3,8 +3,8 @@ import {
type DependencyList,
type Dispatch,
type SetStateAction,
- useState,
useEffect,
+ useState,
} from "react";
import useEvent from "react-use-event-hook";
import { invariant } from "@/utils/invariant";
diff --git a/frontend/src/hooks/useAudioRecorder.ts b/frontend/src/hooks/useAudioRecorder.ts
index ad0c0f9336..41bbbef8f3 100644
--- a/frontend/src/hooks/useAudioRecorder.ts
+++ b/frontend/src/hooks/useAudioRecorder.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState, useRef } from "react";
-import { useTimer } from "./useTimer";
+import { useRef, useState } from "react";
import useEvent from "react-use-event-hook";
import { Logger } from "@/utils/Logger";
import { useOnUnmount } from "./useLifecycle";
+import { useTimer } from "./useTimer";
export type RecordingStatus = "recording" | "paused" | "stopped";
diff --git a/frontend/src/hooks/useAutoGrowInputProps.ts b/frontend/src/hooks/useAutoGrowInputProps.ts
index af396af144..1d8981421b 100644
--- a/frontend/src/hooks/useAutoGrowInputProps.ts
+++ b/frontend/src/hooks/useAutoGrowInputProps.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type React from "react";
-import { useState, useRef } from "react";
+import { useRef, useState } from "react";
import { useOnMount } from "./useLifecycle";
export function useAutoGrowInputProps(opts: {
diff --git a/frontend/src/hooks/useDeepCompareMemoize.ts b/frontend/src/hooks/useDeepCompareMemoize.ts
index cc04d20f2c..903021aeda 100644
--- a/frontend/src/hooks/useDeepCompareMemoize.ts
+++ b/frontend/src/hooks/useDeepCompareMemoize.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { dequal } from "dequal";
+import React from "react";
/**
* Deep compare memoize hook
diff --git a/frontend/src/hooks/useElapsedTime.ts b/frontend/src/hooks/useElapsedTime.ts
index 80f419f533..d195607aae 100644
--- a/frontend/src/hooks/useElapsedTime.ts
+++ b/frontend/src/hooks/useElapsedTime.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type Milliseconds, Time } from "@/utils/time";
+
import { useEffect, useRef, useState } from "react";
+import { type Milliseconds, Time } from "@/utils/time";
/**
* Returns the elapsed time since mount, in milliseconds.
diff --git a/frontend/src/hooks/useEventListener.ts b/frontend/src/hooks/useEventListener.ts
index f1047e262c..29d9acb941 100644
--- a/frontend/src/hooks/useEventListener.ts
+++ b/frontend/src/hooks/useEventListener.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useRef, useEffect, type RefObject } from "react";
+import { type RefObject, useEffect, useRef } from "react";
/**
* A type that makes it clear that an `HTMLElement` is not derived from a `RefObject`.
diff --git a/frontend/src/hooks/useHotkey.ts b/frontend/src/hooks/useHotkey.ts
index c7b972f7fc..d73b92702a 100644
--- a/frontend/src/hooks/useHotkey.ts
+++ b/frontend/src/hooks/useHotkey.ts
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type RefObject, useEffect } from "react";
-import { parseShortcut } from "../core/hotkeys/shortcuts";
-import { useEventListener } from "./useEventListener";
-import { useEvent } from "./useEvent";
-import { useSetRegisteredAction } from "../core/hotkeys/actions";
+import { useAtomValue } from "jotai";
+import { type RefObject, useEffect } from "react";
+import { hotkeysAtom } from "@/core/config/config";
import type { HotkeyAction } from "@/core/hotkeys/hotkeys";
-import { Objects } from "@/utils/objects";
-import { Logger } from "@/utils/Logger";
import { Functions } from "@/utils/functions";
-import { hotkeysAtom } from "@/core/config/config";
-import { useAtomValue } from "jotai";
+import { Logger } from "@/utils/Logger";
+import { Objects } from "@/utils/objects";
+import { useSetRegisteredAction } from "../core/hotkeys/actions";
+import { parseShortcut } from "../core/hotkeys/shortcuts";
+import { useEvent } from "./useEvent";
+import { useEventListener } from "./useEventListener";
type HotkeyHandler = (
evt?: KeyboardEvent,
diff --git a/frontend/src/hooks/useInternalStateWithSync.ts b/frontend/src/hooks/useInternalStateWithSync.ts
index b97d0acb6c..25b28e0c86 100644
--- a/frontend/src/hooks/useInternalStateWithSync.ts
+++ b/frontend/src/hooks/useInternalStateWithSync.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState, useRef } from "react";
+import { useRef, useState } from "react";
type EqualityFn<T> = (a: T, b: T) => boolean;
diff --git a/frontend/src/hooks/useInterval.ts b/frontend/src/hooks/useInterval.ts
index 3c45557dce..edf63137ac 100644
--- a/frontend/src/hooks/useInterval.ts
+++ b/frontend/src/hooks/useInterval.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useRef, useEffect } from "react";
+import { useEffect, useRef } from "react";
import { useEventListener } from "./useEventListener";
/**
diff --git a/frontend/src/hooks/useLocalStorage.ts b/frontend/src/hooks/useLocalStorage.ts
index 15e8c90dc3..e4ac31665a 100644
--- a/frontend/src/hooks/useLocalStorage.ts
+++ b/frontend/src/hooks/useLocalStorage.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TypedLocalStorage } from "@/utils/localStorage";
+
import { useState } from "react";
+import { TypedLocalStorage } from "@/utils/localStorage";
/**
* React hook to use localStorage
diff --git a/frontend/src/hooks/usePackageMetadata.ts b/frontend/src/hooks/usePackageMetadata.ts
index cbf2e54213..c3539f868b 100644
--- a/frontend/src/hooks/usePackageMetadata.ts
+++ b/frontend/src/hooks/usePackageMetadata.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useAsyncData, type AsyncDataResult } from "./useAsyncData";
-import { cleanPythonModuleName, reverseSemverSort } from "@/utils/versions";
-import { TimedCache } from "@/utils/timed-cache";
import * as z from "zod";
+import { TimedCache } from "@/utils/timed-cache";
+import { cleanPythonModuleName, reverseSemverSort } from "@/utils/versions";
+import { type AsyncDataResult, useAsyncData } from "./useAsyncData";
interface PackageMetadata {
versions: string[];
diff --git a/frontend/src/hooks/useResizeObserver.ts b/frontend/src/hooks/useResizeObserver.ts
index f190b41672..9dc01b2d92 100644
--- a/frontend/src/hooks/useResizeObserver.ts
+++ b/frontend/src/hooks/useResizeObserver.ts
@@ -4,9 +4,8 @@
* Use this when you want to attach a resize observer conditionally using the `skip` option.
*/
-import { useEffect, useRef } from "react";
-
import type { RefObject } from "react";
+import { useEffect, useRef } from "react";
interface Size {
width: number | undefined;
diff --git a/frontend/src/hooks/useTimer.ts b/frontend/src/hooks/useTimer.ts
index 50d5593f12..b2d42dd95a 100644
--- a/frontend/src/hooks/useTimer.ts
+++ b/frontend/src/hooks/useTimer.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useState, useEffect, useRef } from "react";
+import { useEffect, useRef, useState } from "react";
import useEvent from "react-use-event-hook";
/**
diff --git a/frontend/src/mount.tsx b/frontend/src/mount.tsx
index 745dbdcd34..849067b073 100644
--- a/frontend/src/mount.tsx
+++ b/frontend/src/mount.tsx
@@ -1,44 +1,48 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type * as api from "@marimo-team/marimo-api";
+import { Provider } from "jotai";
import { createRoot } from "react-dom/client";
-import { ThemeProvider } from "./theme/ThemeProvider";
+import { z } from "zod";
+import {
+ appConfigAtom,
+ configOverridesAtom,
+ userConfigAtom,
+} from "@/core/config/config";
+import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
+import { getMarimoCode } from "@/core/meta/globals";
+import {
+ marimoVersionAtom,
+ serverTokenAtom,
+ showCodeInRunModeAtom,
+} from "@/core/meta/state";
+import { Logger } from "@/utils/Logger";
import { ErrorBoundary } from "./components/editor/boundary/ErrorBoundary";
-import { MarimoApp, preloadPage } from "./core/MarimoApp";
-import { reportVitals } from "./utils/vitals";
-import { Provider } from "jotai";
-import { store } from "./core/state/jotai";
-import { maybeRegisterVSCodeBindings } from "./core/vscode/vscode-bindings";
-import { patchFetch, patchVegaLoader } from "./core/static/files";
-import { isStaticNotebook } from "./core/static/static-state";
-import { vegaLoader } from "./plugins/impl/vega/loader";
-import { initializePlugins } from "./plugins/plugins";
-import { cleanupAuthQueryParams } from "./core/network/auth";
+import { notebookAtom } from "./core/cells/cells";
+import { notebookStateFromSession } from "./core/cells/session";
import {
parseAppConfig,
parseConfigOverrides,
parseUserConfig,
} from "./core/config/config-schema";
+import { MarimoApp, preloadPage } from "./core/MarimoApp";
import { type AppMode, initialModeAtom, viewStateAtom } from "./core/mode";
-import { codeAtom, filenameAtom } from "./core/saving/file-state";
-import { Logger } from "@/utils/Logger";
-import { z } from "zod";
-import { getFilenameFromDOM } from "@/core/dom/htmlUtils";
-import {
- showCodeInRunModeAtom,
- marimoVersionAtom,
- serverTokenAtom,
-} from "@/core/meta/state";
-import { appConfigAtom, userConfigAtom } from "@/core/config/config";
-import { configOverridesAtom } from "@/core/config/config";
+import { cleanupAuthQueryParams } from "./core/network/auth";
import {
DEFAULT_RUNTIME_CONFIG,
runtimeConfigAtom,
} from "./core/runtime/config";
-import { getMarimoCode } from "@/core/meta/globals";
-import type * as api from "@marimo-team/marimo-api";
-import { notebookAtom } from "./core/cells/cells";
-import { notebookStateFromSession } from "./core/cells/session";
+import { codeAtom, filenameAtom } from "./core/saving/file-state";
+import { store } from "./core/state/jotai";
+import { patchFetch, patchVegaLoader } from "./core/static/files";
+import { isStaticNotebook } from "./core/static/static-state";
+import { maybeRegisterVSCodeBindings } from "./core/vscode/vscode-bindings";
import type { FileStore } from "./core/wasm/store";
import { notebookFileStore } from "./core/wasm/store";
+import { vegaLoader } from "./plugins/impl/vega/loader";
+import { initializePlugins } from "./plugins/plugins";
+import { ThemeProvider } from "./theme/ThemeProvider";
+import { reportVitals } from "./utils/vitals";
let hasMounted = false;
diff --git a/frontend/src/plugins/core/BadPlugin.tsx b/frontend/src/plugins/core/BadPlugin.tsx
index 3cfd00200b..07c62448a7 100644
--- a/frontend/src/plugins/core/BadPlugin.tsx
+++ b/frontend/src/plugins/core/BadPlugin.tsx
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ZodError } from "zod";
-import { Alert } from "../../components/ui/alert";
-import { AlertTitle } from "../../components/ui/alert";
+
import {
Accordion,
+ AccordionContent,
AccordionItem,
AccordionTrigger,
- AccordionContent,
} from "@radix-ui/react-accordion";
-import { JsonOutput } from "@/components/editor/output/JsonOutput";
-import { EmotionCacheProvider } from "@/components/editor/output/EmotionCacheProvider";
import type { JSX } from "react";
+import { ZodError } from "zod";
+import { EmotionCacheProvider } from "@/components/editor/output/EmotionCacheProvider";
+import { JsonOutput } from "@/components/editor/output/JsonOutput";
+import { Alert, AlertTitle } from "../../components/ui/alert";
interface Props {
error: ZodError | Error;
diff --git a/frontend/src/plugins/core/RenderHTML.tsx b/frontend/src/plugins/core/RenderHTML.tsx
index 9d298b8616..16b2133693 100644
--- a/frontend/src/plugins/core/RenderHTML.tsx
+++ b/frontend/src/plugins/core/RenderHTML.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { CopyClipboardIcon } from "@/components/icons/copy-icon";
+
import parse, {
+ type DOMNode,
Element,
type HTMLReactParserOptions,
- type DOMNode,
} from "html-react-parser";
-import React, { useId, type ReactNode, type JSX } from "react";
+import React, { type JSX, type ReactNode, useId } from "react";
+import { CopyClipboardIcon } from "@/components/icons/copy-icon";
type ReplacementFn = NonNullable<HTMLReactParserOptions["replace"]>;
type TransformFn = NonNullable<HTMLReactParserOptions["transform"]>;
diff --git a/frontend/src/plugins/core/builder.ts b/frontend/src/plugins/core/builder.ts
index 2a45147759..739b79fc08 100644
--- a/frontend/src/plugins/core/builder.ts
+++ b/frontend/src/plugins/core/builder.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { JSX } from "react";
import type { ZodType, ZodTypeDef } from "zod";
-import type { IPluginProps, IPlugin } from "../types";
+import type { IPlugin, IPluginProps } from "../types";
import type { FunctionSchemas, PluginFunctions } from "./rpc";
-import type { JSX } from "react";
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/registerReactComponent.tsx b/frontend/src/plugins/core/registerReactComponent.tsx
index fed5cf326b..2075c42084 100644
--- a/frontend/src/plugins/core/registerReactComponent.tsx
+++ b/frontend/src/plugins/core/registerReactComponent.tsx
@@ -9,6 +9,7 @@
*/
import React, {
createRef,
+ type JSX,
type ReactNode,
type SetStateAction,
Suspense,
@@ -16,37 +17,35 @@ import React, {
useImperativeHandle,
useMemo,
useState,
- type JSX,
} from "react";
import ReactDOM, { type Root } from "react-dom/client";
-
+import useEvent from "react-use-event-hook";
+import type { ZodSchema } from "zod";
import { createInputEvent, MarimoValueUpdateEvent } from "@/core/dom/events";
+import { getUIElementObjectId } from "@/core/dom/ui-element";
+import { UIElementRegistry } from "@/core/dom/uiregistry";
+import { FUNCTIONS_REGISTRY } from "@/core/functions/FunctionRegistry";
+import {
+ type HTMLElementNotDerivedFromRef,
+ useEventListener,
+} from "@/hooks/useEventListener";
+import { StyleNamespace } from "@/theme/namespace";
+import { useTheme } from "@/theme/useTheme";
+import { Functions } from "@/utils/functions";
+import { shallowCompare } from "@/utils/shallow-compare";
import { defineCustomElement } from "../../core/dom/defineCustomElement";
import {
parseAttrValue,
parseDataset,
parseInitialValue,
} from "../../core/dom/htmlUtils";
-import type { IPlugin } from "../types";
+import { invariant } from "../../utils/invariant";
+import { Logger } from "../../utils/Logger";
import { Objects } from "../../utils/objects";
+import type { IPlugin } from "../types";
import { renderError } from "./BadPlugin";
import { renderHTML } from "./RenderHTML";
-import { invariant } from "../../utils/invariant";
-import { Logger } from "../../utils/Logger";
-import { useTheme } from "@/theme/useTheme";
-import { FUNCTIONS_REGISTRY } from "@/core/functions/FunctionRegistry";
-import { getUIElementObjectId } from "@/core/dom/ui-element";
import type { PluginFunctions } from "./rpc";
-import type { ZodSchema } from "zod";
-import useEvent from "react-use-event-hook";
-import { Functions } from "@/utils/functions";
-import { StyleNamespace } from "@/theme/namespace";
-import { UIElementRegistry } from "@/core/dom/uiregistry";
-import {
- type HTMLElementNotDerivedFromRef,
- useEventListener,
-} from "@/hooks/useEventListener";
-import { shallowCompare } from "@/utils/shallow-compare";
export interface PluginSlotHandle {
/**
diff --git a/frontend/src/plugins/core/sidebar-element.tsx b/frontend/src/plugins/core/sidebar-element.tsx
index 85e5832197..01d3c0f20c 100644
--- a/frontend/src/plugins/core/sidebar-element.tsx
+++ b/frontend/src/plugins/core/sidebar-element.tsx
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { init } from "@paralleldrive/cuid2";
+import { sidebarAtom } from "@/components/editor/renderers/vertical-layout/sidebar/state";
import { defineCustomElement } from "@/core/dom/defineCustomElement";
-import { renderHTML } from "./RenderHTML";
import { SlotNames, slotsController } from "@/core/slots/slots";
-import { init } from "@paralleldrive/cuid2";
import { store } from "@/core/state/jotai";
-import { sidebarAtom } from "@/components/editor/renderers/vertical-layout/sidebar/state";
import { Logger } from "@/utils/Logger";
+import { renderHTML } from "./RenderHTML";
const createId = init({ length: 6 });
diff --git a/frontend/src/plugins/impl/ButtonPlugin.tsx b/frontend/src/plugins/impl/ButtonPlugin.tsx
index b37603f5cd..c2657d9f96 100644
--- a/frontend/src/plugins/impl/ButtonPlugin.tsx
+++ b/frontend/src/plugins/impl/ButtonPlugin.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps } from "../types";
+import type { JSX } from "react";
+import { z } from "zod";
+import { KeyboardHotkeys } from "@/components/shortcuts/renderShortcut";
+import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { cn } from "@/utils/cn";
import { Button } from "../../components/ui/button";
import { renderHTML } from "../core/RenderHTML";
+import type { IPlugin, IPluginProps } from "../types";
import { type Intent, zodIntent } from "./common/intent";
-import { cn } from "@/utils/cn";
-import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
-import { KeyboardHotkeys } from "@/components/shortcuts/renderShortcut";
-import type { JSX } from "react";
interface Data {
label: string;
diff --git a/frontend/src/plugins/impl/CheckboxPlugin.tsx b/frontend/src/plugins/impl/CheckboxPlugin.tsx
index b97edc6096..ebc837e601 100644
--- a/frontend/src/plugins/impl/CheckboxPlugin.tsx
+++ b/frontend/src/plugins/impl/CheckboxPlugin.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, type JSX } from "react";
-import { z } from "zod";
-import type { IPlugin, IPluginProps } from "../types";
-import { Checkbox } from "../../components/ui/checkbox";
import type { CheckedState } from "@radix-ui/react-checkbox";
+import { type JSX, useId } from "react";
+import { z } from "zod";
+import { Checkbox } from "../../components/ui/checkbox";
+import type { IPlugin, IPluginProps } from "../types";
import { Labeled } from "./common/labeled";
type T = boolean;
diff --git a/frontend/src/plugins/impl/CodeEditorPlugin.tsx b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
index e0c7ea4ac8..f515a11129 100644
--- a/frontend/src/plugins/impl/CodeEditorPlugin.tsx
+++ b/frontend/src/plugins/impl/CodeEditorPlugin.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { Labeled } from "./common/labeled";
-import { type Theme, useTheme } from "@/theme/useTheme";
-import { LazyAnyLanguageCodeMirror } from "./code/LazyAnyLanguageCodeMirror";
-import { TooltipProvider } from "@/components/ui/tooltip";
-import { useState, useMemo, useEffect, type JSX } from "react";
-import { useDebounceControlledState } from "@/hooks/useDebounce";
import { EditorView } from "@codemirror/view";
+import { type JSX, useEffect, useMemo, useState } from "react";
import useEvent from "react-use-event-hook";
+import { z } from "zod";
+import { TooltipProvider } from "@/components/ui/tooltip";
+import { useDebounceControlledState } from "@/hooks/useDebounce";
+import { type Theme, useTheme } from "@/theme/useTheme";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { LazyAnyLanguageCodeMirror } from "./code/LazyAnyLanguageCodeMirror";
+import { Labeled } from "./common/labeled";
type T = string;
diff --git a/frontend/src/plugins/impl/DataEditorPlugin.tsx b/frontend/src/plugins/impl/DataEditorPlugin.tsx
index 5ce0719fc3..09ee69e977 100644
--- a/frontend/src/plugins/impl/DataEditorPlugin.tsx
+++ b/frontend/src/plugins/impl/DataEditorPlugin.tsx
@@ -1,20 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import { createPlugin } from "../core/builder";
+
import { TooltipProvider } from "@radix-ui/react-tooltip";
-import type { DataEditorProps } from "./data-editor/data-editor";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { vegaLoadData } from "./vega/loader";
-import type { Setter } from "../types";
+import agGridCss from "ag-grid-community/styles/ag-grid.css?inline";
+import agThemeCss from "ag-grid-community/styles/ag-theme-quartz.css?inline";
+import React from "react";
+import { z } from "zod";
import { LoadingTable } from "@/components/data-table/loading-table";
+import { toFieldTypes } from "@/components/data-table/types";
import { Alert, AlertTitle } from "@/components/ui/alert";
import { DelayMount } from "@/components/utils/delay-mount";
-import React from "react";
-import gridCss from "./data-editor/grid.css?inline";
-import agGridCss from "ag-grid-community/styles/ag-grid.css?inline";
-import agThemeCss from "ag-grid-community/styles/ag-theme-quartz.css?inline";
import { DATA_TYPES } from "@/core/kernel/messages";
-import { toFieldTypes } from "@/components/data-table/types";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { createPlugin } from "../core/builder";
+import type { Setter } from "../types";
+import type { DataEditorProps } from "./data-editor/data-editor";
+import gridCss from "./data-editor/grid.css?inline";
+import { vegaLoadData } from "./vega/loader";
import { getVegaFieldTypes } from "./vega/utils";
type CsvURL = string;
diff --git a/frontend/src/plugins/impl/DataTablePlugin.tsx b/frontend/src/plugins/impl/DataTablePlugin.tsx
index 9eec03dc3d..fb90003fc6 100644
--- a/frontend/src/plugins/impl/DataTablePlugin.tsx
+++ b/frontend/src/plugins/impl/DataTablePlugin.tsx
@@ -1,29 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { memo, useCallback, useEffect, useId, useMemo, useState } from "react";
-import { z } from "zod";
-import { DataTable } from "../../components/data-table/data-table";
-import {
- generateColumns,
- inferFieldTypes,
-} from "../../components/data-table/columns";
-import { Labeled } from "./common/labeled";
-import { Alert, AlertTitle } from "@/components/ui/alert";
-import { rpc } from "../core/rpc";
-import { createPlugin } from "../core/builder";
-import { Banner } from "./common/error-banner";
-import { ColumnChartSpecModel } from "@/components/data-table/chart-spec-model";
-import { ColumnChartContext } from "@/components/data-table/column-summary";
-import { Logger } from "@/utils/Logger";
-import {
- type DataTableSelection,
- toFieldTypes,
- type ColumnHeaderStats,
- type FieldTypesWithExternalType,
- type TooManyRows,
- TOO_MANY_ROWS,
- type ColumnName,
-} from "@/components/data-table/types";
+import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
+import { TooltipProvider } from "@radix-ui/react-tooltip";
import type {
ColumnFiltersState,
OnChangeFn,
@@ -31,41 +9,70 @@ import type {
RowSelectionState,
SortingState,
} from "@tanstack/react-table";
+import { Provider } from "jotai";
+import { Table2Icon } from "lucide-react";
+import type { JSX } from "react";
+/* Copyright 2024 Marimo. All rights reserved. */
+import React, {
+ memo,
+ useCallback,
+ useEffect,
+ useId,
+ useMemo,
+ useState,
+} from "react";
import useEvent from "react-use-event-hook";
-import { Functions } from "@/utils/functions";
-import { ConditionSchema, type ConditionType } from "./data-frames/schema";
-import React from "react";
-import { TooltipProvider } from "@radix-ui/react-tooltip";
-import { Arrays } from "@/utils/arrays";
-import { LoadingTable } from "@/components/data-table/loading-table";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
-import { DelayMount } from "@/components/utils/delay-mount";
-import { DATA_TYPES } from "@/core/kernel/messages";
-import { useEffectSkipFirstRender } from "@/hooks/useEffectSkipFirstRender";
+import { z } from "zod";
import type { CellSelectionState } from "@/components/data-table/cell-selection/types";
import type { CellStyleState } from "@/components/data-table/cell-styling/types";
-import { Button } from "@/components/ui/button";
-import { Table2Icon } from "lucide-react";
+import { ColumnChartSpecModel } from "@/components/data-table/chart-spec-model";
import { TablePanel } from "@/components/data-table/charts/charts";
-import { getFeatureFlag } from "@/core/config/feature-flag";
+import { hasChart } from "@/components/data-table/charts/storage";
+import { ColumnExplorerPanel } from "@/components/data-table/column-explorer-panel/column-explorer";
+import { ColumnChartContext } from "@/components/data-table/column-summary";
import {
- filterToFilterCondition,
type ColumnFilterValue,
+ filterToFilterCondition,
} from "@/components/data-table/filters";
-import { isStaticNotebook } from "@/core/static/static-state";
-import { Provider as SlotzProvider } from "@marimo-team/react-slotz";
+import { usePanelOwnership } from "@/components/data-table/hooks/use-panel-ownership";
+import { LoadingTable } from "@/components/data-table/loading-table";
+import { RowViewerPanel } from "@/components/data-table/row-viewer-panel/row-viewer";
+import {
+ type ColumnHeaderStats,
+ type ColumnName,
+ type DataTableSelection,
+ type FieldTypesWithExternalType,
+ TOO_MANY_ROWS,
+ type TooManyRows,
+ toFieldTypes,
+} from "@/components/data-table/types";
+import { loadTableData } from "@/components/data-table/utils";
+import { ContextAwarePanelItem } from "@/components/editor/chrome/panels/context-aware-panel/context-aware-panel";
+import { Alert, AlertTitle } from "@/components/ui/alert";
+import { Button } from "@/components/ui/button";
+import { DelayMount } from "@/components/utils/delay-mount";
import { type CellId, findCellId } from "@/core/cells/ids";
+import { getFeatureFlag } from "@/core/config/feature-flag";
+import { DATA_TYPES } from "@/core/kernel/messages";
import { slotsController } from "@/core/slots/slots";
-import { ContextAwarePanelItem } from "@/components/editor/chrome/panels/context-aware-panel/context-aware-panel";
-import { RowViewerPanel } from "@/components/data-table/row-viewer-panel/row-viewer";
-import { usePanelOwnership } from "@/components/data-table/hooks/use-panel-ownership";
-import { Provider } from "jotai";
import { store } from "@/core/state/jotai";
-import { loadTableData } from "@/components/data-table/utils";
-import { hasChart } from "@/components/data-table/charts/storage";
-import { ColumnExplorerPanel } from "@/components/data-table/column-explorer-panel/column-explorer";
-import type { JSX } from "react";
+import { isStaticNotebook } from "@/core/static/static-state";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
+import { useEffectSkipFirstRender } from "@/hooks/useEffectSkipFirstRender";
+import { Arrays } from "@/utils/arrays";
+import { Functions } from "@/utils/functions";
+import { Logger } from "@/utils/Logger";
+import {
+ generateColumns,
+ inferFieldTypes,
+} from "../../components/data-table/columns";
+import { DataTable } from "../../components/data-table/data-table";
+import { createPlugin } from "../core/builder";
+import { rpc } from "../core/rpc";
+import { Banner } from "./common/error-banner";
+import { Labeled } from "./common/labeled";
+import { ConditionSchema, type ConditionType } from "./data-frames/schema";
type CsvURL = string;
export type TableData<T> = T[] | CsvURL;
diff --git a/frontend/src/plugins/impl/DatePickerPlugin.tsx b/frontend/src/plugins/impl/DatePickerPlugin.tsx
index 8f9cea876d..9e1338808b 100644
--- a/frontend/src/plugins/impl/DatePickerPlugin.tsx
+++ b/frontend/src/plugins/impl/DatePickerPlugin.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { DatePicker } from "@/components/ui/date-picker";
import { type CalendarDate, parseDate } from "@internationalized/date";
-import { Labeled } from "./common/labeled";
import type { JSX } from "react";
+import { z } from "zod";
+import { DatePicker } from "@/components/ui/date-picker";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = string;
diff --git a/frontend/src/plugins/impl/DateRangePlugin.tsx b/frontend/src/plugins/impl/DateRangePlugin.tsx
index 3362e99563..a792b1a6a0 100644
--- a/frontend/src/plugins/impl/DateRangePlugin.tsx
+++ b/frontend/src/plugins/impl/DateRangePlugin.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { DateRangePicker } from "@/components/ui/date-picker";
import { type CalendarDate, parseDate } from "@internationalized/date";
-import { Labeled } from "./common/labeled";
import type { JSX } from "react";
+import { z } from "zod";
+import { DateRangePicker } from "@/components/ui/date-picker";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = [string, string];
diff --git a/frontend/src/plugins/impl/DateTimePickerPlugin.tsx b/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
index 5cbf360d93..78406f86ba 100644
--- a/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
+++ b/frontend/src/plugins/impl/DateTimePickerPlugin.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { DatePicker } from "@/components/ui/date-picker";
import { type CalendarDateTime, parseDateTime } from "@internationalized/date";
-import { Labeled } from "./common/labeled";
import type { JSX } from "react";
+import { z } from "zod";
+import { DatePicker } from "@/components/ui/date-picker";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = string;
diff --git a/frontend/src/plugins/impl/DictPlugin.tsx b/frontend/src/plugins/impl/DictPlugin.tsx
index 1722b03d73..7ef0af1e4f 100644
--- a/frontend/src/plugins/impl/DictPlugin.tsx
+++ b/frontend/src/plugins/impl/DictPlugin.tsx
@@ -1,12 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, type JSX } from "react";
+import { type JSX, useEffect } from "react";
import { z } from "zod";
-
-import { getUIElementObjectId } from "../../core/dom/ui-element";
import {
MarimoValueInputEvent,
type MarimoValueInputEventType,
} from "../../core/dom/events";
+import { getUIElementObjectId } from "../../core/dom/ui-element";
import type { IPlugin, IPluginProps, Setter } from "../types";
// key => value updates
diff --git a/frontend/src/plugins/impl/DropdownPlugin.tsx b/frontend/src/plugins/impl/DropdownPlugin.tsx
index 329a595b3e..287a6aed17 100644
--- a/frontend/src/plugins/impl/DropdownPlugin.tsx
+++ b/frontend/src/plugins/impl/DropdownPlugin.tsx
@@ -1,11 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, type JSX } from "react";
+import { type JSX, useId } from "react";
import { z } from "zod";
-
-import type { IPlugin, IPluginProps } from "../types";
import { NativeSelect } from "../../components/ui/native-select";
-import { Labeled } from "./common/labeled";
import { cn } from "../../utils/cn";
+import type { IPlugin, IPluginProps } from "../types";
+import { Labeled } from "./common/labeled";
import { SearchableSelect } from "./SearchableSelect";
interface Data {
diff --git a/frontend/src/plugins/impl/FileBrowserPlugin.tsx b/frontend/src/plugins/impl/FileBrowserPlugin.tsx
index bfb73cbafb..fa24910469 100644
--- a/frontend/src/plugins/impl/FileBrowserPlugin.tsx
+++ b/frontend/src/plugins/impl/FileBrowserPlugin.tsx
@@ -1,28 +1,29 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { CornerLeftUp } from "lucide-react";
+import { type JSX, useState } from "react";
import { z } from "zod";
-import { Table, TableCell, TableRow } from "@/components/ui/table";
-import { createPlugin } from "../core/builder";
-import { useState, type JSX } from "react";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { rpc } from "../core/rpc";
-import { toast } from "@/components/ui/use-toast";
-import { NativeSelect } from "@/components/ui/native-select";
import {
FILE_TYPE_ICONS,
type FileType,
guessFileType,
} from "@/components/editor/file-tree/types";
-import { renderHTML } from "../core/RenderHTML";
-import { type FilePath, PathBuilder, Paths } from "@/utils/paths";
-import { CornerLeftUp } from "lucide-react";
-import { Logger } from "@/utils/Logger";
import { Button } from "@/components/ui/button";
import { Checkbox } from "@/components/ui/checkbox";
-import { cn } from "@/utils/cn";
import { Label } from "@/components/ui/label";
-import { PluralWords } from "@/utils/pluralize";
+import { NativeSelect } from "@/components/ui/native-select";
+import { Table, TableCell, TableRow } from "@/components/ui/table";
+import { toast } from "@/components/ui/use-toast";
+import { useAsyncData } from "@/hooks/useAsyncData";
import { useInternalStateWithSync } from "@/hooks/useInternalStateWithSync";
+import { cn } from "@/utils/cn";
+import { Logger } from "@/utils/Logger";
+import { type FilePath, PathBuilder, Paths } from "@/utils/paths";
import { getProtocolAndParentDirectories } from "@/utils/pathUtils";
+import { PluralWords } from "@/utils/pluralize";
+import { createPlugin } from "../core/builder";
+import { renderHTML } from "../core/RenderHTML";
+import { rpc } from "../core/rpc";
/**
* Arguments for a file browser component.
diff --git a/frontend/src/plugins/impl/FileUploadPlugin.tsx b/frontend/src/plugins/impl/FileUploadPlugin.tsx
index 4b7570599d..6f2d02fd77 100644
--- a/frontend/src/plugins/impl/FileUploadPlugin.tsx
+++ b/frontend/src/plugins/impl/FileUploadPlugin.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import { useDropzone } from "react-dropzone";
-import { Upload, MousePointerSquareDashedIcon } from "lucide-react";
+import { MousePointerSquareDashedIcon, Upload } from "lucide-react";
+import type { JSX } from "react";
+import { useDropzone } from "react-dropzone";
+import { z } from "zod";
+import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { toast } from "@/components/ui/use-toast";
import { cn } from "@/utils/cn";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { filesToBase64 } from "../../utils/fileToBase64";
+import { Logger } from "@/utils/Logger";
import { buttonVariants } from "../../components/ui/button";
+import { filesToBase64 } from "../../utils/fileToBase64";
import { renderHTML } from "../core/RenderHTML";
-import { toast } from "@/components/ui/use-toast";
-import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
-import { Logger } from "@/utils/Logger";
-import type { JSX } from "react";
+import type { IPlugin, IPluginProps, Setter } from "../types";
type FileUploadType = "button" | "area";
@@ -73,7 +73,7 @@ function groupFileTypesByMIMEType(extensions: string[]) {
const filesByMIMEType: Record<string, string[]> = {};
const appendExt = (mimetype: string, extension: string) => {
- if (Object.hasOwnProperty.call(filesByMIMEType, mimetype)) {
+ if (Object.hasOwn(filesByMIMEType, mimetype)) {
filesByMIMEType[mimetype].push(extension);
} else {
filesByMIMEType[mimetype] = [extension];
diff --git a/frontend/src/plugins/impl/FormPlugin.tsx b/frontend/src/plugins/impl/FormPlugin.tsx
index a69aa4a901..fa3628ac90 100644
--- a/frontend/src/plugins/impl/FormPlugin.tsx
+++ b/frontend/src/plugins/impl/FormPlugin.tsx
@@ -1,21 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useRef, useState, type JSX } from "react";
-import { z } from "zod";
-import { getUIElementObjectId, isUIElement } from "../../core/dom/ui-element";
+import { Loader2Icon } from "lucide-react";
+import { type JSX, useEffect, useRef, useState } from "react";
+import { z } from "zod";
+import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
import {
MarimoValueInputEvent,
type MarimoValueInputEventType,
} from "@/core/dom/events";
-import type { Setter } from "../types";
-import { Button } from "../../components/ui/button";
import { UI_ELEMENT_REGISTRY } from "@/core/dom/uiregistry";
+import { Button } from "../../components/ui/button";
+import { getUIElementObjectId, isUIElement } from "../../core/dom/ui-element";
import { cn } from "../../utils/cn";
-import { renderHTML } from "../core/RenderHTML";
-import { Loader2Icon } from "lucide-react";
-import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
import { createPlugin } from "../core/builder";
+import { renderHTML } from "../core/RenderHTML";
import { rpc } from "../core/rpc";
+import type { Setter } from "../types";
import { Banner } from "./common/error-banner";
type T = unknown;
diff --git a/frontend/src/plugins/impl/MicrophonePlugin.tsx b/frontend/src/plugins/impl/MicrophonePlugin.tsx
index 1b0799543f..ba0f370c97 100644
--- a/frontend/src/plugins/impl/MicrophonePlugin.tsx
+++ b/frontend/src/plugins/impl/MicrophonePlugin.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps } from "@/plugins/types";
-import { Labeled } from "./common/labeled";
-import { useAudioRecorder } from "@/hooks/useAudioRecorder";
+import type { JSX } from "react";
+import { z } from "zod";
import { AudioRecorder } from "@/components/audio/audio-recorder";
+import { useAudioRecorder } from "@/hooks/useAudioRecorder";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { blobToBase64 } from "@/utils/fileToBase64";
-import type { JSX } from "react";
+import { Labeled } from "./common/labeled";
/**
* Base64 encoded audio file.
diff --git a/frontend/src/plugins/impl/MultiselectPlugin.tsx b/frontend/src/plugins/impl/MultiselectPlugin.tsx
index c889e64954..0424679f5f 100644
--- a/frontend/src/plugins/impl/MultiselectPlugin.tsx
+++ b/frontend/src/plugins/impl/MultiselectPlugin.tsx
@@ -1,13 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, useMemo, useState, type JSX } from "react";
+import { type JSX, useId, useMemo, useState } from "react";
+import { Virtuoso } from "react-virtuoso";
import { z } from "zod";
-
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { Combobox, ComboboxItem } from "../../components/ui/combobox";
-import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
-import { Virtuoso } from "react-virtuoso";
+import { Combobox, ComboboxItem } from "../../components/ui/combobox";
import { CommandSeparator } from "../../components/ui/command";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
import { multiselectFilterFn } from "./multiselectFilterFn";
interface Data {
diff --git a/frontend/src/plugins/impl/NumberPlugin.tsx b/frontend/src/plugins/impl/NumberPlugin.tsx
index e331ac8a13..6c6e98116c 100644
--- a/frontend/src/plugins/impl/NumberPlugin.tsx
+++ b/frontend/src/plugins/impl/NumberPlugin.tsx
@@ -1,12 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, type JSX } from "react";
+import { type JSX, useId } from "react";
import { z } from "zod";
-
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { Labeled } from "./common/labeled";
+import { NumberField } from "@/components/ui/number-field";
import { useDebounceControlledState } from "@/hooks/useDebounce";
import { cn } from "@/utils/cn";
-import { NumberField } from "@/components/ui/number-field";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = number;
diff --git a/frontend/src/plugins/impl/RadioPlugin.tsx b/frontend/src/plugins/impl/RadioPlugin.tsx
index 47d2665828..25609570cf 100644
--- a/frontend/src/plugins/impl/RadioPlugin.tsx
+++ b/frontend/src/plugins/impl/RadioPlugin.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, type JSX } from "react";
+import { type JSX, useId } from "react";
import { z } from "zod";
import { Label } from "@/components/ui/label";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import type { IPlugin, IPluginProps } from "@/plugins/types";
-import { Labeled } from "./common/labeled";
import { cn } from "@/utils/cn";
+import { Labeled } from "./common/labeled";
/**
* Arguments for a radio group
diff --git a/frontend/src/plugins/impl/RangeSliderPlugin.tsx b/frontend/src/plugins/impl/RangeSliderPlugin.tsx
index 124ddd854b..616625406e 100644
--- a/frontend/src/plugins/impl/RangeSliderPlugin.tsx
+++ b/frontend/src/plugins/impl/RangeSliderPlugin.tsx
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useId, useState, type JSX } from "react";
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { RangeSlider } from "../../components/ui/range-slider";
-import { Labeled } from "./common/labeled";
+import { isEqual } from "lodash-es";
+import { type JSX, useEffect, useId, useState } from "react";
+import { z } from "zod";
import { cn } from "@/utils/cn";
import { prettyScientificNumber } from "@/utils/numbers";
-import { isEqual } from "lodash-es";
+import { RangeSlider } from "../../components/ui/range-slider";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = number[];
diff --git a/frontend/src/plugins/impl/RefreshPlugin.tsx b/frontend/src/plugins/impl/RefreshPlugin.tsx
index 5c3ab6a92e..c37408326f 100644
--- a/frontend/src/plugins/impl/RefreshPlugin.tsx
+++ b/frontend/src/plugins/impl/RefreshPlugin.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useState, type JSX } from "react";
-import { z } from "zod";
-import type { IPlugin, IPluginProps } from "@/plugins/types";
import { RefreshCwIcon } from "lucide-react";
+import { type JSX, useEffect, useState } from "react";
import timestring from "timestring";
-import { NativeSelect } from "@/components/ui/native-select";
+import { z } from "zod";
import { Button } from "@/components/ui/button";
-import { useEvent } from "../../hooks/useEvent";
+import { NativeSelect } from "@/components/ui/native-select";
+import type { IPlugin, IPluginProps } from "@/plugins/types";
import { cn } from "@/utils/cn";
+import { useEvent } from "../../hooks/useEvent";
import { Labeled } from "./common/labeled";
type Value = string | number | undefined;
diff --git a/frontend/src/plugins/impl/SearchableSelect.tsx b/frontend/src/plugins/impl/SearchableSelect.tsx
index 64cd70c722..175ed443ea 100644
--- a/frontend/src/plugins/impl/SearchableSelect.tsx
+++ b/frontend/src/plugins/impl/SearchableSelect.tsx
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, useMemo, useState, type JSX } from "react";
+import { type JSX, useId, useMemo, useState } from "react";
+import { Virtuoso } from "react-virtuoso";
import { Combobox, ComboboxItem } from "../../components/ui/combobox";
-import { Labeled } from "./common/labeled";
import { cn } from "../../utils/cn";
+import { Labeled } from "./common/labeled";
import { multiselectFilterFn } from "./multiselectFilterFn";
-import { Virtuoso } from "react-virtuoso";
interface SearchableSelectProps {
options: string[];
diff --git a/frontend/src/plugins/impl/SliderPlugin.tsx b/frontend/src/plugins/impl/SliderPlugin.tsx
index 712d2318ab..54d8a87ee8 100644
--- a/frontend/src/plugins/impl/SliderPlugin.tsx
+++ b/frontend/src/plugins/impl/SliderPlugin.tsx
@@ -1,13 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useEffect, useId, useState, type JSX } from "react";
+import { type JSX, useEffect, useId, useState } from "react";
import { z } from "zod";
-
-import type { IPlugin, IPluginProps, Setter } from "../types";
-import { Slider } from "../../components/ui/slider";
-import { Labeled } from "./common/labeled";
+import { NumberField } from "@/components/ui/number-field";
import { cn } from "@/utils/cn";
import { prettyScientificNumber } from "@/utils/numbers";
-import { NumberField } from "@/components/ui/number-field";
+import { Slider } from "../../components/ui/slider";
+import type { IPlugin, IPluginProps, Setter } from "../types";
+import { Labeled } from "./common/labeled";
type T = number;
diff --git a/frontend/src/plugins/impl/SwitchPlugin.tsx b/frontend/src/plugins/impl/SwitchPlugin.tsx
index bea7b58143..400100bd65 100644
--- a/frontend/src/plugins/impl/SwitchPlugin.tsx
+++ b/frontend/src/plugins/impl/SwitchPlugin.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useId, type JSX } from "react";
+import { type JSX, useId } from "react";
import { z } from "zod";
import { Switch } from "@/components/ui/switch";
diff --git a/frontend/src/plugins/impl/TabsPlugin.tsx b/frontend/src/plugins/impl/TabsPlugin.tsx
index 8766284cb1..8339691678 100644
--- a/frontend/src/plugins/impl/TabsPlugin.tsx
+++ b/frontend/src/plugins/impl/TabsPlugin.tsx
@@ -1,13 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, type JSX } from "react";
-
+import React, { type JSX, type PropsWithChildren } from "react";
+import { z } from "zod";
import {
Tabs,
+ TabsContent,
TabsList,
TabsTrigger,
- TabsContent,
} from "../../components/ui/tabs";
-import { z } from "zod";
import { renderHTML } from "../core/RenderHTML";
import type { IPlugin, IPluginProps } from "../types";
diff --git a/frontend/src/plugins/impl/TextAreaPlugin.tsx b/frontend/src/plugins/impl/TextAreaPlugin.tsx
index 31f5736a37..4f1e6e30c4 100644
--- a/frontend/src/plugins/impl/TextAreaPlugin.tsx
+++ b/frontend/src/plugins/impl/TextAreaPlugin.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
+import type { JSX } from "react";
+import { z } from "zod";
+import { cn } from "@/utils/cn";
import {
DebouncedTextarea,
OnBlurredTextarea,
Textarea,
} from "../../components/ui/textarea";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Labeled } from "./common/labeled";
-import { cn } from "@/utils/cn";
-import type { JSX } from "react";
type T = string;
diff --git a/frontend/src/plugins/impl/TextInputPlugin.tsx b/frontend/src/plugins/impl/TextInputPlugin.tsx
index 8eb8f6f847..3ffb0c456e 100644
--- a/frontend/src/plugins/impl/TextInputPlugin.tsx
+++ b/frontend/src/plugins/impl/TextInputPlugin.tsx
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type { IPlugin, IPluginProps, Setter } from "../types";
+import { AtSignIcon, GlobeIcon, LockIcon } from "lucide-react";
+import { type JSX, useState } from "react";
+import { z } from "zod";
import {
DebouncedInput,
Input,
OnBlurredInput,
} from "../../components/ui/input";
import { cn } from "../../utils/cn";
-import { AtSignIcon, GlobeIcon, LockIcon } from "lucide-react";
-import { useState, type JSX } from "react";
+import type { IPlugin, IPluginProps, Setter } from "../types";
import { Labeled } from "./common/labeled";
type T = string;
diff --git a/frontend/src/plugins/impl/__tests__/DateTimePickerPlugin.test.tsx b/frontend/src/plugins/impl/__tests__/DateTimePickerPlugin.test.tsx
index 517c70d8ec..348b499705 100644
--- a/frontend/src/plugins/impl/__tests__/DateTimePickerPlugin.test.tsx
+++ b/frontend/src/plugins/impl/__tests__/DateTimePickerPlugin.test.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DateTimePickerPlugin } from "../DateTimePickerPlugin";
+
import { render } from "@testing-library/react";
-import { expect, describe, it } from "vitest";
+import { describe, expect, it } from "vitest";
import type { IPluginProps } from "../../types";
+import { DateTimePickerPlugin } from "../DateTimePickerPlugin";
interface DateTimeData {
label: string | null;
diff --git a/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx b/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx
index 37323cd7c8..dc102b5497 100644
--- a/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx
+++ b/frontend/src/plugins/impl/__tests__/DropdownPlugin.test.tsx
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { render, screen, fireEvent } from "@testing-library/react";
-import { describe, it, vi, expect, beforeAll } from "vitest";
-import { DropdownPlugin } from "../DropdownPlugin";
+import { fireEvent, render, screen } from "@testing-library/react";
+import { beforeAll, describe, expect, it, vi } from "vitest";
import type { IPluginProps } from "../../types";
+import { DropdownPlugin } from "../DropdownPlugin";
beforeAll(() => {
global.ResizeObserver = class ResizeObserver {
diff --git a/frontend/src/plugins/impl/__tests__/NumberPlugin.test.tsx b/frontend/src/plugins/impl/__tests__/NumberPlugin.test.tsx
index e5c23fffeb..c7f89d07de 100644
--- a/frontend/src/plugins/impl/__tests__/NumberPlugin.test.tsx
+++ b/frontend/src/plugins/impl/__tests__/NumberPlugin.test.tsx
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
-import { render, act, fireEvent } from "@testing-library/react";
-import { NumberPlugin } from "../NumberPlugin";
+
+import { act, fireEvent, render } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { IPluginProps } from "../../types";
+import { NumberPlugin } from "../NumberPlugin";
describe("NumberPlugin", () => {
beforeEach(() => {
diff --git a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
index d3b4b2e653..44f48e1eeb 100644
--- a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
+++ b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
@@ -1,25 +1,25 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { z } from "zod";
-import type { IPluginProps } from "@/plugins/types";
+import type { AnyWidget, Experimental } from "@anywidget/types";
+import { isEqual } from "lodash-es";
import { useEffect, useMemo, useRef } from "react";
+import { z } from "zod";
+import { MarimoIncomingMessageEvent } from "@/core/dom/events";
+import { asRemoteURL } from "@/core/runtime/config";
import { useAsyncData } from "@/hooks/useAsyncData";
import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
-import { ErrorBanner } from "../common/error-banner";
-import { createPlugin } from "@/plugins/core/builder";
-import { rpc } from "@/plugins/core/rpc";
-import type { AnyWidget, Experimental } from "@anywidget/types";
-import { Logger } from "@/utils/Logger";
import {
type HTMLElementNotDerivedFromRef,
useEventListener,
} from "@/hooks/useEventListener";
-import { MarimoIncomingMessageEvent } from "@/core/dom/events";
+import { createPlugin } from "@/plugins/core/builder";
+import { rpc } from "@/plugins/core/rpc";
+import type { IPluginProps } from "@/plugins/types";
import { updateBufferPaths } from "@/utils/data-views";
-import { Model, MODEL_MANAGER } from "./model";
-import { isEqual } from "lodash-es";
-import { asRemoteURL } from "@/core/runtime/config";
+import { Logger } from "@/utils/Logger";
+import { ErrorBanner } from "../common/error-banner";
+import { MODEL_MANAGER, Model } from "./model";
interface Data {
jsUrl: string;
diff --git a/frontend/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx b/frontend/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx
index 07c144eec6..8bff2e463e 100644
--- a/frontend/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx
+++ b/frontend/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { act, render, waitFor } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import type { UIElementId } from "@/core/cells/ids";
+import { MarimoIncomingMessageEvent } from "@/core/dom/events";
import { getDirtyFields, visibleForTesting } from "../AnyWidgetPlugin";
import { Model } from "../model";
-import { vi, describe, it, expect, beforeEach } from "vitest";
-import { render, act, waitFor } from "@testing-library/react";
-import { MarimoIncomingMessageEvent } from "@/core/dom/events";
-import type { UIElementId } from "@/core/cells/ids";
const { LoadedSlot } = visibleForTesting;
diff --git a/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts b/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts
index 9b554dc83e..9e976accca 100644
--- a/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts
+++ b/frontend/src/plugins/impl/anywidget/__tests__/model.test.ts
@@ -1,20 +1,20 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- describe,
+ afterAll,
+ beforeAll,
beforeEach,
- it,
+ describe,
expect,
+ it,
vi,
- afterAll,
- beforeAll,
} from "vitest";
+import type { Base64String } from "@/utils/json/base64";
import {
- Model,
- handleWidgetMessage,
type AnyWidgetMessage,
+ handleWidgetMessage,
+ Model,
visibleForTesting,
} from "../model";
-import type { Base64String } from "@/utils/json/base64";
const { ModelManager } = visibleForTesting;
diff --git a/frontend/src/plugins/impl/anywidget/model.ts b/frontend/src/plugins/impl/anywidget/model.ts
index e39ee01b57..e3b8ae5b21 100644
--- a/frontend/src/plugins/impl/anywidget/model.ts
+++ b/frontend/src/plugins/impl/anywidget/model.ts
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import type { AnyModel } from "@anywidget/types";
+import { dequal } from "dequal";
+import { debounce } from "lodash-es";
+import { z } from "zod";
import { sendModelValue } from "@/core/network/requests";
import { assertNever } from "@/utils/assertNever";
-import { updateBufferPaths } from "@/utils/data-views";
import { Deferred } from "@/utils/Deferred";
+import { updateBufferPaths } from "@/utils/data-views";
import { throwNotImplemented } from "@/utils/functions";
import type { Base64String } from "@/utils/json/base64";
import { Logger } from "@/utils/Logger";
-import type { AnyModel } from "@anywidget/types";
-import { dequal } from "dequal";
-import { debounce } from "lodash-es";
-import { z } from "zod";
export type EventHandler = (...args: any[]) => void;
diff --git a/frontend/src/plugins/impl/chat/ChatPlugin.tsx b/frontend/src/plugins/impl/chat/ChatPlugin.tsx
index 4ff72ea104..376e52ca05 100644
--- a/frontend/src/plugins/impl/chat/ChatPlugin.tsx
+++ b/frontend/src/plugins/impl/chat/ChatPlugin.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
+import { TooltipProvider } from "@/components/ui/tooltip";
import { createPlugin } from "@/plugins/core/builder";
import { rpc } from "@/plugins/core/rpc";
-import { TooltipProvider } from "@/components/ui/tooltip";
+import { Arrays } from "@/utils/arrays";
import { Chatbot } from "./chat-ui";
import type { ChatMessage, SendMessageRequest } from "./types";
-import { Arrays } from "@/utils/arrays";
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type PluginFunctions = {
diff --git a/frontend/src/plugins/impl/chat/chat-ui.tsx b/frontend/src/plugins/impl/chat/chat-ui.tsx
index af6eefd4f7..dd72060060 100644
--- a/frontend/src/plugins/impl/chat/chat-ui.tsx
+++ b/frontend/src/plugins/impl/chat/chat-ui.tsx
@@ -1,61 +1,61 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Spinner } from "@/components/icons/spinner";
-import { Logger } from "@/utils/Logger";
-import type { Message } from "ai/react";
+
import { useChat } from "@ai-sdk/react";
-import React, { useEffect, useRef } from "react";
-import type {
- ChatMessage,
- ChatConfig,
- ChatAttachment,
- ChatRole,
-} from "./types";
-import { ErrorBanner } from "../common/error-banner";
-import { Button, buttonVariants } from "@/components/ui/button";
+import { ChatBubbleIcon } from "@radix-ui/react-icons";
+import { PopoverAnchor } from "@radix-ui/react-popover";
+import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
+import type { Message } from "ai/react";
+import { startCase } from "lodash-es";
import {
BotMessageSquareIcon,
ClipboardIcon,
+ DownloadIcon,
HelpCircleIcon,
+ PaperclipIcon,
SendIcon,
+ SettingsIcon,
Trash2Icon,
- DownloadIcon,
- PaperclipIcon,
X,
} from "lucide-react";
-import { cn } from "@/utils/cn";
-import { toast } from "@/components/ui/use-toast";
-import { useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
import {
- Popover,
- PopoverContent,
- PopoverTrigger,
-} from "@/components/ui/popover";
-import { Label } from "@/components/ui/label";
-import { SettingsIcon } from "lucide-react";
-import { NumberField } from "@/components/ui/number-field";
-import { Objects } from "@/utils/objects";
+ type AdditionalCompletions,
+ PromptInput,
+} from "@/components/editor/ai/add-cell-with-ai";
+import { Spinner } from "@/components/icons/spinner";
+import { Button, buttonVariants } from "@/components/ui/button";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
-import { Tooltip } from "@/components/ui/tooltip";
-import { startCase } from "lodash-es";
-import { ChatBubbleIcon } from "@radix-ui/react-icons";
-import { renderHTML } from "@/plugins/core/RenderHTML";
import { Input } from "@/components/ui/input";
-import { PopoverAnchor } from "@radix-ui/react-popover";
-import { copyToClipboard } from "@/utils/copy";
+import { Label } from "@/components/ui/label";
+import { NumberField } from "@/components/ui/number-field";
import {
- type AdditionalCompletions,
- PromptInput,
-} from "@/components/editor/ai/add-cell-with-ai";
-import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
-import { useTheme } from "@/theme/useTheme";
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Tooltip } from "@/components/ui/tooltip";
+import { toast } from "@/components/ui/use-toast";
import { moveToEndOfEditor } from "@/core/codemirror/utils";
-import type { PluginFunctions } from "./ChatPlugin";
import { useAsyncData } from "@/hooks/useAsyncData";
+import { renderHTML } from "@/plugins/core/RenderHTML";
+import { useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
+import { copyToClipboard } from "@/utils/copy";
+import { Logger } from "@/utils/Logger";
+import { Objects } from "@/utils/objects";
+import { ErrorBanner } from "../common/error-banner";
+import type { PluginFunctions } from "./ChatPlugin";
+import type {
+ ChatAttachment,
+ ChatConfig,
+ ChatMessage,
+ ChatRole,
+} from "./types";
interface Props extends PluginFunctions {
prompts: string[];
diff --git a/frontend/src/plugins/impl/code/any-language-editor.tsx b/frontend/src/plugins/impl/code/any-language-editor.tsx
index 5a8ac1d33a..a406c413b3 100644
--- a/frontend/src/plugins/impl/code/any-language-editor.tsx
+++ b/frontend/src/plugins/impl/code/any-language-editor.tsx
@@ -1,18 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import {
+ type LanguageName,
+ langs,
+ loadLanguage,
+} from "@uiw/codemirror-extensions-langs";
import ReactCodeMirror, {
type Extension,
type ReactCodeMirrorProps,
} from "@uiw/react-codemirror";
-import {
- loadLanguage,
- langs,
- type LanguageName,
-} from "@uiw/codemirror-extensions-langs";
import React, { useMemo } from "react";
+import { CopyClipboardIcon } from "@/components/icons/copy-icon";
+import type { ResolvedTheme } from "@/theme/useTheme";
import { Logger } from "@/utils/Logger";
import { ErrorBanner } from "../common/error-banner";
-import type { ResolvedTheme } from "@/theme/useTheme";
-import { CopyClipboardIcon } from "@/components/icons/copy-icon";
/**
* A code editor that supports any language.
diff --git a/frontend/src/plugins/impl/common/error-banner.tsx b/frontend/src/plugins/impl/common/error-banner.tsx
index 53f476516f..107accb440 100644
--- a/frontend/src/plugins/impl/common/error-banner.tsx
+++ b/frontend/src/plugins/impl/common/error-banner.tsx
@@ -1,5 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { prettyError } from "@/utils/errors";
+
+import { cva, type VariantProps } from "class-variance-authority";
import { useState } from "react";
import {
AlertDialog,
@@ -10,7 +11,7 @@ import {
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { cn } from "@/utils/cn";
-import { type VariantProps, cva } from "class-variance-authority";
+import { prettyError } from "@/utils/errors";
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 ae7fc3af9a..4294668307 100644
--- a/frontend/src/plugins/impl/common/labeled.tsx
+++ b/frontend/src/plugins/impl/common/labeled.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import React, { type PropsWithChildren } from "react";
import { Label } from "@/components/ui/label";
import { renderHTML } from "@/plugins/core/RenderHTML";
-import React, { type PropsWithChildren } from "react";
import { cn } from "@/utils/cn";
interface Props {
diff --git a/frontend/src/plugins/impl/data-editor/data-editor.tsx b/frontend/src/plugins/impl/data-editor/data-editor.tsx
index a5bfbce596..175797bd28 100644
--- a/frontend/src/plugins/impl/data-editor/data-editor.tsx
+++ b/frontend/src/plugins/impl/data-editor/data-editor.tsx
@@ -1,18 +1,19 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useCallback, useEffect, useMemo, useRef } from "react";
-import { AgGridReact } from "ag-grid-react";
+
import type {
+ CellEditingStoppedEvent,
ColDef,
GridReadyEvent,
- CellEditingStoppedEvent,
RowDataTransaction,
} from "ag-grid-community";
+import { AgGridReact } from "ag-grid-react";
+import { PlusIcon } from "lucide-react";
+import React, { useCallback, useEffect, useMemo, useRef } from "react";
import type { FieldTypesWithExternalType } from "@/components/data-table/types";
-import { cn } from "@/utils/cn";
+import { Button } from "@/components/ui/button";
import { useTheme } from "@/theme/useTheme";
+import { cn } from "@/utils/cn";
import type { DataType } from "../vega/vega-loader";
-import { Button } from "@/components/ui/button";
-import { PlusIcon } from "lucide-react";
export interface DataEditorProps<T> {
data: T[];
diff --git a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
index 965d0c9e38..f452d1b7af 100644
--- a/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
+++ b/frontend/src/plugins/impl/data-explorer/ConnectedDataExplorerComponent.tsx
@@ -1,29 +1,29 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-base-to-string */
import * as cql from "compassql/build/src";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import React, { useMemo, type JSX } from "react";
+import { createStore, Provider, useAtomValue } from "jotai";
+import { ListFilterIcon } from "lucide-react";
+import React, { type JSX, useMemo } from "react";
+import { VegaLite } from "react-vega";
+import type { VegaLiteProps } from "react-vega/lib/VegaLite";
+import { Badge } from "@/components/ui/badge";
+import { Button } from "@/components/ui/button";
import { Tooltip } from "@/components/ui/tooltip";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { useOnMount } from "@/hooks/useLifecycle";
+import { useTheme } from "@/theme/useTheme";
+import { Objects } from "@/utils/objects";
+import { ErrorBanner } from "../common/error-banner";
import { vegaLoadData } from "../vega/loader";
-import { VegaLite } from "react-vega";
-import { ListFilterIcon } from "lucide-react";
+import { ColumnSummary } from "./components/column-summary";
import { QueryForm } from "./components/query-form";
+import type { SpecificEncoding } from "./encoding";
import {
chartSpecAtom,
relatedChartSpecsAtom,
useChartSpecActions,
} from "./state/reducer";
-import { Provider, createStore, useAtomValue } from "jotai";
-import { Button } from "@/components/ui/button";
-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 type { VegaLiteProps } from "react-vega/lib/VegaLite";
-import { useOnMount } from "@/hooks/useLifecycle";
import type { ChartSpec } from "./state/types";
-import { useTheme } from "@/theme/useTheme";
/**
* @param label - a label of the table
diff --git a/frontend/src/plugins/impl/data-explorer/DataExplorerPlugin.tsx b/frontend/src/plugins/impl/data-explorer/DataExplorerPlugin.tsx
index f7a6eb341d..49d10f3dc5 100644
--- a/frontend/src/plugins/impl/data-explorer/DataExplorerPlugin.tsx
+++ b/frontend/src/plugins/impl/data-explorer/DataExplorerPlugin.tsx
@@ -1,11 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
import "../vega/vega.css";
+import React from "react";
import { z } from "zod";
-
-import { createPlugin } from "@/plugins/core/builder";
import { TooltipProvider } from "@/components/ui/tooltip";
-import React from "react";
+import { createPlugin } from "@/plugins/core/builder";
import type { DataExplorerState } from "./ConnectedDataExplorerComponent";
const LazyDataExplorerComponent = React.lazy(
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 78fb48aac5..a7efa20b81 100644
--- a/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx
+++ b/frontend/src/plugins/impl/data-explorer/components/column-summary.tsx
@@ -1,10 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Schema } from "compassql/build/src/schema";
import { BarChartBigIcon } from "lucide-react";
import React, { useState } from "react";
-import { PRIMITIVE_TYPE_ICON } from "./icons";
-import type { Schema } from "compassql/build/src/schema";
import { Button } from "@/components/ui/button";
-import { cn } from "@/utils/cn";
import {
Select,
SelectContent,
@@ -13,6 +12,8 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
+import { cn } from "@/utils/cn";
+import { PRIMITIVE_TYPE_ICON } from "./icons";
interface Props {
schema: Schema;
diff --git a/frontend/src/plugins/impl/data-explorer/components/icons.tsx b/frontend/src/plugins/impl/data-explorer/components/icons.tsx
index e1b61acf3e..5ff7463a57 100644
--- a/frontend/src/plugins/impl/data-explorer/components/icons.tsx
+++ b/frontend/src/plugins/impl/data-explorer/components/icons.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { PrimitiveType } from "compassql/build/src/schema";
import {
- ToggleLeftIcon,
CalendarIcon,
HashIcon,
- TypeIcon,
ListOrderedIcon,
+ ToggleLeftIcon,
+ TypeIcon,
} from "lucide-react";
/**
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 c6e2525911..ab7586db52 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,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-base-to-string */
+
+import { ExpandedType } from "compassql/build/src/query/expandedtype";
import { PrimitiveType, type Schema } from "compassql/build/src/schema";
+import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
+import { useAtomValue } from "jotai";
+import { startCase } from "lodash-es";
+import { FunctionSquareIcon } from "lucide-react";
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 type { EncodingChannel, FieldDefinition } from "../encoding";
import {
Select,
SelectContent,
@@ -17,17 +19,16 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
+import type { EncodingChannel, FieldDefinition } from "../encoding";
import {
MULTI_TEMPORAL_FUNCTIONS,
QUANTITATIVE_FUNCTIONS,
SINGLE_TEMPORAL_FUNCTIONS,
} from "../functions/function";
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, type SpecMark } from "../marks";
-import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
+import { chartSpecAtom, useChartSpecActions } from "../state/reducer";
+import { PRIMITIVE_TYPE_ICON } from "./icons";
interface Props {
schema: Schema;
diff --git a/frontend/src/plugins/impl/data-explorer/encoding.ts b/frontend/src/plugins/impl/data-explorer/encoding.ts
index b702121284..41dc002e75 100644
--- a/frontend/src/plugins/impl/data-explorer/encoding.ts
+++ b/frontend/src/plugins/impl/data-explorer/encoding.ts
@@ -6,14 +6,14 @@ import {
type SHORT_WILDCARD,
type WildcardProperty,
} from "compassql/build/src/wildcard";
+import { invariant } from "@/utils/invariant";
+import { Logger } from "@/utils/Logger";
import {
fromFieldQueryFunctionMixins,
toFieldQueryFunctionMixins,
} from "./functions/function";
-import { invariant } from "@/utils/invariant";
import type { FieldFunction } from "./functions/types";
import { removeUndefined } from "./queries/removeUndefined";
-import { Logger } from "@/utils/Logger";
// 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 6d0f2b4c03..c2db1575fe 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/queries.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/queries.ts
@@ -1,34 +1,35 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { recommend } from "compassql/build/src";
+import type {
+ SpecQueryModel,
+ SpecQueryModelGroup,
+} from "compassql/build/src/model";
import type { Query } from "compassql/build/src/query";
+import { isFieldQuery } from "compassql/build/src/query/encoding";
import type { SpecQuery } from "compassql/build/src/query/spec";
+import { getTopResultTreeItem, isResultTree } from "compassql/build/src/result";
+import type { Schema } from "compassql/build/src/schema";
import { contains } from "vega-lite";
import { NONPOSITION_SCALE_CHANNELS } from "vega-lite/build/src/channel";
+import type { NamedData } from "vega-lite/build/src/data";
+import { type EncodingChannel, fromFieldQuery } from "../encoding";
+import { toSpecQuery } from "../spec";
+import type { ChartSpec } from "../state/types";
import {
- addQuantitativeField,
addCategoricalField,
+ addQuantitativeField,
addTemporalField,
} from "./field-suggestion";
-import { recommend } from "compassql/build/src";
-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 type { NamedData } from "vega-lite/build/src/data";
-import { isFieldQuery } from "compassql/build/src/query/encoding";
-import { type EncodingChannel, fromFieldQuery } from "../encoding";
-import type { ChartSpec } from "../state/types";
-import { hasWildcards, isQueryEmpty } from "./utils";
-import { toSpecQuery } from "../spec";
-import type {
- Result,
- QueryCreator,
- ResultPlot,
PlotFieldInfo,
+ QueryCreator,
+ Result,
ResultingCharts,
+ ResultPlot,
TopLevelFacetedUnitSpec,
} from "./types";
+import { hasWildcards, isQueryEmpty } from "./utils";
// This code is adapted and simplified from https://github.com/vega/voyager
diff --git a/frontend/src/plugins/impl/data-explorer/queries/types.ts b/frontend/src/plugins/impl/data-explorer/queries/types.ts
index 43cdb2166b..5642689476 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/types.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/types.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Query } from "compassql/build/src/query";
import type { VisualizationSpec } from "react-vega";
-import type { FieldDefinition, EncodingChannel } from "../encoding";
import type { NamedData } from "vega-lite/build/src/data";
-import type { TopLevel, FacetedUnitSpec } from "vega-lite/build/src/spec";
+import type { FacetedUnitSpec, TopLevel } from "vega-lite/build/src/spec";
+import type { EncodingChannel, FieldDefinition } from "../encoding";
export interface PlotFieldInfo {
fieldDef: FieldDefinition;
diff --git a/frontend/src/plugins/impl/data-explorer/queries/utils.ts b/frontend/src/plugins/impl/data-explorer/queries/utils.ts
index 6f39c5ce4e..8dcc5863c6 100644
--- a/frontend/src/plugins/impl/data-explorer/queries/utils.ts
+++ b/frontend/src/plugins/impl/data-explorer/queries/utils.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- isValueQuery,
isAutoCountQuery,
+ isValueQuery,
} from "compassql/build/src/query/encoding";
import type { SpecQuery } from "compassql/build/src/query/spec";
import { isWildcard } from "compassql/build/src/wildcard";
diff --git a/frontend/src/plugins/impl/data-explorer/spec.ts b/frontend/src/plugins/impl/data-explorer/spec.ts
index 2c559d42e0..7deba6cea0 100644
--- a/frontend/src/plugins/impl/data-explorer/spec.ts
+++ b/frontend/src/plugins/impl/data-explorer/spec.ts
@@ -2,9 +2,9 @@
import type { EncodingQuery } from "compassql/build/src/query/encoding";
import type { SpecQuery } from "compassql/build/src/query/spec";
import {
+ type EncodingChannel,
type SpecificEncoding,
toFieldQuery,
- type EncodingChannel,
} from "./encoding";
import type { ChartSpec } from "./state/types";
diff --git a/frontend/src/plugins/impl/data-explorer/state/reducer.ts b/frontend/src/plugins/impl/data-explorer/state/reducer.ts
index 9eef91e781..be056ede8f 100644
--- a/frontend/src/plugins/impl/data-explorer/state/reducer.ts
+++ b/frontend/src/plugins/impl/data-explorer/state/reducer.ts
@@ -1,21 +1,22 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { SpecificEncoding } from "../encoding";
-import { createReducerAndAtoms } from "@/utils/createReducer";
-import type { ChartSpec } from "./types";
+
+import type { Schema } from "compassql/build/src/schema";
import { SHORT_WILDCARD } from "compassql/build/src/wildcard";
import { atom } from "jotai";
+import { createReducerAndAtoms } from "@/utils/createReducer";
+import type { SpecificEncoding } from "../encoding";
+import type { SpecMark } from "../marks";
+import { histograms } from "../queries/histograms";
import {
- mainViewResult,
allRelatedViewResults,
+ mainViewResult,
relatedViewResult,
toQuery,
} from "../queries/queries";
-import { isQueryEmpty, isQueryFull, isQuerySpecific } from "../queries/utils";
import { removeUndefined } from "../queries/removeUndefined";
-import { histograms } from "../queries/histograms";
-import type { Schema } from "compassql/build/src/schema";
-import type { SpecMark } from "../marks";
import type { ResultingCharts } from "../queries/types";
+import { isQueryEmpty, isQueryFull, isQuerySpecific } from "../queries/utils";
+import type { ChartSpec } from "./types";
function initialState(): ChartSpec {
return {
diff --git a/frontend/src/plugins/impl/data-explorer/state/types.ts b/frontend/src/plugins/impl/data-explorer/state/types.ts
index 4d820dd98a..b939af52f2 100644
--- a/frontend/src/plugins/impl/data-explorer/state/types.ts
+++ b/frontend/src/plugins/impl/data-explorer/state/types.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { SpecQuery } from "compassql/build/src/query/spec";
import type { Schema } from "compassql/build/src/schema";
import type { SpecificEncoding } from "../encoding";
-import type { SpecQuery } from "compassql/build/src/query/spec";
import type { SpecMark } from "../marks";
export interface ChartSpec {
diff --git a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
index 1365e14649..4f24e1dcbd 100644
--- a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
+++ b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx
@@ -1,29 +1,29 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import {
- ConditionSchema,
- type ConditionType,
- type Transformations,
-} from "./schema";
-import { TransformPanel } from "./panel";
-import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { isEqual } from "lodash-es";
import { Code2Icon, DatabaseIcon, FunctionSquareIcon } from "lucide-react";
-import type { ColumnDataTypes, ColumnId } from "./types";
+import { type JSX, memo, useEffect, useRef, useState } from "react";
+import { z } from "zod";
+import type { FieldTypesWithExternalType } from "@/components/data-table/types";
+import { ReadonlyCode } from "@/components/editor/code/readonly-python-code";
+import { Spinner } from "@/components/icons/spinner";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { DATA_TYPES } from "@/core/kernel/messages";
+import { useAsyncData } from "@/hooks/useAsyncData";
import { createPlugin } from "@/plugins/core/builder";
import { rpc } from "@/plugins/core/rpc";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { LoadingDataTableComponent, TableProviders } from "../DataTablePlugin";
-import { Functions } from "@/utils/functions";
import { Arrays } from "@/utils/arrays";
-import { memo, useEffect, useRef, useState, type JSX } from "react";
+import { Functions } from "@/utils/functions";
import { ErrorBanner } from "../common/error-banner";
+import { LoadingDataTableComponent, TableProviders } from "../DataTablePlugin";
import type { DataType } from "../vega/vega-loader";
-import type { FieldTypesWithExternalType } from "@/components/data-table/types";
-import { Spinner } from "@/components/icons/spinner";
-import { ReadonlyCode } from "@/components/editor/code/readonly-python-code";
-import { isEqual } from "lodash-es";
-import { DATA_TYPES } from "@/core/kernel/messages";
+import { TransformPanel } from "./panel";
+import {
+ ConditionSchema,
+ type ConditionType,
+ type Transformations,
+} from "./schema";
+import type { ColumnDataTypes, ColumnId } from "./types";
type CsvURL = string;
type TableData<T> = T[] | CsvURL;
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 3699807d8d..6d675c099d 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
@@ -1,16 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it } from "vitest";
-import { ZodForm } from "../../../../../components/forms/form";
-import { column_id, column_id_array, TransformTypeSchema } from "../../schema";
-import { render } from "@testing-library/react";
+
import { zodResolver } from "@hookform/resolvers/zod";
+import { render } from "@testing-library/react";
import { useForm } from "react-hook-form";
+import { describe, expect, it } from "vitest";
import type { z } from "zod";
+import { getUnionLiteral } from "@/components/forms/form-utils";
+import { Objects } from "@/utils/objects";
+import { ZodForm } from "../../../../../components/forms/form";
+import { column_id, column_id_array, TransformTypeSchema } from "../../schema";
import type { ColumnId } from "../../types";
import { ColumnInfoContext } from "../context";
import { DATAFRAME_FORM_RENDERERS } from "../renderers";
-import { Objects } from "@/utils/objects";
-import { getUnionLiteral } from "@/components/forms/form-utils";
const ColumnTypes = new Map([
[0 as ColumnId, "str"],
diff --git a/frontend/src/plugins/impl/data-frames/forms/renderers.tsx b/frontend/src/plugins/impl/data-frames/forms/renderers.tsx
index 558e8bb72a..accd0d81b7 100644
--- a/frontend/src/plugins/impl/data-frames/forms/renderers.tsx
+++ b/frontend/src/plugins/impl/data-frames/forms/renderers.tsx
@@ -1,29 +1,32 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import React, { useEffect } from "react";
import {
+ type FieldValues,
type Path,
type UseFormReturn,
- type FieldValues,
useWatch,
} from "react-hook-form";
import { z } from "zod";
-import { renderZodSchema, type FormRenderer } from "@/components/forms/form";
+import { type FormRenderer, renderZodSchema } from "@/components/forms/form";
import { FieldOptions } from "@/components/forms/options";
-import React, { useEffect } from "react";
import {
- ColumnInfoContext,
- ColumnNameContext,
- ColumnFetchValuesContext,
-} from "./context";
+ ensureStringArray,
+ SwitchableMultiSelect,
+ TextAreaMultiSelect,
+} from "@/components/forms/switchable-multi-select";
+import { Combobox, ComboboxItem } from "@/components/ui/combobox";
import {
+ FormControl,
+ FormDescription,
FormField,
FormItem,
FormLabel,
- FormDescription,
- FormControl,
FormMessage,
FormMessageTooltip,
} from "@/components/ui/form";
+import { DebouncedInput } from "@/components/ui/input";
import {
Select,
SelectContent,
@@ -32,20 +35,18 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import { DataTypeIcon } from "./datatype-icon";
-import { Combobox, ComboboxItem } from "@/components/ui/combobox";
import { useAsyncData } from "@/hooks/useAsyncData";
-import {
- SwitchableMultiSelect,
- TextAreaMultiSelect,
- ensureStringArray,
-} from "@/components/forms/switchable-multi-select";
-import { DebouncedInput } from "@/components/ui/input";
import { cn } from "@/utils/cn";
import { Objects } from "@/utils/objects";
import { Strings } from "@/utils/strings";
-import { getOperatorForDtype, getSchemaForOperator } from "../utils/operators";
import type { ColumnId } from "../types";
+import { getOperatorForDtype, getSchemaForOperator } from "../utils/operators";
+import {
+ ColumnFetchValuesContext,
+ ColumnInfoContext,
+ ColumnNameContext,
+} from "./context";
+import { DataTypeIcon } from "./datatype-icon";
export const columnIdRenderer = <T extends FieldValues>(): FormRenderer<
T,
diff --git a/frontend/src/plugins/impl/data-frames/panel.tsx b/frontend/src/plugins/impl/data-frames/panel.tsx
index 753dd1320f..0316f1f0a4 100644
--- a/frontend/src/plugins/impl/data-frames/panel.tsx
+++ b/frontend/src/plugins/impl/data-frames/panel.tsx
@@ -1,56 +1,57 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, useEffect, useMemo } from "react";
-import {
- type TransformType,
- TransformTypeSchema,
- type Transformations,
- TransformationsSchema,
-} from "./schema";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "../../../components/ui/dropdown-menu";
-import { Button } from "../../../components/ui/button";
+
import { zodResolver } from "@hookform/resolvers/zod";
-import { useFieldArray, useForm } from "react-hook-form";
-import type { z } from "zod";
-import { ZodForm } from "../../../components/forms/form";
-import {
- getDefaults,
- getUnionLiteral,
-} from "../../../components/forms/form-utils";
import {
ArrowUpDownIcon,
+ BracketsIcon,
ColumnsIcon,
CombineIcon,
+ CopySlashIcon,
+ FileJsonIcon,
FilterIcon,
FunctionSquareIcon,
GroupIcon,
MousePointerSquareDashedIcon,
- SquareMousePointerIcon,
PencilIcon,
PlusIcon,
ShuffleIcon,
+ SquareMousePointerIcon,
Trash2Icon,
- BracketsIcon,
- FileJsonIcon,
- CopySlashIcon,
} from "lucide-react";
-import { cn } from "../../../utils/cn";
+import React, { type PropsWithChildren, useEffect, useMemo } from "react";
+import { useFieldArray, useForm } from "react-hook-form";
+import useEvent from "react-use-event-hook";
+import type { z } from "zod";
import {
ColumnFetchValuesContext,
ColumnInfoContext,
} from "@/plugins/impl/data-frames/forms/context";
-import useEvent from "react-use-event-hook";
-import type { ColumnDataTypes } from "./types";
-import { getUpdatedColumnTypes } from "./utils/getUpdatedColumnTypes";
import { Strings } from "@/utils/strings";
+import { ZodForm } from "../../../components/forms/form";
+import {
+ getDefaults,
+ getUnionLiteral,
+} from "../../../components/forms/form-utils";
+import { Button } from "../../../components/ui/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuGroup,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "../../../components/ui/dropdown-menu";
+import { cn } from "../../../utils/cn";
import { DATAFRAME_FORM_RENDERERS } from "./forms/renderers";
+import {
+ type Transformations,
+ TransformationsSchema,
+ type TransformType,
+ TransformTypeSchema,
+} from "./schema";
+import type { ColumnDataTypes } from "./types";
+import { getUpdatedColumnTypes } from "./utils/getUpdatedColumnTypes";
interface Props {
columns: ColumnDataTypes;
diff --git a/frontend/src/plugins/impl/data-frames/schema.ts b/frontend/src/plugins/impl/data-frames/schema.ts
index 49f62f96b1..c07e6c07fc 100644
--- a/frontend/src/plugins/impl/data-frames/schema.ts
+++ b/frontend/src/plugins/impl/data-frames/schema.ts
@@ -1,15 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { z } from "zod";
+import { FieldOptions, randomNumber } from "@/components/forms/options";
import {
AGGREGATION_FNS,
type ColumnId,
NUMPY_DTYPES,
} from "@/plugins/impl/data-frames/types";
-import { FieldOptions, randomNumber } from "@/components/forms/options";
-import { z } from "zod";
import {
ALL_OPERATORS,
- type OperatorType,
isConditionValueValid,
+ type OperatorType,
} from "./utils/operators";
export const column_id = z
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 54817f2bd6..e95a612b9d 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 { describe, expect, it } from "vitest";
import type { TransformType } from "../../schema";
import type { ColumnId } from "../../types";
+import { getUpdatedColumnTypes } from "../getUpdatedColumnTypes";
const INITIAL_COLUMN_TYPES = new Map<ColumnId, string>([
["col1" as ColumnId, "str"],
diff --git a/frontend/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts b/frontend/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts
index 7f8f8db324..2e48688b2e 100644
--- a/frontend/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts
+++ b/frontend/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
+import { describe, expect, it } from "vitest";
import {
+ BOOLEAN_OPERATORS,
+ DATE_OPERATORS,
+ DATETIME_OPERATORS,
getOperatorForDtype,
getSchemaForOperator,
isConditionValueValid,
- BOOLEAN_OPERATORS,
- DATE_OPERATORS,
NUMERIC_OPERATORS,
STRING_OPERATORS,
- DATETIME_OPERATORS,
} from "../operators";
describe("getOperatorForDtype", () => {
diff --git a/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts b/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
index 9f53ff5910..fdde7198f8 100644
--- a/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
+++ b/frontend/src/plugins/impl/data-frames/utils/getUpdatedColumnTypes.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { logNever } from "@/utils/assertNever";
+import { Maps } from "@/utils/maps";
import type { TransformType } from "../schema";
import type { ColumnDataTypes } from "../types";
-import { Maps } from "@/utils/maps";
/**
* Given a list of transforms, return the updated column names/types.
diff --git a/frontend/src/plugins/impl/data-frames/utils/operators.ts b/frontend/src/plugins/impl/data-frames/utils/operators.ts
index c8d2f508d1..f019ecbe88 100644
--- a/frontend/src/plugins/impl/data-frames/utils/operators.ts
+++ b/frontend/src/plugins/impl/data-frames/utils/operators.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { z } from "zod";
-import { FieldOptions } from "../../../../components/forms/options";
import type { DataType } from "@/core/kernel/messages";
+import { FieldOptions } from "../../../../components/forms/options";
const Schema = {
number: z.coerce.number().describe(FieldOptions.of({ label: "Value" })),
diff --git a/frontend/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx b/frontend/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx
index da7f22ca8c..95ea196bea 100644
--- a/frontend/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx
+++ b/frontend/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React from "react";
+
import { ImgComparisonSlider } from "@img-comparison-slider/react";
+import React from "react";
export interface ImageComparisonData {
beforeSrc: string;
diff --git a/frontend/src/plugins/impl/panel/PanelPlugin.tsx b/frontend/src/plugins/impl/panel/PanelPlugin.tsx
index 3684c69c29..99171fd446 100644
--- a/frontend/src/plugins/impl/panel/PanelPlugin.tsx
+++ b/frontend/src/plugins/impl/panel/PanelPlugin.tsx
@@ -1,18 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { z } from "zod";
-import type { IPluginProps } from "@/plugins/types";
+import { useEvent } from "@dnd-kit/utilities";
import { useEffect, useRef, useState } from "react";
-import { createPlugin } from "@/plugins/core/builder";
-import { rpc } from "@/plugins/core/rpc";
+import { z } from "zod";
+import { MarimoIncomingMessageEvent } from "@/core/dom/events";
import {
type HTMLElementNotDerivedFromRef,
useEventListener,
} from "@/hooks/useEventListener";
-import { MarimoIncomingMessageEvent } from "@/core/dom/events";
-import { MessageSchema, extractBuffers, EventBuffer } from "./utils";
-import { useEvent } from "@dnd-kit/utilities";
+import { createPlugin } from "@/plugins/core/builder";
+import { rpc } from "@/plugins/core/rpc";
+import type { IPluginProps } from "@/plugins/types";
+import { EventBuffer, extractBuffers, MessageSchema } from "./utils";
interface BokehDocument {
create_json_patch: (events: unknown[]) => unknown;
@@ -76,9 +76,10 @@ type T = Record<string, unknown>;
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
type PluginFunctions = {
- send_to_widget: <T>(req: { message?: any; buffers?: any }) => Promise<
- null | undefined
- >;
+ send_to_widget: <T>(req: {
+ message?: any;
+ buffers?: any;
+ }) => Promise<null | undefined>;
};
export const PanelPlugin = createPlugin<T>("marimo-panel")
diff --git a/frontend/src/plugins/impl/panel/__tests__/utils.test.ts b/frontend/src/plugins/impl/panel/__tests__/utils.test.ts
index d1f2781280..d364029360 100644
--- a/frontend/src/plugins/impl/panel/__tests__/utils.test.ts
+++ b/frontend/src/plugins/impl/panel/__tests__/utils.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi, beforeEach } from "vitest";
-import { MessageSchema, extractBuffers, EventBuffer } from "../utils";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { EventBuffer, extractBuffers, MessageSchema } from "../utils";
describe("MessageSchema", () => {
it("should validate ACK message", () => {
diff --git a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
index 3aa28f1761..b40a8ceb1d 100644
--- a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
+++ b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx
@@ -1,22 +1,21 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-
-import type { IPlugin, IPluginProps, Setter } from "@/plugins/types";
import type { Figure } from "react-plotly.js";
+import { z } from "zod";
+import type { IPlugin, IPluginProps, Setter } from "@/plugins/types";
import { Logger } from "@/utils/Logger";
import "./plotly.css";
import "./mapbox.css";
-import { lazy, memo, useEffect, useMemo, useState, type JSX } from "react";
-import useEvent from "react-use-event-hook";
-import { type PlotlyTemplateParser, createParser } from "./parse-from-template";
-import { Objects } from "@/utils/objects";
+import { usePrevious } from "@uidotdev/usehooks";
import { isEqual, pick, set } from "lodash-es";
+import { type JSX, lazy, memo, useEffect, useMemo, useState } from "react";
+import useEvent from "react-use-event-hook";
import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
-import { usePrevious } from "@uidotdev/usehooks";
-import { Arrays } from "@/utils/arrays";
import { useScript } from "@/hooks/useScript";
+import { Arrays } from "@/utils/arrays";
+import { Objects } from "@/utils/objects";
+import { createParser, type PlotlyTemplateParser } from "./parse-from-template";
interface Data {
figure: Figure;
diff --git a/frontend/src/plugins/impl/plotly/plotly.css b/frontend/src/plugins/impl/plotly/plotly.css
index 966febc2cc..bca9ed112b 100644
--- a/frontend/src/plugins/impl/plotly/plotly.css
+++ b/frontend/src/plugins/impl/plotly/plotly.css
@@ -98,7 +98,6 @@
cursor: ne-resize;
}
.js-plotly-plot .plotly .cursor-grab {
- cursor: -webkit-grab;
cursor: grab;
}
.js-plotly-plot .plotly .modebar {
@@ -254,7 +253,6 @@
border: 1px solid #fff;
z-index: 3000;
margin: 0;
- background-color: #8c97af;
background-color: rgba(140, 151, 175, 0.9);
color: #fff;
padding: 10px;
diff --git a/frontend/src/plugins/impl/vega/VegaPlugin.tsx b/frontend/src/plugins/impl/vega/VegaPlugin.tsx
index 16b6c2a45c..c6f9755ff1 100644
--- a/frontend/src/plugins/impl/vega/VegaPlugin.tsx
+++ b/frontend/src/plugins/impl/vega/VegaPlugin.tsx
@@ -4,7 +4,7 @@ import { z } from "zod";
import type { IPlugin, IPluginProps } from "@/plugins/types";
import type { VegaLiteSpec } from "./types";
-import type { VegaComponentState, Data } from "./vega-component";
+import type { Data, VegaComponentState } from "./vega-component";
import "./vega.css";
import React, { type JSX } from "react";
diff --git a/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts b/frontend/src/plugins/impl/vega/__tests__/encodings.test.ts
index 3006f8f323..c13b4a52a2 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 { describe, expect, it } from "vitest";
import { findEncodedFields, makeEncodingInteractive } from "../encodings";
-import type { EncodingType, Encodings, VegaLiteSpec } from "../types";
+import type { Encodings, EncodingType, VegaLiteSpec } from "../types";
describe("findEncodedFields", () => {
it("should return an empty array when spec is undefined", () => {
diff --git a/frontend/src/plugins/impl/vega/__tests__/loader.test.ts b/frontend/src/plugins/impl/vega/__tests__/loader.test.ts
index 1ff2fca2ca..5129cdd597 100644
--- a/frontend/src/plugins/impl/vega/__tests__/loader.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/loader.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { parseCsvData } from "../loader";
interface VersionData {
diff --git a/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts b/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts
index e2b0e3873d..ae0d2cdd08 100644
--- a/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/make-selectable.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
+import { describe, expect, it } from "vitest";
import { makeSelectable } from "../make-selectable";
-import type { VegaLiteSpec } from "../types";
import { getSelectionParamNames } from "../params";
+import type { VegaLiteSpec } from "../types";
describe("makeSelectable", () => {
it("should return correctly if mark is not string", () => {
diff --git a/frontend/src/plugins/impl/vega/__tests__/params.test.ts b/frontend/src/plugins/impl/vega/__tests__/params.test.ts
index 7204d91256..54fba1a828 100644
--- a/frontend/src/plugins/impl/vega/__tests__/params.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/params.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, it } from "vitest";
+import { describe, expect, it } from "vitest";
import { getDirectionOfBar } from "../params";
import type { VegaLiteUnitSpec } from "../types";
diff --git a/frontend/src/plugins/impl/vega/__tests__/vega.test.ts b/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
index ce7e5b1717..1f3cfd7df9 100644
--- a/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it, vi } from "vitest";
+import { DATA_TYPES } from "@/core/kernel/messages";
import {
- vegaLoadData,
- vegaLoader,
exportedForTesting,
parseCsvData,
+ vegaLoadData,
+ vegaLoader,
} from "../loader";
-import { DATA_TYPES } from "@/core/kernel/messages";
const { ZERO_WIDTH_SPACE, replacePeriodsInColumnNames, uniquifyColumnNames } =
exportedForTesting;
diff --git a/frontend/src/plugins/impl/vega/batched.ts b/frontend/src/plugins/impl/vega/batched.ts
index c5381c18c4..1e38226e4f 100644
--- a/frontend/src/plugins/impl/vega/batched.ts
+++ b/frontend/src/plugins/impl/vega/batched.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import { tableFromIPC } from "@uwdata/flechette";
import { batch } from "@/utils/batch-requests";
import { createLoader, type Loader } from "./vega-loader";
-import { tableFromIPC } from "@uwdata/flechette";
export function createBatchedLoader(): Loader {
const loader = withArrowSupport(createLoader());
diff --git a/frontend/src/plugins/impl/vega/encodings.ts b/frontend/src/plugins/impl/vega/encodings.ts
index 7e0a98e7f7..0e700c27a0 100644
--- a/frontend/src/plugins/impl/vega/encodings.ts
+++ b/frontend/src/plugins/impl/vega/encodings.ts
@@ -2,8 +2,8 @@
import { Marks } from "./marks";
import type {
AnyMark,
- EncodingType,
Encodings,
+ EncodingType,
Field,
MarkDef,
SharedCompositeEncoding,
diff --git a/frontend/src/plugins/impl/vega/fix-relative-url.ts b/frontend/src/plugins/impl/vega/fix-relative-url.ts
index c70b1db67e..c494809aa3 100644
--- a/frontend/src/plugins/impl/vega/fix-relative-url.ts
+++ b/frontend/src/plugins/impl/vega/fix-relative-url.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { VegaLiteSpec } from "./types";
+
import { asRemoteURL } from "@/core/runtime/config";
+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/formats.ts b/frontend/src/plugins/impl/vega/formats.ts
index ea82e5f055..be161c24ad 100644
--- a/frontend/src/plugins/impl/vega/formats.ts
+++ b/frontend/src/plugins/impl/vega/formats.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { tableFromIPC, type Table as ArrowTable } from "@uwdata/flechette";
+import { type Table as ArrowTable, tableFromIPC } from "@uwdata/flechette";
// Adapted from https://github.com/vega/vega-loader-arrow/blob/main/src/index.js
// but this avoids bundling flechette which causes code duplication
diff --git a/frontend/src/plugins/impl/vega/loader.ts b/frontend/src/plugins/impl/vega/loader.ts
index 5c79372e8f..1bd4c2b7eb 100644
--- a/frontend/src/plugins/impl/vega/loader.ts
+++ b/frontend/src/plugins/impl/vega/loader.ts
@@ -1,11 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { DataFormat } from "./types";
+
+import { tableFromIPC } from "@uwdata/flechette";
import { isNumber } from "lodash-es";
-import { typeParsers, read, type DataType } from "./vega-loader";
-import { Objects } from "@/utils/objects";
import { Logger } from "@/utils/Logger";
-import { tableFromIPC } from "@uwdata/flechette";
+import { Objects } from "@/utils/objects";
import { batchedArrowLoader, createBatchedLoader } from "./batched";
+import type { DataFormat } from "./types";
+import { type DataType, read, typeParsers } from "./vega-loader";
type Unsubscribe = () => void;
type Middleware = () => Unsubscribe;
diff --git a/frontend/src/plugins/impl/vega/make-selectable.ts b/frontend/src/plugins/impl/vega/make-selectable.ts
index 646897cd47..ecd3ed7d79 100644
--- a/frontend/src/plugins/impl/vega/make-selectable.ts
+++ b/frontend/src/plugins/impl/vega/make-selectable.ts
@@ -1,4 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { findEncodedFields, makeEncodingInteractive } from "./encodings";
+import { Marks } from "./marks";
+import { Params } from "./params";
import type {
GenericVegaSpec,
Mark,
@@ -6,9 +10,6 @@ import type {
VegaLiteSpec,
VegaLiteUnitSpec,
} from "./types";
-import { findEncodedFields, makeEncodingInteractive } from "./encodings";
-import { Params } from "./params";
-import { Marks } from "./marks";
export function makeSelectable<T extends VegaLiteSpec>(
spec: T,
diff --git a/frontend/src/plugins/impl/vega/params.ts b/frontend/src/plugins/impl/vega/params.ts
index 2d7e0ac974..a0d262f709 100644
--- a/frontend/src/plugins/impl/vega/params.ts
+++ b/frontend/src/plugins/impl/vega/params.ts
@@ -1,5 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { TopLevelSpec } from "vega-lite";
+import type { LayerSpec, UnitSpec } from "vega-lite/build/src/spec";
import { Marks } from "./marks";
import {
type Field,
@@ -8,7 +9,6 @@ import {
type SingleDefUnitChannel,
type VegaLiteUnitSpec,
} from "./types";
-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 ec0660a8ea..77e365faad 100644
--- a/frontend/src/plugins/impl/vega/resolve-data.ts
+++ b/frontend/src/plugins/impl/vega/resolve-data.ts
@@ -1,15 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { asRemoteURL } from "@/core/runtime/config";
import { vegaLoadData } from "./loader";
import type {
+ FacetedUnitSpec,
Field,
- VegaLiteSpec,
+ GenericFacetSpec,
LayerSpec,
UnitSpec,
- GenericFacetSpec,
- FacetedUnitSpec,
+ VegaLiteSpec,
} from "./types";
-import { asRemoteURL } from "@/core/runtime/config";
type AnySpec =
| VegaLiteSpec
diff --git a/frontend/src/plugins/impl/vega/types.ts b/frontend/src/plugins/impl/vega/types.ts
index d8067ab0f7..238dbd4c5f 100644
--- a/frontend/src/plugins/impl/vega/types.ts
+++ b/frontend/src/plugins/impl/vega/types.ts
@@ -1,27 +1,28 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { Field } from "vega-lite/build/src/channeldef";
+import type { Encoding } from "vega-lite/build/src/encoding";
import type {
- TopLevelUnitSpec,
GenericUnitSpec,
+ TopLevelUnitSpec,
} from "vega-lite/build/src/spec/unit";
-import type { Encoding } from "vega-lite/build/src/encoding";
-import type { Field } from "vega-lite/build/src/channeldef";
+export type { TopLevelSpec as VegaLiteSpec } from "vega-lite";
+export type { SingleDefUnitChannel } from "vega-lite/build/src/channel";
+export type { Field } from "vega-lite/build/src/channeldef";
export type { SharedCompositeEncoding } from "vega-lite/build/src/compositemark";
+export type { DataFormat } from "vega-lite/build/src/data";
export type { AnyMark, MarkDef } from "vega-lite/build/src/mark";
export { Mark } from "vega-lite/build/src/mark";
-export type { TopLevelSpec as VegaLiteSpec } from "vega-lite";
-export type { Field } from "vega-lite/build/src/channeldef";
-export type { SingleDefUnitChannel } from "vega-lite/build/src/channel";
export type {
SelectionParameter,
SelectionType,
} from "vega-lite/build/src/selection";
-export type { DataFormat } from "vega-lite/build/src/data";
export type {
+ FacetedUnitSpec,
+ GenericFacetSpec,
LayerSpec,
UnitSpec,
- GenericFacetSpec,
- FacetedUnitSpec,
} from "vega-lite/build/src/spec";
export type VegaLiteUnitSpec = TopLevelUnitSpec<Field>;
diff --git a/frontend/src/plugins/impl/vega/vega-component.tsx b/frontend/src/plugins/impl/vega/vega-component.tsx
index 21a8ff67d7..899ab9fb22 100644
--- a/frontend/src/plugins/impl/vega/vega-component.tsx
+++ b/frontend/src/plugins/impl/vega/vega-component.tsx
@@ -1,27 +1,28 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { VegaLite, type SignalListeners, type View } from "react-vega";
-import { makeSelectable } from "./make-selectable";
-import { useMemo, useRef, useState, type JSX } from "react";
-import { getSelectionParamNames, ParamNames } from "./params";
-import type { VegaLiteSpec } from "./types";
-import { Alert, AlertTitle } from "@/components/ui/alert";
-import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
+
+import { isValid } from "date-fns";
import { debounce } from "lodash-es";
+import { HelpCircleIcon } from "lucide-react";
+import { type JSX, useMemo, useRef, useState } from "react";
import useEvent from "react-use-event-hook";
-import { Logger } from "@/utils/Logger";
+import { type SignalListeners, VegaLite, type View } from "react-vega";
+// @ts-expect-error vega-typings does not include formats
+import { formats } from "vega";
+import { Alert, AlertTitle } from "@/components/ui/alert";
+import { Tooltip } from "@/components/ui/tooltip";
import { useAsyncData } from "@/hooks/useAsyncData";
-import { fixRelativeUrl } from "./fix-relative-url";
+import { useDeepCompareMemoize } from "@/hooks/useDeepCompareMemoize";
import { useTheme } from "@/theme/useTheme";
-import { Objects } from "@/utils/objects";
-import { resolveVegaSpecData } from "./resolve-data";
import { Events } from "@/utils/events";
+import { Logger } from "@/utils/Logger";
+import { Objects } from "@/utils/objects";
import { ErrorBanner } from "../common/error-banner";
-import { Tooltip } from "@/components/ui/tooltip";
-import { HelpCircleIcon } from "lucide-react";
-import { isValid } from "date-fns";
-// @ts-expect-error vega-typings does not include formats
-import { formats } from "vega";
+import { fixRelativeUrl } from "./fix-relative-url";
import { arrow } from "./formats";
+import { makeSelectable } from "./make-selectable";
+import { getSelectionParamNames, ParamNames } from "./params";
+import { resolveVegaSpecData } from "./resolve-data";
+import type { VegaLiteSpec } from "./types";
// register arrow reader under type 'arrow'
formats("arrow", arrow);
diff --git a/frontend/src/plugins/layout/AccordionPlugin.tsx b/frontend/src/plugins/layout/AccordionPlugin.tsx
index f4d9d9a834..201d9d5a33 100644
--- a/frontend/src/plugins/layout/AccordionPlugin.tsx
+++ b/frontend/src/plugins/layout/AccordionPlugin.tsx
@@ -1,18 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, type JSX } from "react";
-
+import React, { type JSX, type PropsWithChildren } from "react";
+import { z } from "zod";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
-import { z } from "zod";
+import { renderHTML } from "../core/RenderHTML";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { renderHTML } from "../core/RenderHTML";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/CalloutPlugin.tsx b/frontend/src/plugins/layout/CalloutPlugin.tsx
index 9f670c8b43..186cd044d9 100644
--- a/frontend/src/plugins/layout/CalloutPlugin.tsx
+++ b/frontend/src/plugins/layout/CalloutPlugin.tsx
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { JSX } from "react";
import { z } from "zod";
+import { CalloutOutput } from "../../components/editor/output/CalloutOutput";
+import { type Intent, zodIntent } from "../impl/common/intent";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { CalloutOutput } from "../../components/editor/output/CalloutOutput";
-import { type Intent, zodIntent } from "../impl/common/intent";
-import type { JSX } from "react";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/DownloadPlugin.tsx b/frontend/src/plugins/layout/DownloadPlugin.tsx
index 12d0ff923f..82620e94df 100644
--- a/frontend/src/plugins/layout/DownloadPlugin.tsx
+++ b/frontend/src/plugins/layout/DownloadPlugin.tsx
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
import { DownloadIcon, Loader2 } from "lucide-react";
+import { useState } from "react";
+import { z } from "zod";
import { buttonVariants } from "@/components/ui/button";
+import { toast } from "@/components/ui/use-toast";
import { cn } from "@/utils/cn";
-import { useState } from "react";
import { downloadByURL } from "@/utils/download";
import { Logger } from "@/utils/Logger";
-import { toast } from "@/components/ui/use-toast";
import { createPlugin } from "../core/builder";
-import { rpc } from "../core/rpc";
import { renderHTML } from "../core/RenderHTML";
+import { rpc } from "../core/rpc";
interface Data {
/**
@@ -73,7 +73,10 @@ export const DownloadPlugin = createPlugin("marimo-download")
const DownloadButton = ({
data,
load,
-}: { data: Data; load: Functions["load"] }) => {
+}: {
+ data: Data;
+ load: Functions["load"];
+}) => {
const [isLoading, setIsLoading] = useState(false);
const handleClick = async (e: React.MouseEvent) => {
diff --git a/frontend/src/plugins/layout/ImageComparisonPlugin.tsx b/frontend/src/plugins/layout/ImageComparisonPlugin.tsx
index b062342178..a983575ea2 100644
--- a/frontend/src/plugins/layout/ImageComparisonPlugin.tsx
+++ b/frontend/src/plugins/layout/ImageComparisonPlugin.tsx
@@ -1,11 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, { type JSX } from "react";
import { z } from "zod";
+import type { ImageComparisonData } from "../impl/image-comparison/ImageComparisonComponent";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import type { ImageComparisonData } from "../impl/image-comparison/ImageComparisonComponent";
const LazyImageComparisonComponent = React.lazy(
() => import("../impl/image-comparison/ImageComparisonComponent"),
diff --git a/frontend/src/plugins/layout/JsonOutputPlugin.tsx b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
index b00d1d6fec..888151e006 100644
--- a/frontend/src/plugins/layout/JsonOutputPlugin.tsx
+++ b/frontend/src/plugins/layout/JsonOutputPlugin.tsx
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { JSX } from "react";
import { z } from "zod";
+import { EmotionCacheProvider } from "../../components/editor/output/EmotionCacheProvider";
import { JsonOutput } from "../../components/editor/output/JsonOutput";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { EmotionCacheProvider } from "../../components/editor/output/EmotionCacheProvider";
-import type { JSX } from "react";
interface Data {
name?: string | null;
diff --git a/frontend/src/plugins/layout/LazyPlugin.tsx b/frontend/src/plugins/layout/LazyPlugin.tsx
index de920f12d1..fe6967cb29 100644
--- a/frontend/src/plugins/layout/LazyPlugin.tsx
+++ b/frontend/src/plugins/layout/LazyPlugin.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import { createPlugin } from "@/plugins/core/builder";
-import { rpc } from "@/plugins/core/rpc";
-import { useAsyncData } from "@/hooks/useAsyncData";
-import { ErrorBanner } from "../impl/common/error-banner";
-import { renderHTML } from "../core/RenderHTML";
import { useIntersectionObserver } from "@uidotdev/usehooks";
import { Loader2Icon } from "lucide-react";
import type { JSX } from "react";
+import { z } from "zod";
+import { useAsyncData } from "@/hooks/useAsyncData";
+import { createPlugin } from "@/plugins/core/builder";
+import { rpc } from "@/plugins/core/rpc";
+import { renderHTML } from "../core/RenderHTML";
+import { ErrorBanner } from "../impl/common/error-banner";
interface Data {
showLoadingIndicator: boolean;
diff --git a/frontend/src/plugins/layout/MimeRenderPlugin.tsx b/frontend/src/plugins/layout/MimeRenderPlugin.tsx
index 333901746a..a6c605cdf8 100644
--- a/frontend/src/plugins/layout/MimeRenderPlugin.tsx
+++ b/frontend/src/plugins/layout/MimeRenderPlugin.tsx
@@ -1,13 +1,13 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import type { JSX } from "react";
import { z } from "zod";
+import type { OutputMessage } from "@/core/kernel/messages";
+import { OutputRenderer } from "../../components/editor/Output";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { OutputRenderer } from "../../components/editor/Output";
-import type { OutputMessage } from "@/core/kernel/messages";
-import type { JSX } from "react";
interface Data {
mime: OutputMessage["mimetype"];
diff --git a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx b/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
index bdb989db60..87c8f3bea9 100644
--- a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
+++ b/frontend/src/plugins/layout/NavigationMenuPlugin.tsx
@@ -1,24 +1,23 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { PropsWithChildren, JSX } from "react";
-
+import type { JSX, PropsWithChildren } from "react";
+import React from "react";
import { z } from "zod";
-import type {
- IStatelessPlugin,
- IStatelessPluginProps,
-} from "../stateless-plugin";
import {
NavigationMenu,
- NavigationMenuList,
- NavigationMenuItem,
- NavigationMenuTrigger,
NavigationMenuContent,
+ NavigationMenuItem,
NavigationMenuLink,
+ NavigationMenuList,
+ NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/components/ui/navigation";
-import { cn } from "@/utils/cn";
-import React from "react";
-import { renderHTML } from "@/plugins/core/RenderHTML";
import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";
+import { renderHTML } from "@/plugins/core/RenderHTML";
+import { cn } from "@/utils/cn";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../stateless-plugin";
import "./navigation-menu.css";
interface MenuItem {
diff --git a/frontend/src/plugins/layout/ProgressPlugin.tsx b/frontend/src/plugins/layout/ProgressPlugin.tsx
index 463bedcf92..29f3a9a71d 100644
--- a/frontend/src/plugins/layout/ProgressPlugin.tsx
+++ b/frontend/src/plugins/layout/ProgressPlugin.tsx
@@ -1,16 +1,16 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { type PropsWithChildren, type JSX } from "react";
+import humanizeDuration from "humanize-duration";
+import { Loader2Icon } from "lucide-react";
+import React, { type JSX, type PropsWithChildren } from "react";
import { z } from "zod";
+import { Progress } from "@/components/ui/progress";
+import { clamp } from "@/utils/math";
+import { renderHTML } from "../core/RenderHTML";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { renderHTML } from "../core/RenderHTML";
-import { Progress } from "@/components/ui/progress";
-import { Loader2Icon } from "lucide-react";
-import { clamp } from "@/utils/math";
-import humanizeDuration from "humanize-duration";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/RoutesPlugin.tsx b/frontend/src/plugins/layout/RoutesPlugin.tsx
index 0bad590a81..72cd6020f4 100644
--- a/frontend/src/plugins/layout/RoutesPlugin.tsx
+++ b/frontend/src/plugins/layout/RoutesPlugin.tsx
@@ -1,19 +1,18 @@
/* Copyright 2024 Marimo. All rights reserved. */
import React, {
+ type JSX,
type PropsWithChildren,
useEffect,
useMemo,
useState,
- type JSX,
} from "react";
-
+import useEvent from "react-use-event-hook";
import { z } from "zod";
+import { TinyRouter } from "@/utils/routes";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { TinyRouter } from "@/utils/routes";
-import useEvent from "react-use-event-hook";
interface Data {
/**
diff --git a/frontend/src/plugins/layout/StatPlugin.tsx b/frontend/src/plugins/layout/StatPlugin.tsx
index 1d3f1d8239..ce78b6171c 100644
--- a/frontend/src/plugins/layout/StatPlugin.tsx
+++ b/frontend/src/plugins/layout/StatPlugin.tsx
@@ -1,14 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
+import { TriangleIcon } from "lucide-react";
+import type { JSX } from "react";
import { z } from "zod";
+import { cn } from "@/utils/cn";
+import { prettyNumber } from "@/utils/numbers";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { TriangleIcon } from "lucide-react";
-import { cn } from "@/utils/cn";
-import { prettyNumber } from "@/utils/numbers";
-import type { JSX } from "react";
interface Data {
value?: string | number | boolean | null;
diff --git a/frontend/src/plugins/layout/TexPlugin.tsx b/frontend/src/plugins/layout/TexPlugin.tsx
index 2526f898bb..0c10eefdd6 100644
--- a/frontend/src/plugins/layout/TexPlugin.tsx
+++ b/frontend/src/plugins/layout/TexPlugin.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { useLayoutEffect, useRef, type JSX } from "react";
+import { type JSX, useLayoutEffect, useRef } from "react";
import { z } from "zod";
+import { once } from "@/utils/once";
import type {
IStatelessPlugin,
IStatelessPluginProps,
} from "../stateless-plugin";
-import { once } from "@/utils/once";
/**
* TexPlugin
diff --git a/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx b/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
index fddd4cd3eb..9ee712b222 100644
--- a/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
+++ b/frontend/src/plugins/layout/carousel/CarouselPlugin.tsx
@@ -1,17 +1,17 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import type {
- IStatelessPlugin,
- IStatelessPluginProps,
-} from "../../stateless-plugin";
-import swiperCss from "swiper/css?inline";
-import swiperCssVirtual from "swiper/css/virtual?inline";
+import React, { type JSX } from "react";
import swiperCssKeyboard from "swiper/css/keyboard?inline";
import swiperCssNavigation from "swiper/css/navigation?inline";
import swiperCssPagination from "swiper/css/pagination?inline";
import swiperCssScrollbar from "swiper/css/scrollbar?inline";
-import React, { type JSX } from "react";
+import swiperCssVirtual from "swiper/css/virtual?inline";
+import swiperCss from "swiper/css?inline";
+import { z } from "zod";
+import type {
+ IStatelessPlugin,
+ IStatelessPluginProps,
+} from "../../stateless-plugin";
interface Data {
index?: string | null;
diff --git a/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx b/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
index 76dd357136..0a54d37364 100644
--- a/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
+++ b/frontend/src/plugins/layout/mermaid/MermaidPlugin.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { z } from "zod";
-import { lazy, type JSX } from "react";
+import { type JSX, lazy } from "react";
+import { z } from "zod";
import type {
IStatelessPlugin,
IStatelessPluginProps,
diff --git a/frontend/src/plugins/layout/mermaid/mermaid.tsx b/frontend/src/plugins/layout/mermaid/mermaid.tsx
index 21a3edd5dd..41bb49f0e9 100644
--- a/frontend/src/plugins/layout/mermaid/mermaid.tsx
+++ b/frontend/src/plugins/layout/mermaid/mermaid.tsx
@@ -1,10 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import React, { useState } from "react";
-import mermaid from "mermaid";
+
import type { MermaidConfig } from "mermaid";
+import mermaid from "mermaid";
+import React, { useState } from "react";
import { useAsyncData } from "@/hooks/useAsyncData";
-import { Logger } from "@/utils/Logger";
import { useTheme } from "@/theme/useTheme";
+import { Logger } from "@/utils/Logger";
interface Props {
diagram: string;
diff --git a/frontend/src/plugins/plugins.ts b/frontend/src/plugins/plugins.ts
index 5fed8bbde2..ab0729b6cf 100644
--- a/frontend/src/plugins/plugins.ts
+++ b/frontend/src/plugins/plugins.ts
@@ -1,55 +1,56 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
+
+import { NavigationMenuPlugin } from "@/plugins/layout/NavigationMenuPlugin";
import { initializeUIElement } from "../core/dom/ui-element";
import { registerReactComponent } from "./core/registerReactComponent";
+import { initializeSidebarElement } from "./core/sidebar-element";
+import { AnyWidgetPlugin } from "./impl/anywidget/AnyWidgetPlugin";
import { ButtonPlugin } from "./impl/ButtonPlugin";
import { CheckboxPlugin } from "./impl/CheckboxPlugin";
+import { CodeEditorPlugin } from "./impl/CodeEditorPlugin";
+import { ChatPlugin } from "./impl/chat/ChatPlugin";
+import { DataEditorPlugin } from "./impl/DataEditorPlugin";
+import { DataTablePlugin } from "./impl/DataTablePlugin";
import { DatePickerPlugin } from "./impl/DatePickerPlugin";
+import { DateRangePickerPlugin } from "./impl/DateRangePlugin";
+import { DateTimePickerPlugin } from "./impl/DateTimePickerPlugin";
import { DictPlugin } from "./impl/DictPlugin";
import { DropdownPlugin } from "./impl/DropdownPlugin";
-import { FileUploadPlugin } from "./impl/FileUploadPlugin";
+import { DataExplorerPlugin } from "./impl/data-explorer/DataExplorerPlugin";
+import { DataFramePlugin } from "./impl/data-frames/DataFramePlugin";
import { FileBrowserPlugin } from "./impl/FileBrowserPlugin";
+import { FileUploadPlugin } from "./impl/FileUploadPlugin";
import { FormPlugin } from "./impl/FormPlugin";
+import { MicrophonePlugin } from "./impl/MicrophonePlugin";
import { MultiselectPlugin } from "./impl/MultiselectPlugin";
import { NumberPlugin } from "./impl/NumberPlugin";
+import { PanelPlugin } from "./impl/panel/PanelPlugin";
+import { PlotlyPlugin } from "./impl/plotly/PlotlyPlugin";
import { RadioPlugin } from "./impl/RadioPlugin";
import { RangeSliderPlugin } from "./impl/RangeSliderPlugin";
+import { RefreshPlugin } from "./impl/RefreshPlugin";
import { SliderPlugin } from "./impl/SliderPlugin";
import { SwitchPlugin } from "./impl/SwitchPlugin";
-import { TextInputPlugin } from "./impl/TextInputPlugin";
+import { TabsPlugin } from "./impl/TabsPlugin";
import { TextAreaPlugin } from "./impl/TextAreaPlugin";
-import type { IPlugin } from "./types";
-import { DataTablePlugin } from "./impl/DataTablePlugin";
-import type { IStatelessPlugin } from "./stateless-plugin";
+import { TextInputPlugin } from "./impl/TextInputPlugin";
+import { VegaPlugin } from "./impl/vega/VegaPlugin";
import { AccordionPlugin } from "./layout/AccordionPlugin";
import { CalloutPlugin } from "./layout/CalloutPlugin";
-import { JsonOutputPlugin } from "./layout/JsonOutputPlugin";
-import { TabsPlugin } from "./impl/TabsPlugin";
import { CarouselPlugin } from "./layout/carousel/CarouselPlugin";
-import { TexPlugin } from "./layout/TexPlugin";
-import { RefreshPlugin } from "./impl/RefreshPlugin";
-import { MicrophonePlugin } from "./impl/MicrophonePlugin";
import { DownloadPlugin } from "./layout/DownloadPlugin";
-import { ProgressPlugin } from "./layout/ProgressPlugin";
-import { VegaPlugin } from "./impl/vega/VegaPlugin";
-import { StatPlugin } from "./layout/StatPlugin";
-import { DataFramePlugin } from "./impl/data-frames/DataFramePlugin";
-import { PlotlyPlugin } from "./impl/plotly/PlotlyPlugin";
-import { CodeEditorPlugin } from "./impl/CodeEditorPlugin";
-import { DataExplorerPlugin } from "./impl/data-explorer/DataExplorerPlugin";
-import { MermaidPlugin } from "./layout/mermaid/MermaidPlugin";
-import { AnyWidgetPlugin } from "./impl/anywidget/AnyWidgetPlugin";
+import { ImageComparisonPlugin } from "./layout/ImageComparisonPlugin";
+import { JsonOutputPlugin } from "./layout/JsonOutputPlugin";
import { LazyPlugin } from "./layout/LazyPlugin";
-import { NavigationMenuPlugin } from "@/plugins/layout/NavigationMenuPlugin";
-import { initializeSidebarElement } from "./core/sidebar-element";
-import { RoutesPlugin } from "./layout/RoutesPlugin";
-import { DateTimePickerPlugin } from "./impl/DateTimePickerPlugin";
-import { DateRangePickerPlugin } from "./impl/DateRangePlugin";
import { MimeRendererPlugin } from "./layout/MimeRenderPlugin";
-import { ChatPlugin } from "./impl/chat/ChatPlugin";
-import { DataEditorPlugin } from "./impl/DataEditorPlugin";
-import { PanelPlugin } from "./impl/panel/PanelPlugin";
-import { ImageComparisonPlugin } from "./layout/ImageComparisonPlugin";
+import { MermaidPlugin } from "./layout/mermaid/MermaidPlugin";
+import { ProgressPlugin } from "./layout/ProgressPlugin";
+import { RoutesPlugin } from "./layout/RoutesPlugin";
+import { StatPlugin } from "./layout/StatPlugin";
+import { TexPlugin } from "./layout/TexPlugin";
+import type { IStatelessPlugin } from "./stateless-plugin";
+import type { IPlugin } from "./types";
// List of UI plugins
export const UI_PLUGINS: Array<IPlugin<any, unknown>> = [
diff --git a/frontend/src/plugins/stateless-plugin.ts b/frontend/src/plugins/stateless-plugin.ts
index 4ce7a85258..ab3a969351 100644
--- a/frontend/src/plugins/stateless-plugin.ts
+++ b/frontend/src/plugins/stateless-plugin.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { IPlugin } from "./types";
import type { JSX } from "react";
+import type { IPlugin } from "./types";
export interface IStatelessPluginProps<D> {
/**
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index a50acebfc9..398e942019 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { ZodType, ZodTypeDef } from "zod";
-import type { PluginFunctions, FunctionSchemas } from "./core/rpc";
+
import type { JSX } from "react";
+import type { ZodType, ZodTypeDef } from "zod";
+import type { FunctionSchemas, PluginFunctions } from "./core/rpc";
/**
* State setter. Either a value or a function that takes the previous value and
diff --git a/frontend/src/stories/app-chrome.stories.tsx b/frontend/src/stories/app-chrome.stories.tsx
index 78a3754d3d..3d325ee51d 100644
--- a/frontend/src/stories/app-chrome.stories.tsx
+++ b/frontend/src/stories/app-chrome.stories.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { TooltipProvider } from "@/components/ui/tooltip";
-import { AppChrome } from "@/components/editor/chrome/wrapper/app-chrome";
+
import type { Meta, StoryObj } from "@storybook/react";
+import { AppChrome } from "@/components/editor/chrome/wrapper/app-chrome";
+import { TooltipProvider } from "@/components/ui/tooltip";
const meta: Meta<typeof AppChrome> = {
title: "AppChrome",
diff --git a/frontend/src/stories/button.stories.tsx b/frontend/src/stories/button.stories.tsx
index cdfe75584f..8ce525efc8 100644
--- a/frontend/src/stories/button.stories.tsx
+++ b/frontend/src/stories/button.stories.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Loader2, Mail, Trash2Icon } from "lucide-react";
import { Button } from "@/components/ui/button";
-import { Mail, Trash2Icon, Loader2 } from "lucide-react";
export default {
title: "Button",
diff --git a/frontend/src/stories/cell.stories.tsx b/frontend/src/stories/cell.stories.tsx
index 7d23bb3b1b..338c3a8462 100644
--- a/frontend/src/stories/cell.stories.tsx
+++ b/frontend/src/stories/cell.stories.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
+import { defaultUserConfig } from "@/core/config/config-schema";
+import { WebSocketState } from "@/core/websocket/types";
+import { Logger } from "@/utils/Logger";
+import type { Milliseconds, Seconds } from "@/utils/time";
import { Cell, type CellProps } from "../components/editor/Cell";
import { TooltipProvider } from "../components/ui/tooltip";
import type { CellId } from "../core/cells/ids";
-import { Logger } from "@/utils/Logger";
-import type { Milliseconds, Seconds } from "@/utils/time";
-import { defaultUserConfig } from "@/core/config/config-schema";
-import { WebSocketState } from "@/core/websocket/types";
const meta: Meta<typeof Cell> = {
title: "Cell",
diff --git a/frontend/src/stories/data-explorer.stories.tsx b/frontend/src/stories/data-explorer.stories.tsx
index 0c3fe8a0af..048e17858c 100644
--- a/frontend/src/stories/data-explorer.stories.tsx
+++ b/frontend/src/stories/data-explorer.stories.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable react-hooks/rules-of-hooks */
-import { DataExplorerComponent } from "@/plugins/impl/data-explorer/ConnectedDataExplorerComponent";
-import type { ChartSpec } from "@/plugins/impl/data-explorer/state/types";
+
import type { Meta, StoryObj } from "@storybook/react";
import { useState } from "react";
+import { DataExplorerComponent } from "@/plugins/impl/data-explorer/ConnectedDataExplorerComponent";
+import type { ChartSpec } from "@/plugins/impl/data-explorer/state/types";
const meta: Meta = {
title: "DataExplorer",
diff --git a/frontend/src/stories/data-table.stories.tsx b/frontend/src/stories/data-table.stories.tsx
index 2035ab3872..af35a6bdcd 100644
--- a/frontend/src/stories/data-table.stories.tsx
+++ b/frontend/src/stories/data-table.stories.tsx
@@ -1,9 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { DataTable } from "@/components/data-table/data-table";
+
import {
generateColumns,
inferFieldTypes,
} from "@/components/data-table/columns";
+import { DataTable } from "@/components/data-table/data-table";
import { Functions } from "@/utils/functions";
export default {
diff --git a/frontend/src/stories/debugger.stories.tsx b/frontend/src/stories/debugger.stories.tsx
index adf9e77f20..0bc98cfe1b 100644
--- a/frontend/src/stories/debugger.stories.tsx
+++ b/frontend/src/stories/debugger.stories.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Debugger } from "@/components/debugger/debugger-code";
+
import type { Meta, StoryFn } from "@storybook/react";
import { useState } from "react";
+import { Debugger } from "@/components/debugger/debugger-code";
const meta: Meta<typeof Debugger> = {
title: "Debugger",
diff --git a/frontend/src/stories/editor-inputs.stories.tsx b/frontend/src/stories/editor-inputs.stories.tsx
index f0668be943..6c64c8cee0 100644
--- a/frontend/src/stories/editor-inputs.stories.tsx
+++ b/frontend/src/stories/editor-inputs.stories.tsx
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { StoryFn, Meta } from "@storybook/react";
-import { Button, Input } from "../components/editor/inputs/Inputs";
+import type { Meta, StoryFn } from "@storybook/react";
import { PlayIcon } from "lucide-react";
+import { Button, Input } from "../components/editor/inputs/Inputs";
export default {
title: "Editor Inputs",
diff --git a/frontend/src/stories/editor.stories.tsx b/frontend/src/stories/editor.stories.tsx
index 7a57c2c728..36dd82cf30 100644
--- a/frontend/src/stories/editor.stories.tsx
+++ b/frontend/src/stories/editor.stories.tsx
@@ -1,14 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { Meta, StoryObj } from "@storybook/react";
-import { useEffect, useRef } from "react";
+
+import { python } from "@codemirror/lang-python";
import { EditorState, type Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
+import type { Meta, StoryObj } from "@storybook/react";
import CodeMirror from "@uiw/react-codemirror";
-import { type CodeMirrorSetupOpts, basicBundle } from "../core/codemirror/cm";
-import { python } from "@codemirror/lang-python";
+import { useEffect, useRef } from "react";
import { CopilotConfig } from "@/core/codemirror/copilot/copilot-config";
import { copilotBundle } from "@/core/codemirror/copilot/extension";
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
+import { basicBundle, type CodeMirrorSetupOpts } from "../core/codemirror/cm";
const meta: Meta = {
title: "Editor",
diff --git a/frontend/src/stories/form-wrapper.stories.tsx b/frontend/src/stories/form-wrapper.stories.tsx
index 332ef7ec9b..ef63d2c464 100644
--- a/frontend/src/stories/form-wrapper.stories.tsx
+++ b/frontend/src/stories/form-wrapper.stories.tsx
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
import type { Meta, StoryObj } from "@storybook/react";
-import { TooltipProvider } from "../components/ui/tooltip";
-import { FormWrapper, type FormWrapperProps } from "@/plugins/impl/FormPlugin";
+import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
-import { Textarea } from "@/components/ui/textarea";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
-import { Checkbox } from "@/components/ui/checkbox";
+import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
+import { FormWrapper, type FormWrapperProps } from "@/plugins/impl/FormPlugin";
+import { TooltipProvider } from "../components/ui/tooltip";
const meta: Meta<typeof FormWrapper> = {
title: "FormWrapper",
diff --git a/frontend/src/stories/input.stories.tsx b/frontend/src/stories/input.stories.tsx
index 1d401df57e..fa55d11668 100644
--- a/frontend/src/stories/input.stories.tsx
+++ b/frontend/src/stories/input.stories.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import { Button } from "@/components/ui/button";
export default {
title: "Input",
diff --git a/frontend/src/stories/log-viewer.stories.tsx b/frontend/src/stories/log-viewer.stories.tsx
index 14d4523993..9762e73c2f 100644
--- a/frontend/src/stories/log-viewer.stories.tsx
+++ b/frontend/src/stories/log-viewer.stories.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
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 type { CellId } from "@/core/cells/ids";
+import { Dialog } from "../components/ui/dialog";
+import { TooltipProvider } from "../components/ui/tooltip";
const meta: Meta<typeof LogViewer> = {
title: "LogViewer",
diff --git a/frontend/src/stories/number-field.stories.tsx b/frontend/src/stories/number-field.stories.tsx
index 6270b8ff5b..52920a8c25 100644
--- a/frontend/src/stories/number-field.stories.tsx
+++ b/frontend/src/stories/number-field.stories.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { NumberField } from "@/components/ui/number-field";
+
import { Label } from "@/components/ui/label";
+import { NumberField } from "@/components/ui/number-field";
export default {
title: "NumberField",
diff --git a/frontend/src/stories/progress-component.stories.tsx b/frontend/src/stories/progress-component.stories.tsx
index b8fcef2d1b..6fb69296fc 100644
--- a/frontend/src/stories/progress-component.stories.tsx
+++ b/frontend/src/stories/progress-component.stories.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { ProgressComponent } from "@/plugins/layout/ProgressPlugin";
+
import type { Meta, StoryFn } from "@storybook/react";
+import { ProgressComponent } from "@/plugins/layout/ProgressPlugin";
const meta: Meta<typeof ProgressComponent> = {
title: "ProgressComponent",
diff --git a/frontend/src/stories/progress.stories.tsx b/frontend/src/stories/progress.stories.tsx
index 9cb0d63b2b..a8c50586f7 100644
--- a/frontend/src/stories/progress.stories.tsx
+++ b/frontend/src/stories/progress.stories.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Progress } from "@/components/ui/progress";
+
import type { Meta, StoryFn } from "@storybook/react";
+import { Progress } from "@/components/ui/progress";
const meta: Meta<typeof Progress> = {
title: "Progress",
diff --git a/frontend/src/stories/select.stories.tsx b/frontend/src/stories/select.stories.tsx
index 6b4aba0f17..149ec89475 100644
--- a/frontend/src/stories/select.stories.tsx
+++ b/frontend/src/stories/select.stories.tsx
@@ -1,5 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable react-hooks/rules-of-hooks */
+
+import type { Meta, StoryObj } from "@storybook/react";
+import { useState } from "react";
import {
Select,
SelectContent,
@@ -10,8 +13,6 @@ import {
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
-import type { Meta, StoryObj } from "@storybook/react";
-import { useState } from "react";
const meta: Meta = {
title: "Select",
diff --git a/frontend/src/stories/stat.stories.tsx b/frontend/src/stories/stat.stories.tsx
index f40fe190fa..640c5289a8 100644
--- a/frontend/src/stories/stat.stories.tsx
+++ b/frontend/src/stories/stat.stories.tsx
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { StatComponent } from "@/plugins/layout/StatPlugin";
+
import type { Meta, StoryFn } from "@storybook/react";
+import { StatComponent } from "@/plugins/layout/StatPlugin";
const meta: Meta<typeof StatComponent> = {
title: "Stat",
diff --git a/frontend/src/stories/textarea.stories.tsx b/frontend/src/stories/textarea.stories.tsx
index 3bf56614ec..a62ec06d55 100644
--- a/frontend/src/stories/textarea.stories.tsx
+++ b/frontend/src/stories/textarea.stories.tsx
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
-import { Button } from "@/components/ui/button";
export default {
title: "Textarea",
diff --git a/frontend/src/stories/theme.stories.tsx b/frontend/src/stories/theme.stories.tsx
index f55b5992ae..3f7c4dcd2f 100644
--- a/frontend/src/stories/theme.stories.tsx
+++ b/frontend/src/stories/theme.stories.tsx
@@ -1,13 +1,14 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import type { Meta, StoryObj } from "@storybook/react";
-import React, { useEffect, useRef } from "react";
+
+import { python } from "@codemirror/lang-python";
import { EditorState, type Extension } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
+import type { Meta, StoryObj } from "@storybook/react";
+import React, { useEffect, useRef } from "react";
import { basicBundle, type CodeMirrorSetupOpts } from "../core/codemirror/cm";
-import { python } from "@codemirror/lang-python";
-import { OverridingHotkeyProvider } from "../core/hotkeys/hotkeys";
import { darkTheme } from "../core/codemirror/theme/dark";
import { lightTheme } from "../core/codemirror/theme/light";
+import { OverridingHotkeyProvider } from "../core/hotkeys/hotkeys";
// Partial config for storybook demo
const demoConfig: Partial<CodeMirrorSetupOpts> = {
diff --git a/frontend/src/stories/typography.stories.tsx b/frontend/src/stories/typography.stories.tsx
index 95b9c58983..dccf813bdd 100644
--- a/frontend/src/stories/typography.stories.tsx
+++ b/frontend/src/stories/typography.stories.tsx
@@ -4,11 +4,11 @@ import {
H2,
H3,
H4,
- P,
- Lead,
LargeText,
- SmallText,
+ Lead,
MutatedText,
+ P,
+ SmallText,
} from "@/components/ui/typography";
export default {
diff --git a/frontend/src/stories/vega.stories.tsx b/frontend/src/stories/vega.stories.tsx
index de1558f508..ac964f3327 100644
--- a/frontend/src/stories/vega.stories.tsx
+++ b/frontend/src/stories/vega.stories.tsx
@@ -1,6 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import VegaComponent from "@/plugins/impl/vega/vega-component";
+
import type { Meta } from "@storybook/react";
+import type { VegaLiteSpec } from "@/plugins/impl/vega/types";
+import VegaComponent from "@/plugins/impl/vega/vega-component";
import {
AREA_CHART,
BAR_CHART,
@@ -16,7 +18,6 @@ import {
STACKED_BAR_CHART,
TICK_CHART,
} from "./__fixtures__/vega";
-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 5bf706c6ca..a2fc386c73 100644
--- a/frontend/src/theme/ThemeProvider.tsx
+++ b/frontend/src/theme/ThemeProvider.tsx
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { type PropsWithChildren, memo, useLayoutEffect } from "react";
+import { memo, type PropsWithChildren, useLayoutEffect } from "react";
import { useTheme } from "./useTheme";
/**
diff --git a/frontend/src/theme/useTheme.ts b/frontend/src/theme/useTheme.ts
index 48ca30e5c8..2a3925e022 100644
--- a/frontend/src/theme/useTheme.ts
+++ b/frontend/src/theme/useTheme.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { store } from "@/core/state/jotai";
+
import { atom, useAtomValue } from "jotai";
import { resolvedMarimoConfigAtom } from "@/core/config/config";
import { isIslands } from "@/core/islands/utils";
+import { store } from "@/core/state/jotai";
export type Theme = "light" | "dark" | "system";
export type ResolvedTheme = "light" | "dark";
diff --git a/frontend/src/utils/__tests__/Deferred.test.ts b/frontend/src/utils/__tests__/Deferred.test.ts
index c889d1810d..a6fd0bd2d2 100644
--- a/frontend/src/utils/__tests__/Deferred.test.ts
+++ b/frontend/src/utils/__tests__/Deferred.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { Deferred } from "../Deferred";
describe("Deferred", () => {
diff --git a/frontend/src/utils/__tests__/arrays.test.ts b/frontend/src/utils/__tests__/arrays.test.ts
index 605ab4bf1c..47da4be94a 100644
--- a/frontend/src/utils/__tests__/arrays.test.ts
+++ b/frontend/src/utils/__tests__/arrays.test.ts
@@ -1,12 +1,12 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import {
+ Arrays,
arrayDelete,
arrayInsert,
- arrayMove,
arrayInsertMany,
+ arrayMove,
arrayShallowEquals,
- Arrays,
arrayToggle,
} from "../arrays";
diff --git a/frontend/src/utils/__tests__/batch-requests.test.ts b/frontend/src/utils/__tests__/batch-requests.test.ts
index da96b5bf54..2fbd6b083a 100644
--- a/frontend/src/utils/__tests__/batch-requests.test.ts
+++ b/frontend/src/utils/__tests__/batch-requests.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import { batch } from "../batch-requests";
async function sleep(ms: number) {
diff --git a/frontend/src/utils/__tests__/blob.test.ts b/frontend/src/utils/__tests__/blob.test.ts
index 30781c1c48..48f46eea96 100644
--- a/frontend/src/utils/__tests__/blob.test.ts
+++ b/frontend/src/utils/__tests__/blob.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeEach, expect, describe, test } from "vitest";
-import { serializeBlob, deserializeBlob } from "../blob";
+import { beforeEach, describe, expect, test } from "vitest";
+import { deserializeBlob, serializeBlob } from "../blob";
describe("Blob serialization and deserialization", () => {
const testString = "Hello, world!";
diff --git a/frontend/src/utils/__tests__/cell-urls.test.ts b/frontend/src/utils/__tests__/cell-urls.test.ts
index 73dfbea377..6249956691 100644
--- a/frontend/src/utils/__tests__/cell-urls.test.ts
+++ b/frontend/src/utils/__tests__/cell-urls.test.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, beforeEach, afterEach } from "vitest";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
+ canLinkToCell,
createCellLink,
extractCellNameFromHash,
- canLinkToCell,
} from "../cell-urls";
describe("cell-urls utilities", () => {
diff --git a/frontend/src/utils/__tests__/createReducer.test.ts b/frontend/src/utils/__tests__/createReducer.test.ts
index 8d9d1c6607..3a1ddbc7cb 100644
--- a/frontend/src/utils/__tests__/createReducer.test.ts
+++ b/frontend/src/utils/__tests__/createReducer.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, vi } from "vitest";
+import { describe, expect, it, vi } from "vitest";
import { Logger } from "@/utils/Logger";
import { createReducer, createReducerAndAtoms } from "../createReducer";
diff --git a/frontend/src/utils/__tests__/data-views.test.ts b/frontend/src/utils/__tests__/data-views.test.ts
index 33b33524fb..f811cabd49 100644
--- a/frontend/src/utils/__tests__/data-views.test.ts
+++ b/frontend/src/utils/__tests__/data-views.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { updateBufferPaths, byteStringToDataView } from "../data-views";
-import type { ByteString, Base64String } from "../json/base64";
+import { describe, expect, it } from "vitest";
+import { byteStringToDataView, updateBufferPaths } from "../data-views";
+import type { Base64String, ByteString } from "../json/base64";
describe("updateBufferPaths", () => {
it("should return the original object if bufferPaths is null", () => {
diff --git a/frontend/src/utils/__tests__/dates.test.ts b/frontend/src/utils/__tests__/dates.test.ts
index af2581950c..f6932b3948 100644
--- a/frontend/src/utils/__tests__/dates.test.ts
+++ b/frontend/src/utils/__tests__/dates.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, expect, it, beforeAll, afterAll } from "vitest";
-import { prettyDate, exactDateTime, timeAgo, getShortTimeZone } from "../dates";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
+import { exactDateTime, getShortTimeZone, prettyDate, timeAgo } from "../dates";
describe("dates", () => {
// Save original timezone
diff --git a/frontend/src/utils/__tests__/errors.test.ts b/frontend/src/utils/__tests__/errors.test.ts
index fb74ae9c3f..0adab71afe 100644
--- a/frontend/src/utils/__tests__/errors.test.ts
+++ b/frontend/src/utils/__tests__/errors.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { prettyError } from "../errors";
describe("prettyError", () => {
diff --git a/frontend/src/utils/__tests__/filenames.test.ts b/frontend/src/utils/__tests__/filenames.test.ts
index d990c5961b..d0328f8c75 100644
--- a/frontend/src/utils/__tests__/filenames.test.ts
+++ b/frontend/src/utils/__tests__/filenames.test.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { Filenames } from "../filenames";
+
import { describe, expect, it } from "vitest";
+import { Filenames } from "../filenames";
describe("Filenames", () => {
it("should convert filename to markdown", () => {
diff --git a/frontend/src/utils/__tests__/id-tree.test.ts b/frontend/src/utils/__tests__/id-tree.test.ts
index b137a6a028..e670579e51 100644
--- a/frontend/src/utils/__tests__/id-tree.test.ts
+++ b/frontend/src/utils/__tests__/id-tree.test.ts
@@ -1,12 +1,11 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { beforeEach, describe, expect, it } from "vitest";
import {
- CollapsibleTree,
- MultiColumn,
type CellColumnId,
type CellIndex,
+ CollapsibleTree,
+ MultiColumn,
} from "../id-tree";
-import { beforeEach } from "vitest";
let tree: CollapsibleTree<string>;
diff --git a/frontend/src/utils/__tests__/local-storage.test.ts b/frontend/src/utils/__tests__/local-storage.test.ts
index 3626aa50d1..69f0dd5215 100644
--- a/frontend/src/utils/__tests__/local-storage.test.ts
+++ b/frontend/src/utils/__tests__/local-storage.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect, afterEach } from "vitest";
-import { NotebookScopedLocalStorage } from "../localStorage";
+import { afterEach, describe, expect, it } from "vitest";
import { z } from "zod";
-import { store } from "@/core/state/jotai";
import { filenameAtom } from "@/core/saving/file-state";
+import { store } from "@/core/state/jotai";
+import { NotebookScopedLocalStorage } from "../localStorage";
describe("NotebookScopedLocalStorage", () => {
const schema = z.object({
diff --git a/frontend/src/utils/__tests__/lru.test.ts b/frontend/src/utils/__tests__/lru.test.ts
index 19c05a9572..399eecd5ce 100644
--- a/frontend/src/utils/__tests__/lru.test.ts
+++ b/frontend/src/utils/__tests__/lru.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import { LRUCache } from "../lru";
describe("LRUCache", () => {
diff --git a/frontend/src/utils/__tests__/maps.test.ts b/frontend/src/utils/__tests__/maps.test.ts
index 274affd3a8..af7edb923f 100644
--- a/frontend/src/utils/__tests__/maps.test.ts
+++ b/frontend/src/utils/__tests__/maps.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { Maps } from "../maps";
describe("Maps", () => {
diff --git a/frontend/src/utils/__tests__/math.test.ts b/frontend/src/utils/__tests__/math.test.ts
index 7850d0403f..7781dba0f1 100644
--- a/frontend/src/utils/__tests__/math.test.ts
+++ b/frontend/src/utils/__tests__/math.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { clamp } from "../math";
describe("math utils", () => {
diff --git a/frontend/src/utils/__tests__/numbers.test.ts b/frontend/src/utils/__tests__/numbers.test.ts
index c65d173d33..5af8268d50 100644
--- a/frontend/src/utils/__tests__/numbers.test.ts
+++ b/frontend/src/utils/__tests__/numbers.test.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, it } from "vitest";
import {
+ prettyEngineeringNumber,
prettyNumber,
prettyScientificNumber,
- prettyEngineeringNumber,
} from "../numbers";
describe("prettyNumber", () => {
diff --git a/frontend/src/utils/__tests__/pluralize.test.ts b/frontend/src/utils/__tests__/pluralize.test.ts
index e49ef6ee85..a380c27231 100644
--- a/frontend/src/utils/__tests__/pluralize.test.ts
+++ b/frontend/src/utils/__tests__/pluralize.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import { PluralWord, PluralWords } from "../pluralize";
describe("PluralWord", () => {
diff --git a/frontend/src/utils/__tests__/routes.test.ts b/frontend/src/utils/__tests__/routes.test.ts
index 3bfd220e98..16ccf51bbc 100644
--- a/frontend/src/utils/__tests__/routes.test.ts
+++ b/frontend/src/utils/__tests__/routes.test.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+
+import type { Match, ParamData } from "path-to-regexp";
+import { describe, expect, it } from "vitest";
import { TinyRouter } from "../routes";
-import type { ParamData, Match } from "path-to-regexp";
describe("TinyRouter.match", () => {
it("should return the correct match and template for a given location", () => {
diff --git a/frontend/src/utils/__tests__/sets.test.ts b/frontend/src/utils/__tests__/sets.test.ts
index 2752104423..d6d3d24d7a 100644
--- a/frontend/src/utils/__tests__/sets.test.ts
+++ b/frontend/src/utils/__tests__/sets.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { Sets } from "../sets";
describe("Sets", () => {
diff --git a/frontend/src/utils/__tests__/shallow-compare.test.ts b/frontend/src/utils/__tests__/shallow-compare.test.ts
index d9deef8a98..2e550479b2 100644
--- a/frontend/src/utils/__tests__/shallow-compare.test.ts
+++ b/frontend/src/utils/__tests__/shallow-compare.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect } from "vitest";
+import { describe, expect, test } from "vitest";
import { shallowCompare } from "../shallow-compare";
describe("shallowCompare", () => {
diff --git a/frontend/src/utils/__tests__/strings.test.ts b/frontend/src/utils/__tests__/strings.test.ts
index 81441d7675..2035b033db 100644
--- a/frontend/src/utils/__tests__/strings.test.ts
+++ b/frontend/src/utils/__tests__/strings.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
-import { Strings, decodeUtf8 } from "../strings";
+import { describe, expect, it } from "vitest";
+import { decodeUtf8, Strings } from "../strings";
describe("Strings", () => {
describe("startCase", () => {
diff --git a/frontend/src/utils/__tests__/time.test.ts b/frontend/src/utils/__tests__/time.test.ts
index 991e4b01a4..a47401852e 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 { type Milliseconds, Time, type Seconds } from "../time";
+import { describe, expect, it } from "vitest";
+import { type Milliseconds, type Seconds, Time } from "../time";
describe("Time class", () => {
describe("fromMilliseconds", () => {
diff --git a/frontend/src/utils/__tests__/timed-cache.test.ts b/frontend/src/utils/__tests__/timed-cache.test.ts
index 0dc39e961a..2e90645a30 100644
--- a/frontend/src/utils/__tests__/timed-cache.test.ts
+++ b/frontend/src/utils/__tests__/timed-cache.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, test, expect, vi, beforeEach, afterEach } from "vitest";
+import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { TimedCache } from "../timed-cache";
describe("TimedCache", () => {
diff --git a/frontend/src/utils/__tests__/traceback.test.ts b/frontend/src/utils/__tests__/traceback.test.ts
index 9c32a37457..0378179214 100644
--- a/frontend/src/utils/__tests__/traceback.test.ts
+++ b/frontend/src/utils/__tests__/traceback.test.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { describe, expect, test } from "vitest";
-import { extractAllTracebackInfo } from "../traceback";
import { Tracebacks } from "@/__mocks__/tracebacks";
+import { extractAllTracebackInfo } from "../traceback";
describe("traceback", () => {
test("extracts cell-link", () => {
diff --git a/frontend/src/utils/__tests__/url.test.ts b/frontend/src/utils/__tests__/url.test.ts
index 001d188a2c..dc1614f195 100644
--- a/frontend/src/utils/__tests__/url.test.ts
+++ b/frontend/src/utils/__tests__/url.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { beforeAll, expect, describe, test } from "vitest";
+import { beforeAll, describe, expect, test } from "vitest";
import { asURL } from "../url";
describe("asURL function", () => {
diff --git a/frontend/src/utils/__tests__/urls.test.ts b/frontend/src/utils/__tests__/urls.test.ts
index 351a0c100f..ba7fce1922 100644
--- a/frontend/src/utils/__tests__/urls.test.ts
+++ b/frontend/src/utils/__tests__/urls.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { isUrl } from "../urls";
describe("isUrl", () => {
diff --git a/frontend/src/utils/__tests__/versions.test.ts b/frontend/src/utils/__tests__/versions.test.ts
index 03ee7b45f4..d678f4c4c9 100644
--- a/frontend/src/utils/__tests__/versions.test.ts
+++ b/frontend/src/utils/__tests__/versions.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import {
cleanPythonModuleName,
reverseSemverSort,
diff --git a/frontend/src/utils/__tests__/waitForWs.test.ts b/frontend/src/utils/__tests__/waitForWs.test.ts
index c13cd9bf1a..2dc175cb96 100644
--- a/frontend/src/utils/__tests__/waitForWs.test.ts
+++ b/frontend/src/utils/__tests__/waitForWs.test.ts
@@ -1,6 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { beforeEach, afterEach, expect, describe, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { waitForWs } from "../waitForWs";
describe("waitForWs", () => {
diff --git a/frontend/src/utils/createReducer.ts b/frontend/src/utils/createReducer.ts
index 62a2440d21..c0fb94b004 100644
--- a/frontend/src/utils/createReducer.ts
+++ b/frontend/src/utils/createReducer.ts
@@ -1,8 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
/* eslint-disable @typescript-eslint/no-explicit-any */
-import { Logger } from "@/utils/Logger";
+
import { atom, useSetAtom } from "jotai";
import type { Reducer } from "react";
+import { Logger } from "@/utils/Logger";
export type NoInfer<T> = [T][T extends any ? 0 : never];
diff --git a/frontend/src/utils/data-views.ts b/frontend/src/utils/data-views.ts
index 5959974274..263ee4994f 100644
--- a/frontend/src/utils/data-views.ts
+++ b/frontend/src/utils/data-views.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { get, set } from "lodash-es";
-import { Logger } from "./Logger";
-import { type ByteString, typedAtob, type Base64String } from "./json/base64";
import { invariant } from "./invariant";
+import { type Base64String, type ByteString, typedAtob } from "./json/base64";
+import { Logger } from "./Logger";
/**
* Update the object with DataView buffers at the specified paths.
diff --git a/frontend/src/utils/dates.ts b/frontend/src/utils/dates.ts
index d99d2d6a65..2215528f99 100644
--- a/frontend/src/utils/dates.ts
+++ b/frontend/src/utils/dates.ts
@@ -1,6 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { formatDate } from "date-fns";
+
import { TZDate } from "@date-fns/tz";
+import { formatDate } from "date-fns";
import { Logger } from "./Logger";
export function prettyDate(
diff --git a/frontend/src/utils/id-tree.tsx b/frontend/src/utils/id-tree.tsx
index 7804ce88e8..44fafef11d 100644
--- a/frontend/src/utils/id-tree.tsx
+++ b/frontend/src/utils/id-tree.tsx
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { arrayDelete, arrayInsert, arrayInsertMany, arrayMove } from "./arrays";
import { Memoize } from "typescript-memoize";
-import { Logger } from "./Logger";
import { reorderColumnSizes } from "@/components/editor/columns/storage";
+import { arrayDelete, arrayInsert, arrayInsertMany, arrayMove } from "./arrays";
+import { Logger } from "./Logger";
/**
* Branded number to help with type safety
diff --git a/frontend/src/utils/json/__tests__/base64.test.ts b/frontend/src/utils/json/__tests__/base64.test.ts
index 5502627760..070d8013cc 100644
--- a/frontend/src/utils/json/__tests__/base64.test.ts
+++ b/frontend/src/utils/json/__tests__/base64.test.ts
@@ -1,8 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { expect, describe, test } from "vitest";
+import { describe, expect, test } from "vitest";
import {
- deserializeBase64,
type Base64String,
+ deserializeBase64,
type JsonString,
} from "../base64";
diff --git a/frontend/src/utils/localStorage.ts b/frontend/src/utils/localStorage.ts
index 48ad585df1..a651676905 100644
--- a/frontend/src/utils/localStorage.ts
+++ b/frontend/src/utils/localStorage.ts
@@ -1,7 +1,8 @@
/* Copyright 2024 Marimo. All rights reserved. */
+
+import type { ZodType, ZodTypeDef } from "zod";
import { filenameAtom } from "@/core/saving/file-state";
import { store } from "@/core/state/jotai";
-import type { ZodType, ZodTypeDef } from "zod";
import { Logger } from "./Logger";
interface Storage<T> {
diff --git a/frontend/src/utils/pathUtils.test.ts b/frontend/src/utils/pathUtils.test.ts
index b82c8b4e14..561764ffce 100644
--- a/frontend/src/utils/pathUtils.test.ts
+++ b/frontend/src/utils/pathUtils.test.ts
@@ -1,5 +1,5 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import { getProtocolAndParentDirectories } from "./pathUtils";
describe("getProtocolAndParentDirectories", () => {
diff --git a/frontend/src/utils/python-poet/__tests__/poet.test.ts b/frontend/src/utils/python-poet/__tests__/poet.test.ts
index c7862c5919..711929346e 100644
--- a/frontend/src/utils/python-poet/__tests__/poet.test.ts
+++ b/frontend/src/utils/python-poet/__tests__/poet.test.ts
@@ -1,10 +1,10 @@
/* Copyright 2024 Marimo. All rights reserved. */
-import { describe, it, expect } from "vitest";
+import { describe, expect, it } from "vitest";
import {
- FunctionCall,
FunctionArg,
- VariableDeclaration,
+ FunctionCall,
Literal,
+ VariableDeclaration,
} from "../poet";
describe("Python Poet", () => {
diff --git a/frontend/src/utils/routes.ts b/frontend/src/utils/routes.ts
index 7ac44e99ed..ef0906d662 100644
--- a/frontend/src/utils/routes.ts
+++ b/frontend/src/utils/routes.ts
@@ -1,9 +1,9 @@
/* Copyright 2024 Marimo. All rights reserved. */
import {
- match,
type Match,
type MatchFunction,
+ match,
type ParamData,
} from "path-to-regexp";
diff --git a/frontend/src/utils/traceback.ts b/frontend/src/utils/traceback.ts
index 457d010f05..11c19a25c0 100644
--- a/frontend/src/utils/traceback.ts
+++ b/frontend/src/utils/traceback.ts
@@ -1,8 +1,6 @@
/* Copyright 2024 Marimo. All rights reserved. */
-
+import parse, { type DOMNode, Element, Text } from "html-react-parser";
import type { CellId } from "@/core/cells/ids";
-import { type DOMNode, Element, Text } from "html-react-parser";
-import parse from "html-react-parser";
/**
* Check if a DOM node matches a selector.