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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
lint fixes (#6563)
Shahmir Varqha0d013bce967d
diff --git a/frontend/e2e-tests/bugs.spec.ts b/frontend/e2e-tests/bugs.spec.tsindex b540a4a787..d020c869ab 100644--- a/frontend/e2e-tests/bugs.spec.ts+++ b/frontend/e2e-tests/bugs.spec.ts@@ -16,7 +16,7 @@ test.beforeEach(async ({ page }, info) => {* This test makes sure that downstream UI elements are re-initialized when* upstream source cells are re-run.*/-test("correctly initializes cells", async ({ page }, info) => {+test("correctly initializes cells", async ({ page }) => {// Is initialized to 1const number = page.getByTestId("marimo-plugin-number-input")diff --git a/frontend/e2e-tests/global-setup.ts b/frontend/e2e-tests/global-setup.tsindex fca79110bd..d0df63eb40 100644--- a/frontend/e2e-tests/global-setup.ts+++ b/frontend/e2e-tests/global-setup.ts@@ -1,10 +1,9 @@/* Copyright 2024 Marimo. All rights reserved. */-/** biome-ignore-all lint/suspicious/noConsole: for debugging */import { chromium, type FullConfig } from "@playwright/test";import { type ApplicationNames, getAppUrl } from "../playwright.config";-async function globalSetup(config: FullConfig) {+async function globalSetup(_config: FullConfig) {// Start a browser to test server connectivityconst browser = await chromium.launch();const page = await browser.newPage();diff --git a/frontend/src/__mocks__/notebook.ts b/frontend/src/__mocks__/notebook.tsindex f96ea947bb..64f7c1752f 100644--- a/frontend/src/__mocks__/notebook.ts+++ b/frontend/src/__mocks__/notebook.ts@@ -134,11 +134,11 @@ export const MockNotebook = {* Create a notebook state with error outputs for testing ErrorContextProvider*/notebookStateWithErrors: (- errors: Array<{+ errors: {cellId: CellId;cellName: string;errorData: MarimoError[];- }>,+ }[],): NotebookState => {const cellData: Record<string, Partial<CellData>> = {};diff --git a/frontend/src/__tests__/main.test.tsx b/frontend/src/__tests__/main.test.tsxindex dea1cd24bc..3abc4eca5c 100644--- a/frontend/src/__tests__/main.test.tsx+++ b/frontend/src/__tests__/main.test.tsx@@ -23,7 +23,7 @@ vi.mock("../utils/vitals", () => ({}));vi.mock("react-dom/client", () => ({- createRoot: vi.fn().mockImplementation((el) => {+ createRoot: vi.fn().mockImplementation((_el) => {return {render: vi.fn(),};@@ -47,7 +47,7 @@ describe("main", () => {it.each(["edit", "read", "home", "run"])("should mount with mode %s",- (mode) => {+ (_mode) => {const el = document.createElement("div");mount({ mode: "edit" }, el);diff --git a/frontend/src/components/app-config/common.tsx b/frontend/src/components/app-config/common.tsxindex 2ff1063728..fd3bb5d94b 100644--- a/frontend/src/components/app-config/common.tsx+++ b/frontend/src/components/app-config/common.tsx@@ -36,10 +36,10 @@ export const SettingDescription: React.FC<PropsWithChildren> = ({return <p className="text-sm text-muted-foreground">{children}</p>;};-export const SQL_OUTPUT_SELECT_OPTIONS: Array<{+export const SQL_OUTPUT_SELECT_OPTIONS: {label: string;value: SqlOutputType;-}> = [+}[] = [{ label: "Auto (Default)", value: "auto" },{ label: "Native", value: "native" },{ label: "Polars", value: "polars" },diff --git a/frontend/src/components/audio/audio-recorder.tsx b/frontend/src/components/audio/audio-recorder.tsxindex d7c18e05ef..2c6e4662b2 100644--- a/frontend/src/components/audio/audio-recorder.tsx+++ b/frontend/src/components/audio/audio-recorder.tsx@@ -17,7 +17,6 @@ interface AudioRecorderProps {export const AudioRecorder: React.FC<AudioRecorderProps> = ({onStart,onStop,- onPause,status,time,}) => {diff --git a/frontend/src/components/chat/acp/blocks.tsx b/frontend/src/components/chat/acp/blocks.tsxindex 21a522e125..6c40491501 100644--- a/frontend/src/components/chat/acp/blocks.tsx+++ b/frontend/src/components/chat/acp/blocks.tsx@@ -528,7 +528,7 @@ export const CurrentModeBlock = (props: {};export const ToolNotificationsBlock = (props: {- data: Array<ToolCallNotificationEvent | ToolCallUpdateNotificationEvent>;+ data: (ToolCallNotificationEvent | ToolCallUpdateNotificationEvent)[];}) => {const toolCalls = mergeToolCalls(props.data);@@ -561,7 +561,7 @@ export const ToolNotificationsBlock = (props: {};export const DiffBlocks = (props: {- data: Array<Extract<ToolCallContent, { type: "diff" }>>;+ data: Extract<ToolCallContent, { type: "diff" }>[];}) => {return (<div className="flex flex-col gap-2 text-muted-foreground">diff --git a/frontend/src/components/chat/acp/thread.tsx b/frontend/src/components/chat/acp/thread.tsxindex 8dd9f1bc67..205d4f9ac1 100644--- a/frontend/src/components/chat/acp/thread.tsx+++ b/frontend/src/components/chat/acp/thread.tsx@@ -99,23 +99,21 @@ export const AgentThread = ({function isErrorGroup(group: NotificationEvent[],-): group is Array<Extract<NotificationEvent, { type: "error" }>> {+): group is Extract<NotificationEvent, { type: "error" }>[] {// We only check the first since we know the group is the same typereturn group[0].type === "error";}function isConnectionChangeGroup(group: NotificationEvent[],-): group is Array<Extract<NotificationEvent, { type: "connection_change" }>> {+): group is Extract<NotificationEvent, { type: "connection_change" }>[] {// We only check the first since we know the group is the same typereturn group[0].type === "connection_change";}function isSessionNotificationGroup(group: NotificationEvent[],-): group is Array<- Extract<NotificationEvent, { type: "session_notification" }>-> {+): group is Extract<NotificationEvent, { type: "session_notification" }>[] {// We only check the first since we know the group is the same typereturn group[0].type === "session_notification";}diff --git a/frontend/src/components/chat/acp/utils.ts b/frontend/src/components/chat/acp/utils.tsindex 609563a2bf..af021e1b2b 100644--- a/frontend/src/components/chat/acp/utils.ts+++ b/frontend/src/components/chat/acp/utils.ts@@ -3,7 +3,7 @@ import type { NotificationDataOf, SessionNotificationEventData } from "./types";export function isToolCalls(group: SessionNotificationEventData[],-): group is Array<NotificationDataOf<"tool_call" | "tool_call_update">> {+): group is NotificationDataOf<"tool_call" | "tool_call_update">[] {// We only check the first since we know the group is the same typeconst first = group[0];return (@@ -14,7 +14,7 @@ export function isToolCalls(export function isAgentThoughts(group: SessionNotificationEventData[],-): group is Array<NotificationDataOf<"agent_thought_chunk">> {+): group is NotificationDataOf<"agent_thought_chunk">[] {// We only check the first since we know the group is the same typeconst first = group[0];return first.sessionUpdate === "agent_thought_chunk";@@ -22,7 +22,7 @@ export function isAgentThoughts(export function isUserMessages(group: SessionNotificationEventData[],-): group is Array<NotificationDataOf<"user_message_chunk">> {+): group is NotificationDataOf<"user_message_chunk">[] {// We only check the first since we know the group is the same typeconst first = group[0];return first.sessionUpdate === "user_message_chunk";@@ -30,7 +30,7 @@ export function isUserMessages(export function isAgentMessages(group: SessionNotificationEventData[],-): group is Array<NotificationDataOf<"agent_message_chunk">> {+): group is NotificationDataOf<"agent_message_chunk">[] {// We only check the first since we know the group is the same typeconst first = group[0];return first.sessionUpdate === "agent_message_chunk";@@ -38,7 +38,7 @@ export function isAgentMessages(export function isPlans(group: SessionNotificationEventData[],-): group is Array<NotificationDataOf<"plan">> {+): group is NotificationDataOf<"plan">[] {// We only check the first since we know the group is the same typeconst first = group[0];return first.sessionUpdate === "plan";diff --git a/frontend/src/components/data-table/__tests__/data-table.test.tsx b/frontend/src/components/data-table/__tests__/data-table.test.tsxindex 30a128c4e9..0670e67296 100644--- a/frontend/src/components/data-table/__tests__/data-table.test.tsx+++ b/frontend/src/components/data-table/__tests__/data-table.test.tsx@@ -18,7 +18,7 @@ describe("DataTable", () => {{ id: 2, name: "Test 2" },];- const columns: Array<ColumnDef<TestData>> = [+ const columns: ColumnDef<TestData>[] = [{ accessorKey: "name", header: "Name" },];@@ -70,7 +70,7 @@ describe("DataTable", () => {{ id: 2, first: "Jim", last: "Halpert" },];- const columns: Array<ColumnDef<RowData>> = [+ const columns: ColumnDef<RowData>[] = [{ accessorKey: "first", header: "First" },{ accessorKey: "last", header: "Last" },];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.tsindex ed6455f5a8..de8f32e172 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@@ -11,7 +11,7 @@ function createSpec(spec: {encoding: Record<string,| { field: string; type?: string }- | Array<{ field: string; tooltip?: Record<string, string> }>+ | { field: string; tooltip?: Record<string, string> }[]>;resolve?: Record<string, unknown>;title?: string;diff --git a/frontend/src/components/data-table/charts/chart-spec/tooltips.ts b/frontend/src/components/data-table/charts/chart-spec/tooltips.tsindex efcc003688..78234a54f4 100644--- a/frontend/src/components/data-table/charts/chart-spec/tooltips.ts+++ b/frontend/src/components/data-table/charts/chart-spec/tooltips.ts@@ -29,7 +29,7 @@ interface GetTooltipParams {export function getTooltips(params: GetTooltipParams,-): Array<StringFieldDef<string>> | undefined {+): StringFieldDef<string>[] | undefined {const { formValues, xEncoding, yEncoding, colorByEncoding } = params;if (!formValues.tooltips) {@@ -73,7 +73,7 @@ export function getTooltips(// If autoTooltips is enabled, we manually add the x, y, and color columns to the tooltipsif (formValues.tooltips.auto) {- const tooltips: Array<StringFieldDef<string>> = [];+ const tooltips: StringFieldDef<string>[] = [];const xTooltip = addTooltip(xEncoding,formValues.general?.xColumn?.type || "string",@@ -105,7 +105,7 @@ export function getTooltips(// Selected tooltips from the form.const selectedTooltips = formValues.tooltips.fields ?? [];- const tooltips: Array<StringFieldDef<string>> = [];+ const tooltips: StringFieldDef<string>[] = [];// We need to find the matching columns for the selected tooltips if they exist// Otherwise, we can add them without other parametersdiff --git a/frontend/src/components/data-table/charts/components/chart-items.tsx b/frontend/src/components/data-table/charts/components/chart-items.tsxindex 5cce1345c0..1354ce777a 100644--- a/frontend/src/components/data-table/charts/components/chart-items.tsx+++ b/frontend/src/components/data-table/charts/components/chart-items.tsx@@ -103,7 +103,7 @@ const ColumnSelectorWithAggregation: React.FC<{selectedDataType?: SelectedDataType;};defaultAggregation?: AggregationFn;- columns: Array<{ name: string; type: DataType }>;+ columns: { name: string; type: DataType }[];binFieldName: FieldName;}> = ({columnFieldName,diff --git a/frontend/src/components/data-table/charts/components/form-fields.tsx b/frontend/src/components/data-table/charts/components/form-fields.tsxindex ffc6ddd6c3..06b0c6320f 100644--- a/frontend/src/components/data-table/charts/components/form-fields.tsx+++ b/frontend/src/components/data-table/charts/components/form-fields.tsx@@ -86,7 +86,7 @@ export const ColumnSelector = ({includeCountField = true,}: {fieldName: FieldName;- columns: Array<{ name: string; type: DataType }>;+ columns: { name: string; type: DataType }[];onValueChange?: (fieldName: string, type: DataType | undefined) => void;includeCountField?: boolean;}) => {@@ -197,7 +197,7 @@ export const SelectField = ({}: {fieldName: FieldName;label: string;- options: Array<{ display: React.ReactNode; value: string }>;+ options: { display: React.ReactNode; value: string }[];defaultValue: string;}) => {const form = useFormContext();diff --git a/frontend/src/components/data-table/charts/constants.ts b/frontend/src/components/data-table/charts/constants.tsindex 9e10d2ff23..b86ae91224 100644--- a/frontend/src/components/data-table/charts/constants.ts+++ b/frontend/src/components/data-table/charts/constants.ts@@ -79,7 +79,7 @@ export const AGGREGATION_TYPE_DESCRIPTIONS: Record<AggregationFn, string> = {bin: "Group values into bins",};-export const COLOR_SCHEMES: Array<ColorScheme | typeof DEFAULT_COLOR_SCHEME> = [+export const COLOR_SCHEMES: (ColorScheme | typeof DEFAULT_COLOR_SCHEME)[] = [DEFAULT_COLOR_SCHEME,// Categorical schemes"accent",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.tsxindex 33440e734b..b61578e67d 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@@ -211,7 +211,7 @@ const ColumnPreview = ({refetchPreview,});- const previewStats = stats && renderStats(stats, dataType, locale);+ const previewStats = stats && renderStats({ stats, dataType, locale });const chart = chart_spec && renderChart(chart_spec, theme);diff --git a/frontend/src/components/data-table/column-summary/chart-spec-model.tsx b/frontend/src/components/data-table/column-summary/chart-spec-model.tsxindex 78b1075b16..d4b4ebbebc 100644--- a/frontend/src/components/data-table/column-summary/chart-spec-model.tsx+++ b/frontend/src/components/data-table/column-summary/chart-spec-model.tsx@@ -778,14 +778,14 @@ export class ColumnChartSpecModel<T> {const yField = "value";// Calculate xStart and xEnd for each value count- const newValueCounts: Array<{+ const newValueCounts: {count: number;value: string;xStart: number;xEnd: number;xMid: number;proportion: number;- }> = [];+ }[] = [];let xStart = 0;for (const valueCount of valueCounts) {const xEnd = xStart + valueCount.count;diff --git a/frontend/src/components/data-table/columns.tsx b/frontend/src/components/data-table/columns.tsxindex e95d13335c..d29021c15d 100644--- a/frontend/src/components/data-table/columns.tsx+++ b/frontend/src/components/data-table/columns.tsx@@ -117,7 +117,7 @@ export function generateColumns<T>({headerTooltip?: Record<string, string>;showDataTypes?: boolean;calculateTopKRows?: CalculateTopKRows;-}): Array<ColumnDef<T>> {+}): ColumnDef<T>[] {// Row-headers are typically index columnsconst rowHeadersSet = new Set(rowHeaders.map(([columnName]) => columnName));diff --git a/frontend/src/components/data-table/data-table.tsx b/frontend/src/components/data-table/data-table.tsxindex fd822a8ea8..752ba3fae3 100644--- a/frontend/src/components/data-table/data-table.tsx+++ b/frontend/src/components/data-table/data-table.tsx@@ -48,7 +48,7 @@ interface DataTableProps<TData> extends Partial<DownloadActionProps> {wrapperClassName?: string;className?: string;maxHeight?: number;- columns: Array<ColumnDef<TData>>;+ columns: ColumnDef<TData>[];data: TData[];// SortingmanualSorting?: boolean; // server-side sortingdiff --git a/frontend/src/components/data-table/date-popover.tsx b/frontend/src/components/data-table/date-popover.tsxindex e50ce4c33c..448683a69d 100644--- a/frontend/src/components/data-table/date-popover.tsx+++ b/frontend/src/components/data-table/date-popover.tsx@@ -124,7 +124,7 @@ const RelativeTime = ({ date }: { date: Date }) => {const differenceInSeconds = (currentTime.getTime() - date.getTime()) / 1000;// Define time units with their thresholds and conversion factors- const timeUnits: Array<[number, number, string]> = [+ const timeUnits: [number, number, string][] = [[60, 1, "second"], // Less than 60 seconds[60, 60, "minute"], // Less than 60 minutes[24, 3600, "hour"], // Less than 24 hoursdiff --git a/frontend/src/components/data-table/download-actions.tsx b/frontend/src/components/data-table/download-actions.tsxindex ab7e624bae..270e252d0d 100644--- a/frontend/src/components/data-table/download-actions.tsx+++ b/frontend/src/components/data-table/download-actions.tsx@@ -167,7 +167,7 @@ export const DownloadAs: React.FC<DownloadActionProps> = (props) => {);};-function fetchJson(url: string): Promise<Array<Record<string, unknown>>> {+function fetchJson(url: string): Promise<Record<string, unknown>[]> {return fetch(url).then((res) => {if (!res.ok) {throw new Error(res.statusText);diff --git a/frontend/src/components/data-table/range-focus/__tests__/utils.test.ts b/frontend/src/components/data-table/range-focus/__tests__/utils.test.tsindex 49e849dec3..c78c4ecc86 100644--- a/frontend/src/components/data-table/range-focus/__tests__/utils.test.ts+++ b/frontend/src/components/data-table/range-focus/__tests__/utils.test.ts@@ -26,7 +26,7 @@ function createMockColumn(id: string): Column<unknown> {function createMockRow(id: string,- cells: Array<Cell<unknown, unknown>>,+ cells: Cell<unknown, unknown>[],): Row<unknown> {return {id,@@ -43,8 +43,8 @@ function createMockRow(}function createMockTable(- rows: Array<Row<unknown>>,- columns: Array<Column<unknown>>,+ rows: Row<unknown>[],+ columns: Column<unknown>[],): Table<unknown> {return {getRow: (id: string) => rows.find((row) => row.id === id),diff --git a/frontend/src/components/data-table/renderers.tsx b/frontend/src/components/data-table/renderers.tsxindex 55e979b6a8..3a2e276578 100644--- a/frontend/src/components/data-table/renderers.tsx+++ b/frontend/src/components/data-table/renderers.tsx@@ -32,7 +32,7 @@ export function renderTableHeader<TData>(return null;}- const renderHeaderGroup = (headerGroups: Array<HeaderGroup<TData>>) => {+ const renderHeaderGroup = (headerGroups: HeaderGroup<TData>[]) => {return headerGroups.map((headerGroup) =>headerGroup.headers.map((header) => {const { className, style } = getPinningStyles(header.column);@@ -70,7 +70,7 @@ export function renderTableHeader<TData>(interface DataTableBodyProps<TData> {table: Table<TData>;- columns: Array<ColumnDef<TData>>;+ columns: ColumnDef<TData>[];rowViewerPanelOpen: boolean;getRowIndex?: (row: TData, idx: number) => number;viewedRowIdx?: number;@@ -96,7 +96,7 @@ export const DataTableBody = <TData,>({function applyHoverTemplate(template: string,- cells: Array<Cell<TData, unknown>>,+ cells: Cell<TData, unknown>[],): string {const variableRegex = /{{(\w+)}}/g;// Map column id -> stringified value@@ -113,7 +113,7 @@ export const DataTableBody = <TData,>({});}- const renderCells = (cells: Array<Cell<TData, unknown>>) => {+ const renderCells = (cells: Cell<TData, unknown>[]) => {return cells.map((cell) => {const { className, style: pinningstyle } = getPinningStyles(cell.column);const style = Object.assign(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.tsxindex e3aed00206..2b8d274acc 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@@ -188,7 +188,7 @@ export const RowViewerPanel: React.FC<RowViewerPanelProps> = ({</TableRow></TableHeader><TableBody>- {fieldTypes?.map(([columnName, [dataType, externalType]]) => {+ {fieldTypes?.map(([columnName, [dataType, _externalType]]) => {const columnValue = rowValues[columnName];if (!inSearchQuery({ columnName, columnValue, searchQuery })) {diff --git a/frontend/src/components/data-table/types.ts b/frontend/src/components/data-table/types.tsindex 34241f36fe..eb1ec444b9 100644--- a/frontend/src/components/data-table/types.ts+++ b/frontend/src/components/data-table/types.ts@@ -27,9 +27,10 @@ export type ColumnHeaderStats = Record<number | string | null>;-export type FieldTypesWithExternalType = Array<- [columnName: string, [dataType: DataType, externalType: string]]->;+export type FieldTypesWithExternalType = [+ columnName: string,+ [dataType: DataType, externalType: string],+][];export type FieldTypes = Record<string, DataType>;export function toFieldTypes(diff --git a/frontend/src/components/datasources/column-preview.tsx b/frontend/src/components/datasources/column-preview.tsxindex 0983e36883..df5319897e 100644--- a/frontend/src/components/datasources/column-preview.tsx+++ b/frontend/src/components/datasources/column-preview.tsx@@ -110,7 +110,8 @@ export const DatasetColumnPreview: React.FC<{});const stats =- preview.stats && renderStats(preview.stats, column.type, locale);+ preview.stats &&+ renderStats({ stats: preview.stats, dataType: column.type, locale });const chart = preview.chart_spec && renderChart(preview.chart_spec, theme);@@ -175,11 +176,13 @@ export function renderPreviewError({);}-export function renderStats(- stats: Partial<Record<ColumnHeaderStatsKey, unknown>>,- dataType: DataType,- locale: string,-) {+interface RenderStatsProps {+ stats: Partial<Record<ColumnHeaderStatsKey, unknown>>;+ dataType: DataType;+ locale: string;+}++export function renderStats({ stats, dataType, locale }: RenderStatsProps) {return (<div className="gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden">{Object.entries(stats).map(([key, value]) => {diff --git a/frontend/src/components/debugger/debugger-code.tsx b/frontend/src/components/debugger/debugger-code.tsxindex 988f492a1a..c7d296799a 100644--- a/frontend/src/components/debugger/debugger-code.tsx+++ b/frontend/src/components/debugger/debugger-code.tsx@@ -106,7 +106,7 @@ const DebuggerInput: React.FC<{key: "Enter",preventDefault: true,stopPropagation: true,- run: (view: EditorView) => {+ run: () => {const v = value.trim().replaceAll("\n", "\\n");if (!v) {return true;diff --git a/frontend/src/components/dependency-graph/custom-node.tsx b/frontend/src/components/dependency-graph/custom-node.tsxindex 076a82053d..da9b39a258 100644--- a/frontend/src/components/dependency-graph/custom-node.tsx+++ b/frontend/src/components/dependency-graph/custom-node.tsx@@ -1,7 +1,7 @@/* Copyright 2024 Marimo. All rights reserved. */import { useAtomValue } from "jotai";-import React, { memo, use } from "react";+import React, { memo, use, useId } from "react";import { Handle, Position, useStore } from "reactflow";import { TinyCode } from "@/components/editor/cell/TinyCode";import { useCellIds } from "@/core/cells/cells";@@ -23,7 +23,7 @@ const EQUALITY_CHECK = (prevProps: CustomNodeProps,nextProps: CustomNodeProps,) => {- const keys: Array<keyof CustomNodeProps> = ["data", "selected", "id"];+ const keys: (keyof CustomNodeProps)[] = ["data", "selected", "id"];return keys.every((key) => prevProps[key] === nextProps[key]);};@@ -37,18 +37,25 @@ export const CustomNode = memo((props: CustomNodeProps) => {const reactFlowWidth = useStore(({ width }) => width);const edgeMarkers = use(EdgeMarkerContext);+ const inputOneId = useId();+ const inputTwoId = useId();+ const outputOneId = useId();+ const outputTwoId = useId();+const linesOfCode = cell.code.split("\n").length;return (<div><Handletype="target"- id="inputs"+ id={inputOneId}+ data-testid="input-one"position={edgeMarkers === "LR" ? Position.Left : Position.Top}style={{ background: color }}/><Handletype="source"- id="inputs"+ id={inputTwoId}+ data-testid="input-two"position={edgeMarkers === "LR" ? Position.Left : Position.Top}style={{ background: color }}/>@@ -69,13 +76,15 @@ export const CustomNode = memo((props: CustomNodeProps) => {</div><Handletype="source"- id="outputs"+ id={outputOneId}+ data-testid="output-one"position={edgeMarkers === "LR" ? Position.Right : Position.Bottom}style={{ background: color }}/><Handletype="target"- id="outputs"+ id={outputTwoId}+ data-testid="output-two"position={edgeMarkers === "LR" ? Position.Right : Position.Bottom}style={{ background: color }}/>diff --git a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsxindex 93fd4bc6ea..e727198897 100644--- a/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx+++ b/frontend/src/components/dependency-graph/dependency-graph-minimap.tsx@@ -31,7 +31,7 @@ import { useFitToViewOnDimensionChange } from "./utils/useFitToViewOnDimensionChinterface Props {cellIds: CellId[];variables: Variables;- cellAtoms: Array<Atom<CellData>>;+ cellAtoms: Atom<CellData>[];}const elementsBuilder = new VerticalElementsBuilder();@@ -57,7 +57,7 @@ export const DependencyGraphMinimap: React.FC<PropsWithChildren<Props>> = ({// If the cellIds change, update the nodes.const syncChanges = useEvent(- (elements: { nodes: Array<Node<NodeData>>; edges: Edge[] }) => {+ (elements: { nodes: Node<NodeData>[]; edges: Edge[] }) => {setNodes(elements.nodes);setEdges([]);},diff --git a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx b/frontend/src/components/dependency-graph/dependency-graph-tree.tsxindex ea8482805f..1ce8a069d8 100644--- a/frontend/src/components/dependency-graph/dependency-graph-tree.tsx+++ b/frontend/src/components/dependency-graph/dependency-graph-tree.tsx@@ -36,7 +36,7 @@ import { useFitToViewOnDimensionChange } from "./utils/useFitToViewOnDimensionChinterface Props {cellIds: CellId[];variables: Variables;- cellAtoms: Array<Atom<CellData>>;+ cellAtoms: Atom<CellData>[];layoutDirection: LayoutDirection;settings: GraphSettings;}@@ -74,7 +74,7 @@ export const DependencyGraphTree: React.FC<PropsWithChildren<Props>> = ({const api = useReactFlow();const syncChanges = useEvent(- (elements: { nodes: Array<Node<NodeData>>; edges: Edge[] }) => {+ (elements: { nodes: Node<NodeData>[]; edges: Edge[] }) => {// Layout the elementsconst result = layoutElements({nodes: elements.nodes,diff --git a/frontend/src/components/dependency-graph/dependency-graph.tsx b/frontend/src/components/dependency-graph/dependency-graph.tsxindex db0afa6825..15046620d7 100644--- a/frontend/src/components/dependency-graph/dependency-graph.tsx+++ b/frontend/src/components/dependency-graph/dependency-graph.tsx@@ -18,7 +18,7 @@ import "./dependency-graph.css";interface Props {cellIds: CellId[];variables: Variables;- cellAtoms: Array<Atom<CellData>>;+ cellAtoms: Atom<CellData>[];children?: React.ReactNode;}diff --git a/frontend/src/components/dependency-graph/elements.ts b/frontend/src/components/dependency-graph/elements.tsindex c8bbd8bf28..263d290f32 100644--- a/frontend/src/components/dependency-graph/elements.ts+++ b/frontend/src/components/dependency-graph/elements.ts@@ -22,10 +22,10 @@ export function getNodeHeight(linesOfCode: number) {interface ElementsBuilder {createElements: (cellIds: CellId[],- cellAtoms: Array<Atom<CellData>>,+ cellAtoms: Atom<CellData>[],variables: Variables,hidePureMarkdown: boolean,- ) => { nodes: Array<Node<NodeData>>; edges: Edge[] };+ ) => { nodes: Node<NodeData>[]; edges: Edge[] };}export class VerticalElementsBuilder implements ElementsBuilder {@@ -69,12 +69,12 @@ export class VerticalElementsBuilder implements ElementsBuilder {createElements(cellIds: CellId[],- cellAtoms: Array<Atom<CellData>>,+ cellAtoms: Atom<CellData>[],variables: Variables,- hidePureMarkdown: boolean,+ _hidePureMarkdown: boolean,) {let prevY = 0;- const nodes: Array<Node<NodeData>> = [];+ const nodes: Node<NodeData>[] = [];const edges: Edge[] = [];for (const [cellId, cellAtom] of Arrays.zip(cellIds, cellAtoms)) {const node = this.createNode(cellId, cellAtom, prevY);@@ -135,11 +135,11 @@ export class TreeElementsBuilder implements ElementsBuilder {createElements(cellIds: CellId[],- cellAtoms: Array<Atom<CellData>>,+ cellAtoms: Atom<CellData>[],variables: Variables,hidePureMarkdown: boolean,) {- const nodes: Array<Node<NodeData>> = [];+ const nodes: Node<NodeData>[] = [];const edges: Edge[] = [];const nodesWithEdges = new Set<CellId>();diff --git a/frontend/src/components/dependency-graph/utils/changes.ts b/frontend/src/components/dependency-graph/utils/changes.tsindex 4c8af99aa2..379c27177a 100644--- a/frontend/src/components/dependency-graph/utils/changes.ts+++ b/frontend/src/components/dependency-graph/utils/changes.ts@@ -11,8 +11,8 @@ import type {export function getNodeChanges(prevNodes: Node[],nextNodes: Node[],-): Array<NodeAddChange | NodeRemoveChange> {- const changes: Array<NodeAddChange | NodeRemoveChange> = [];+): (NodeAddChange | NodeRemoveChange)[] {+ const changes: (NodeAddChange | NodeRemoveChange)[] = [];const prevNodeIds = new Set(prevNodes.map((node) => node.id));const nextNodeIds = new Set(nextNodes.map((node) => node.id));@@ -33,8 +33,8 @@ export function getNodeChanges(export function getEdgeChanges(prevEdges: Edge[],nextEdges: Edge[],-): Array<EdgeAddChange | EdgeRemoveChange> {- const changes: Array<EdgeAddChange | EdgeRemoveChange> = [];+): (EdgeAddChange | EdgeRemoveChange)[] {+ const changes: (EdgeAddChange | EdgeRemoveChange)[] = [];const prevEdgeIds = new Set(prevEdges.map((edge) => edge.id));const nextEdgeIds = new Set(nextEdges.map((edge) => edge.id));diff --git a/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx b/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsxindex 7ea5bb7510..dd96aa920c 100644--- a/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx+++ b/frontend/src/components/editor/chrome/panels/outline/useActiveOutline.tsx@@ -18,7 +18,7 @@ function getRootScrollableElement() {* React hook to find the active header in the outline*/export function useActiveOutline(- headerElements: Array<readonly [HTMLElement, string]>,+ headerElements: (readonly [HTMLElement, string])[],) {const [activeHeaderId, setActiveHeaderId] = useState<string | undefined>(undefined,diff --git a/frontend/src/components/editor/chrome/panels/packages-panel.tsx b/frontend/src/components/editor/chrome/panels/packages-panel.tsxindex 9d82f5fc2b..0e3a80b567 100644--- a/frontend/src/components/editor/chrome/panels/packages-panel.tsx+++ b/frontend/src/components/editor/chrome/panels/packages-panel.tsx@@ -300,7 +300,7 @@ const InstallPackageForm: React.FC<{const PackagesList: React.FC<{onSuccess: () => void;- packages: Array<{ name: string; version: string }>;+ packages: { name: string; version: string }[];}> = ({ onSuccess, packages }) => {if (packages.length === 0) {return (diff --git a/frontend/src/components/editor/columns/storage.ts b/frontend/src/components/editor/columns/storage.tsindex 7ff03db118..430f6d15cb 100644--- a/frontend/src/components/editor/columns/storage.ts+++ b/frontend/src/components/editor/columns/storage.ts@@ -7,7 +7,7 @@ import { NotebookScopedLocalStorage } from "@/utils/localStorage";const BASE_KEY = "marimo:notebook-col-sizes";interface ColumnSizes {- widths: Array<number | "contentWidth">;+ widths: (number | "contentWidth")[];}function initialState(): ColumnSizes {diff --git a/frontend/src/components/editor/database/__tests__/as-code.test.ts b/frontend/src/components/editor/database/__tests__/as-code.test.tsindex 49c84df5d6..4b5e640b80 100644--- a/frontend/src/components/editor/database/__tests__/as-code.test.ts+++ b/frontend/src/components/editor/database/__tests__/as-code.test.ts@@ -209,7 +209,7 @@ describe("generateDatabaseCode", () => {};describe("basic connections", () => {- const testCases: Array<[string, DatabaseConnection, ConnectionLibrary]> = [+ const testCases: [string, DatabaseConnection, ConnectionLibrary][] = [["postgres with SQLModel", basePostgres, "sqlmodel"],["postgres with SQLAlchemy", basePostgres, "sqlalchemy"],["mysql with SQLModel", baseMysql, "sqlmodel"],@@ -243,7 +243,7 @@ describe("generateDatabaseCode", () => {["databricks with ibis", databricksConnection, "ibis"],];- it.each(testCases)("%s", (name, connection, orm) => {+ it.each(testCases)("%s", (_name, connection, orm) => {expect(generateDatabaseCode(connection, orm)).toMatchSnapshot();});});@@ -315,7 +315,7 @@ describe("generateDatabaseCode", () => {},"duckdb",],- ])("%s", (name, connection, orm) => {+ ])("%s", (_name, connection, orm) => {expect(generateDatabaseCode(connection, orm as ConnectionLibrary),).toMatchSnapshot();@@ -323,7 +323,7 @@ describe("generateDatabaseCode", () => {});describe("edge cases", () => {- const testCases: Array<[string, DatabaseConnection, string]> = [+ const testCases: [string, DatabaseConnection, string][] = [["ENV with special chars SQLModel",{@@ -527,7 +527,7 @@ describe("generateDatabaseCode", () => {],];- it.each(testCases)("%s", (name, connection, orm) => {+ it.each(testCases)("%s", (_name, connection, orm) => {expect(generateDatabaseCode(connection, orm as ConnectionLibrary),).toMatchSnapshot();@@ -571,7 +571,7 @@ describe("generateDatabaseCode", () => {credentials_json: '{"type": "service_account", "project_id": "test"',},],- ])("%s", (name, connection) => {+ ])("%s", (_name, connection) => {expect(generateDatabaseCode(connection, "sqlmodel")).toMatchSnapshot();expect(generateDatabaseCode(connection, "sqlalchemy")).toMatchSnapshot();});@@ -614,7 +614,7 @@ describe("generateDatabaseCode", () => {"sqlmodel",),],- ])("%s", (name, fn) => {+ ])("%s", (_name, fn) => {expect(fn).toThrow();});});diff --git a/frontend/src/components/editor/navigation/clipboard.ts b/frontend/src/components/editor/navigation/clipboard.tsindex d41dd77080..eeb543ea23 100644--- a/frontend/src/components/editor/navigation/clipboard.ts+++ b/frontend/src/components/editor/navigation/clipboard.ts@@ -11,9 +11,9 @@ import { Logger } from "@/utils/Logger";const MARIMO_CELL_MIMETYPE = "web application/x-marimo-cell";interface ClipboardCellData {- cells: Array<{+ cells: {code: string;- }>;+ }[];version: "1.0";}diff --git a/frontend/src/components/editor/output/ConsoleOutput.tsx b/frontend/src/components/editor/output/ConsoleOutput.tsxindex d258c838a7..01536eba56 100644--- a/frontend/src/components/editor/output/ConsoleOutput.tsx+++ b/frontend/src/components/editor/output/ConsoleOutput.tsx@@ -28,7 +28,7 @@ interface Props {cellId: CellId;cellName: string;className?: string;- consoleOutputs: Array<WithResponse<OutputMessage>>;+ consoleOutputs: WithResponse<OutputMessage>[];stale: boolean;debuggerActive: boolean;onRefactorWithAI?: (opts: { prompt: string }) => void;diff --git a/frontend/src/components/editor/output/JsonOutput.tsx b/frontend/src/components/editor/output/JsonOutput.tsxindex fc35db6564..8368bbff56 100644--- a/frontend/src/components/editor/output/JsonOutput.tsx+++ b/frontend/src/components/editor/output/JsonOutput.tsx@@ -200,7 +200,7 @@ const LEAF_RENDERERS = {};// eslint-disable-next-line @typescript-eslint/no-explicit-any-const MIME_TYPES: Array<DataType<any>> = Object.entries(LEAF_RENDERERS).map(+const MIME_TYPES: DataType<any>[] = Object.entries(LEAF_RENDERERS).map(([leafType, render]) => ({is: (value) => typeof value === "string" && value.startsWith(leafType),PostComponent: PyCopyButton,diff --git a/frontend/src/components/editor/renderers/grid-layout/types.ts b/frontend/src/components/editor/renderers/grid-layout/types.tsindex 23d2da57e5..96d65e0c10 100644--- a/frontend/src/components/editor/renderers/grid-layout/types.ts+++ b/frontend/src/components/editor/renderers/grid-layout/types.ts@@ -68,13 +68,13 @@ export interface GridLayout extends Omit<SerializedGridLayout, "cells"> {/*** The cells in the layout.*/- cells: Array<{+ cells: {i: string;x: number;y: number;w: number;h: number;- }>;+ }[];scrollableCells: Set<CellId>;diff --git a/frontend/src/components/editor/renderers/plugins.ts b/frontend/src/components/editor/renderers/plugins.tsindex 425d2cb045..2112da40c0 100644--- a/frontend/src/components/editor/renderers/plugins.ts+++ b/frontend/src/components/editor/renderers/plugins.ts@@ -8,7 +8,7 @@ import { VerticalLayoutPlugin } from "./vertical-layout/vertical-layout";// If more renderers are added, we may want to consider lazy loading them.// eslint-disable-next-line @typescript-eslint/no-explicit-any-export const cellRendererPlugins: Array<ICellRendererPlugin<any, any>> = [+export const cellRendererPlugins: ICellRendererPlugin<any, any>[] = [GridLayoutPlugin,SlidesLayoutPlugin,VerticalLayoutPlugin,diff --git a/frontend/src/components/editor/renderers/types.ts b/frontend/src/components/editor/renderers/types.tsindex e99c172d68..cda4359b1a 100644--- a/frontend/src/components/editor/renderers/types.ts+++ b/frontend/src/components/editor/renderers/types.ts@@ -17,7 +17,7 @@ export interface ICellRendererProps<L> {/*** The cells to render.*/- cells: Array<CellRuntimeState & CellData>;+ cells: (CellRuntimeState & CellData)[];/*** The layout configuration.diff --git a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsxindex 933ab5d9dc..69680673e0 100644--- a/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx+++ b/frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx@@ -198,7 +198,7 @@ const ActionButtons: React.FC<{actions.push(<DropdownMenuItemonSelect={onToggleShowCode}- id="notebook-action-show-code"+ data-testid="notebook-action-show-code"key="show-code"><Code2Icon className="mr-2" size={14} strokeWidth={1.5} />@@ -213,7 +213,7 @@ const ActionButtons: React.FC<{actions.push(<DropdownMenuItemonSelect={handleDownloadAsHTML}- id="notebook-action-download-html"+ data-testid="notebook-action-download-html"key="download-html"><FolderDownIcon className="mr-2" size={14} strokeWidth={1.5} />@@ -222,7 +222,7 @@ const ActionButtons: React.FC<{<DropdownMenuSeparator key="download-html-separator" />,<DropdownMenuItemonSelect={handleDownloadAsPNG}- id="notebook-action-download-png"+ data-testid="notebook-action-download-png"key="download-png"><ImageIcon className="mr-2" size={14} strokeWidth={1.5} />@@ -239,7 +239,7 @@ const ActionButtons: React.FC<{// as this may be used in custom css to hide/show the actions dropdownreturn (<div- id="notebook-actions-dropdown"+ data-testid="notebook-actions-dropdown"className={cn("right-0 top-0 z-50 m-4 no-print flex gap-2 print:hidden",// If the notebook is static, we have a banner at the top, so@@ -419,10 +419,10 @@ export const VerticalLayoutPlugin: ICellRendererPlugin<};export function groupCellsByColumn(- cells: Array<CellRuntimeState & CellData>,-): Array<[number, Array<CellRuntimeState & CellData>]> {+ cells: (CellRuntimeState & CellData)[],+): [number, (CellRuntimeState & CellData)[]][] {// Group cells by column- const cellsByColumn = new Map<number, Array<CellRuntimeState & CellData>>();+ const cellsByColumn = new Map<number, (CellRuntimeState & CellData)[]>();let lastSeenColumn = 0;cells.forEach((cell) => {const column = cell.config.column ?? lastSeenColumn;diff --git a/frontend/src/components/forms/form.tsx b/frontend/src/components/forms/form.tsxindex b5a709719d..079bcfcb17 100644--- a/frontend/src/components/forms/form.tsx+++ b/frontend/src/components/forms/form.tsx@@ -59,7 +59,7 @@ interface Props<T extends FieldValues> {form: UseFormReturn<T>;schema: z.ZodType;path?: Path<T>;- renderers: Array<FormRenderer<T>> | undefined;+ renderers: FormRenderer<T>[] | undefined;children?: React.ReactNode;}@@ -82,7 +82,7 @@ export function renderZodSchema<T extends FieldValues, S>(schema: z.ZodType<S>,form: UseFormReturn<T>,path: Path<T>,- renderers: Array<FormRenderer<T>>,+ renderers: FormRenderer<T>[],) {// Try custom renderers firstfor (const renderer of renderers) {@@ -330,7 +330,7 @@ export function renderZodSchema<T extends FieldValues, S>(}if (schema instanceof z.ZodDiscriminatedUnion) {- const options = schema._def.options as Array<z.ZodType<unknown>>;+ const options = schema._def.options as z.ZodType<unknown>[];const discriminator = schema._def.discriminator;const optionsMap = schema._def.optionsMap;return (@@ -392,7 +392,7 @@ export function renderZodSchema<T extends FieldValues, S>(control={form.control}name={path}render={({ field }) => {- const options = schema._def.options as Array<z.ZodType<unknown>>;+ const options = schema._def.options as z.ZodType<unknown>[];let value: string = field.value;const types = options.map((option) => {return getUnionLiteral(option)._def.value;@@ -812,6 +812,6 @@ const MultiSelectFormField = ({);};-function joinPath<T>(...parts: Array<string | number>): Path<T> {+function joinPath<T>(...parts: (string | number)[]): Path<T> {return parts.filter((part) => part !== "").join(".") as Path<T>;}diff --git a/frontend/src/core/ai/context/providers/error.ts b/frontend/src/core/ai/context/providers/error.tsindex 0a07568f41..fe96ee3455 100644--- a/frontend/src/core/ai/context/providers/error.ts+++ b/frontend/src/core/ai/context/providers/error.ts@@ -14,11 +14,11 @@ export interface ErrorContextItem extends AIContextItem {type: "error";data: {type: "all-errors";- errors: Array<{+ errors: {cellId: CellId;cellName: string;errorData: MarimoError[];- }>;+ }[];};}diff --git a/frontend/src/core/ai/model-registry.ts b/frontend/src/core/ai/model-registry.tsindex ba5cf6f4e9..ea327c3118 100644--- a/frontend/src/core/ai/model-registry.ts+++ b/frontend/src/core/ai/model-registry.ts@@ -202,7 +202,7 @@ export class AiModelRegistry {return this.modelsByProviderMap;}- getListModelsByProvider(): Array<[ProviderId, AiModel[]]> {+ getListModelsByProvider(): [ProviderId, AiModel[]][] {const modelsByProvider = this.getGroupedModelsByProvider();const arrayModels = [...modelsByProvider.entries()];const providerToOrderIdx = getProviderMap().providerToOrderIdx;diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.tsindex 38584444b1..634904e254 100644--- a/frontend/src/core/cells/cells.ts+++ b/frontend/src/core/cells/cells.ts@@ -84,14 +84,14 @@ export interface NotebookState {** (CodeMirror types the serialized config as any.)*/- history: Array<{+ history: {name: string;// eslint-disable-next-line @typescript-eslint/no-explicit-anyserializedEditorState: any;column: CellColumnId;index: CellIndex;isSetupCell: boolean;- }>;+ }[];/*** Key of cell to scroll to; typically set by actions that re-order the cell* array. Call the SCROLL_TO_TARGET action to scroll to the specified cell@@ -1128,10 +1128,10 @@ const {// Find the start/end of the collapsed rangesconst nodes = [...column.nodes];- const rangeIndexes: Array<{+ const rangeIndexes: {start: CellIndex;end: CellIndex;- }> = [];+ }[] = [];const reversedCollapseRanges = [];// Iterate in reverse order (bottom-up) to process children first@@ -1668,7 +1668,7 @@ export const getCellEditorView = (cellId: CellId) => {export function flattenTopLevelNotebookCells(state: NotebookState,-): Array<CellData & CellRuntimeState> {+): (CellData & CellRuntimeState)[] {const { cellIds, cellData, cellRuntime } = state;return cellIds.getColumns().flatMap((column) =>column.topLevelIds.map((cellId) => ({diff --git a/frontend/src/core/cells/types.ts b/frontend/src/core/cells/types.tsindex 05b9439ece..ffb70de42f 100644--- a/frontend/src/core/cells/types.ts+++ b/frontend/src/core/cells/types.ts@@ -93,7 +93,7 @@ export interface CellRuntimeState {/** TOC outline */outline: Outline | null;/** messages encoding the cell's console outputs. */- consoleOutputs: Array<WithResponse<OutputMessage>>;+ consoleOutputs: WithResponse<OutputMessage>[];/** current status of the cell */status: RuntimeState;/** whether the cell has stale inputs*/diff --git a/frontend/src/core/codemirror/editing/commands.ts b/frontend/src/core/codemirror/editing/commands.tsindex 256db3eefc..6e308dddae 100644--- a/frontend/src/core/codemirror/editing/commands.ts+++ b/frontend/src/core/codemirror/editing/commands.ts@@ -3,14 +3,14 @@ import { foldAll, unfoldAll } from "@codemirror/language";import type { Command, EditorView } from "@codemirror/view";import type { Nullable } from "vitest";-export type BulkCommand = (targets: Array<Nullable<EditorView>>) => boolean;+export type BulkCommand = (targets: Nullable<EditorView>[]) => boolean;/*** Make a bulk command from a single {@type Command} that applies* the given command to all targets.*/export function makeBulkCommand(command: Command) {- return (targets: Array<Nullable<EditorView>>) => {+ return (targets: Nullable<EditorView>[]) => {let changed = false;for (const target of targets) {if (target) {diff --git a/frontend/src/core/codemirror/find-replace/navigate.ts b/frontend/src/core/codemirror/find-replace/navigate.tsindex ae7c8b4a94..3c940c9d68 100644--- a/frontend/src/core/codemirror/find-replace/navigate.ts+++ b/frontend/src/core/codemirror/find-replace/navigate.ts@@ -110,7 +110,7 @@ export const findPrev = findInDirection("prev");*/export const replaceAll = searchCommand(({ query }) => {const views = getAllEditorViews();- const undoHandlers: Array<() => void> = [];+ const undoHandlers: (() => void)[] = [];for (const view of views) {if (view.state.readOnly) {continue;diff --git a/frontend/src/core/codemirror/language/languages/markdown.ts b/frontend/src/core/codemirror/language/languages/markdown.tsindex c3a9d5da51..76249160bf 100644--- a/frontend/src/core/codemirror/language/languages/markdown.ts+++ b/frontend/src/core/codemirror/language/languages/markdown.ts@@ -155,7 +155,7 @@ export class MarkdownLanguageAdapterconst tree = pythonLanguage.parser.parse(pythonCode);// This is the exact match of mo.md() signature- const enterOrder: Array<{ match: string | RegExp; stop?: boolean }> = [+ const enterOrder: { match: string | RegExp; stop?: boolean }[] = [{ match: "Script" },{ match: "ExpressionStatement" },{ match: "CallExpression" },diff --git a/frontend/src/core/codemirror/language/utils/ast.ts b/frontend/src/core/codemirror/language/utils/ast.tsindex 745c4c1874..331619c39a 100644--- a/frontend/src/core/codemirror/language/utils/ast.ts+++ b/frontend/src/core/codemirror/language/utils/ast.ts@@ -10,7 +10,7 @@ export function parseArgsKwargs(code: string,): {args: SyntaxNode[];- kwargs: Array<{ key: string; value: string }>;+ kwargs: { key: string; value: string }[];} {// Check we are in an ArgListconst name = argCursor.name;@@ -54,8 +54,8 @@ function parseArgs(argCursor: TreeCursor): SyntaxNode[] {function parseKwargs(argCursor: TreeCursor,code: string,-): Array<{ key: string; value: string }> {- const kwargs: Array<{ key: string; value: string }> = [];+): { key: string; value: string }[] {+ const kwargs: { key: string; value: string }[] = [];let name = argCursor.name;do {diff --git a/frontend/src/core/codemirror/lsp/federated-lsp.ts b/frontend/src/core/codemirror/lsp/federated-lsp.tsindex 87d882e3e6..32b4d97675 100644--- a/frontend/src/core/codemirror/lsp/federated-lsp.ts+++ b/frontend/src/core/codemirror/lsp/federated-lsp.ts@@ -115,7 +115,7 @@ export class FederatedLanguageServerClient implements ILanguageServerClient {async textDocumentCodeAction(params: LSP.CodeActionParams,- ): Promise<Array<LSP.Command | LSP.CodeAction> | null> {+ ): Promise<(LSP.Command | LSP.CodeAction)[] | null> {const client = this.firstWithCapability("codeActionProvider");if (client) {return client.textDocumentCodeAction(params);@@ -206,9 +206,9 @@ export class FederatedLanguageServerClient implements ILanguageServerClient {}function mergeCompletions(- results: Array<- PromiseSettledResult<LSP.CompletionList | LSP.CompletionItem[] | null>- >,+ results: PromiseSettledResult<+ LSP.CompletionList | LSP.CompletionItem[] | null+ >[],): LSP.CompletionList {const completions: LSP.CompletionItem[] = [];let isIncomplete = false;diff --git a/frontend/src/core/codemirror/lsp/lens.ts b/frontend/src/core/codemirror/lsp/lens.tsindex 9570d144fc..b9379408d6 100644--- a/frontend/src/core/codemirror/lsp/lens.ts+++ b/frontend/src/core/codemirror/lsp/lens.ts@@ -22,10 +22,10 @@ export interface NotebookLens {reversePosition: (position: LSP.Position, cellId: CellId) => LSP.Position;/** Clip a range to the given cell */- getEditsForNewText: (newText: string) => Array<{+ getEditsForNewText: (newText: string) => {cellId: CellId;text: string;- }>;+ }[];/** Check if a range falls within the given cell */isInRange: (range: LSP.Range, cellId: CellId) => boolean;@@ -84,10 +84,10 @@ export function createNotebookLens(throw new Error("Cannot apply rename when there are new lines");}- const edits: Array<{+ const edits: {cellId: CellId;text: string;- }> = [];+ }[] = [];for (const [cellId, code] of Objects.entries(codes)) {if (!cellLineOffsets.has(cellId)) {diff --git a/frontend/src/core/codemirror/lsp/notebook-lsp.ts b/frontend/src/core/codemirror/lsp/notebook-lsp.tsindex 4be8efc609..29737976d3 100644--- a/frontend/src/core/codemirror/lsp/notebook-lsp.ts+++ b/frontend/src/core/codemirror/lsp/notebook-lsp.ts@@ -300,7 +300,7 @@ export class NotebookLanguageServerClient implements ILanguageServerClient {textDocumentCodeAction(params: LSP.CodeActionParams,- ): Promise<Array<LSP.Command | LSP.CodeAction> | null> {+ ): Promise<(LSP.Command | LSP.CodeAction)[] | null> {const disabledCodeAction = true;if (disabledCodeAction) {return Promise.resolve(null);diff --git a/frontend/src/core/codemirror/lsp/types.ts b/frontend/src/core/codemirror/lsp/types.tsindex ad64ad76e4..d34a12778a 100644--- a/frontend/src/core/codemirror/lsp/types.ts+++ b/frontend/src/core/codemirror/lsp/types.ts@@ -49,7 +49,7 @@ export function isClientWithNotify(export function isClientWithPlugins(client: ILanguageServerClient,): client is ILanguageServerClient & {- plugins: Array<{ documentUri: string; view?: EditorView }>;+ plugins: { documentUri: string; view?: EditorView }[];} {return "plugins" in client;}diff --git a/frontend/src/core/codemirror/markdown/completions.ts b/frontend/src/core/codemirror/markdown/completions.tsindex 89afa2634a..3b4967f518 100644--- a/frontend/src/core/codemirror/markdown/completions.ts+++ b/frontend/src/core/codemirror/markdown/completions.ts@@ -133,7 +133,7 @@ const latexSymbolCompletionSource: CompletionSource = (context) => {// Common LaTeX symbols with their UTF-8 equivalentsconst getLatexSymbolList = once((): Completion[] => {- const symbols: Array<[string, string, string]> = [+ const symbols: [string, string, string][] = [// Greek letters["alpha", "α", "Greek small letter alpha"],["beta", "β", "Greek small letter beta"],diff --git a/frontend/src/core/codemirror/reactive-references/analyzer.ts b/frontend/src/core/codemirror/reactive-references/analyzer.tsindex ccf5bbd5c0..52176beba9 100644--- a/frontend/src/core/codemirror/reactive-references/analyzer.ts+++ b/frontend/src/core/codemirror/reactive-references/analyzer.ts@@ -67,7 +67,7 @@ export function findReactiveVariables(options: {// Maps to track variable declarations and scopesconst allDeclarations = new Map<number, Set<string>>(); // scope position -> variable namesconst scopeTypes = new Map<number, string>(); // scope position -> scope type (e.g., "ClassDefinition")- const classLevelDeclarations = new Map<number, Array<[string, number]>>(); // class scope -> [varName, position] pairs+ const classLevelDeclarations = new Map<number, [string, number][]>(); // class scope -> [varName, position] pairs// Class-level variables require special handling because they're evaluated sequentially// A variable is only available after its assignment statement completes@@ -555,7 +555,7 @@ function extractAssignmentTargets(state: EditorState;allDeclarations: Map<number, Set<string>>;scopeTypes: Map<number, string>;- classLevelDeclarations: Map<number, Array<[string, number]>>;+ classLevelDeclarations: Map<number, [string, number][]>;assignmentPosition: number;},) {diff --git a/frontend/src/core/codemirror/rtc/loro/awareness.ts b/frontend/src/core/codemirror/rtc/loro/awareness.tsindex bc8f803338..c8a196e67e 100644--- a/frontend/src/core/codemirror/rtc/loro/awareness.ts+++ b/frontend/src/core/codemirror/rtc/loro/awareness.ts@@ -302,7 +302,7 @@ const parseAwarenessUpdate = (removed: PeerID[];},scopeId: ScopeId,-): Array<StateEffect<CursorEffect>> => {+): StateEffect<CursorEffect>[] => {const effects = [];const { updated, added } = arg;for (const update of [...updated, ...added]) {diff --git a/frontend/src/core/dom/outline.ts b/frontend/src/core/dom/outline.tsindex 48800a84be..97c143e762 100644--- a/frontend/src/core/dom/outline.ts+++ b/frontend/src/core/dom/outline.ts@@ -57,7 +57,7 @@ export function headingToIdentifier(heading: Element): OutlineItem["by"] {return { path: `//${heading.tagName}[contains(., "${name}")]` };}-export function mergeOutlines(outlines: Array<Outline | null>): Outline {+export function mergeOutlines(outlines: (Outline | null)[]): Outline {return {items: outlines.filter(Boolean).flatMap((outline) => outline.items),};@@ -104,7 +104,7 @@ export function canCollapseOutline(outline: Outline | null): boolean {*/export function findCollapseRange(startIndex: number,- outlines: Array<Outline | null>,+ outlines: (Outline | null)[],): [number, number] | null {// Higher header is the lowest valueconst getHighestHeader = (outline: Outline) => {diff --git a/frontend/src/core/errors/state.ts b/frontend/src/core/errors/state.tsindex 51c250a543..2dcc920e65 100644--- a/frontend/src/core/errors/state.ts+++ b/frontend/src/core/errors/state.ts@@ -7,7 +7,7 @@ import { generateUUID } from "@/utils/uuid";import type { Banner } from "../kernel/messages";interface BannerState {- banners: Array<Identified<Banner>>;+ banners: Identified<Banner>[];}const { valueAtom: bannersAtom, useActions } = createReducerAndAtoms(diff --git a/frontend/src/core/islands/parse.ts b/frontend/src/core/islands/parse.tsindex 28b08f1885..77123a3988 100644--- a/frontend/src/core/islands/parse.ts+++ b/frontend/src/core/islands/parse.ts@@ -88,9 +88,7 @@ export function parseMarimoIslandApps(): MarimoIslandApp[] {return [...apps.values()];}-export function createMarimoFile(app: {- cells: Array<{ code: string }>;-}): string {+export function createMarimoFile(app: { cells: { code: string }[] }): string {const lines = ["import marimo","app = marimo.App()",diff --git a/frontend/src/core/kernel/messages.ts b/frontend/src/core/kernel/messages.tsindex ecec604a77..b9c16c60c6 100644--- a/frontend/src/core/kernel/messages.ts+++ b/frontend/src/core/kernel/messages.ts@@ -24,7 +24,7 @@ export type OutputChannel = schemas["CellChannel"];export type CellOutput = schemas["CellOutput"];export type MarimoError = Extract<CellOutput["data"],- Array<{ type: string }>+ { type: string }[]>[number];export type OutputMessage = schemas["CellOutput"];export type CompletionOption = schemas["CompletionResult"]["options"][0];diff --git a/frontend/src/core/variables/state.ts b/frontend/src/core/variables/state.tsindex 2a12ce1325..e8601b3c93 100644--- a/frontend/src/core/variables/state.ts+++ b/frontend/src/core/variables/state.ts@@ -38,11 +38,11 @@ const {},setMetadata: (state,- metadata: Array<{+ metadata: {name: VariableName;value?: string | null;dataType?: string | null;- }>,+ }[],) => {const newVariables = { ...state };for (const { name, value, dataType } of metadata) {diff --git a/frontend/src/core/wasm/__tests__/state.test.ts b/frontend/src/core/wasm/__tests__/state.test.tsindex 65edaa11c1..d69c405091 100644--- a/frontend/src/core/wasm/__tests__/state.test.ts+++ b/frontend/src/core/wasm/__tests__/state.test.ts@@ -13,7 +13,7 @@ import { hasAnyOutputAtom } from "../state";describe("hasAnyOutputAtom", () => {const createNotebookState = (- outputs: Array<OutputMessage | null>,+ outputs: (OutputMessage | null)[],): NotebookState => ({...initialNotebookState(),cellIds: new MultiColumn([diff --git a/frontend/src/custom.d.ts b/frontend/src/custom.d.tsindex ebf84d8aab..720d05823b 100644--- a/frontend/src/custom.d.ts+++ b/frontend/src/custom.d.ts@@ -20,5 +20,5 @@ interface JSON {// Improve type inference for Array.filter with BooleanConstructorinterface Array<T> {- filter(predicate: BooleanConstructor): Array<NonNullable<T>>;+ filter(predicate: BooleanConstructor): NonNullable<T>[];}diff --git a/frontend/src/plugins/impl/DataTablePlugin.tsx b/frontend/src/plugins/impl/DataTablePlugin.tsxindex a3ffc6fd68..694e7c9f11 100644--- a/frontend/src/plugins/impl/DataTablePlugin.tsx+++ b/frontend/src/plugins/impl/DataTablePlugin.tsx@@ -112,7 +112,7 @@ export type CalculateTopKRows = (req: {column: string;k: number;}) => Promise<{- data: Array<[unknown, number]>;+ data: [unknown, number][];}>;export type PreviewColumn = (opts: { column: string }) => Promise<{@@ -221,7 +221,7 @@ type DataTableFunctions = {preview_column?: PreviewColumn;};-type S = Array<number | string | { rowId: string; columnName?: string }>;+type S = (number | string | { rowId: string; columnName?: string })[];export const DataTablePlugin = createPlugin<S>("marimo-table").withData(diff --git a/frontend/src/plugins/impl/FileUploadPlugin.tsx b/frontend/src/plugins/impl/FileUploadPlugin.tsxindex be2a397d46..a28fdbace3 100644--- a/frontend/src/plugins/impl/FileUploadPlugin.tsx+++ b/frontend/src/plugins/impl/FileUploadPlugin.tsx@@ -31,7 +31,7 @@ interface Data {max_size: number;}-type T = Array<[string, string]>;+type T = [string, string][];export class FileUploadPlugin implements IPlugin<T, Data> {tagName = "marimo-file";diff --git a/frontend/src/plugins/impl/RefreshPlugin.tsx b/frontend/src/plugins/impl/RefreshPlugin.tsxindex 760643cb64..483090137c 100644--- a/frontend/src/plugins/impl/RefreshPlugin.tsx+++ b/frontend/src/plugins/impl/RefreshPlugin.tsx@@ -20,7 +20,7 @@ interface Data {* It may also be a human-readable string like "1m" or "1h" or "3h 30m".* These will be converted to seconds.*/- options: Array<string | number>;+ options: (string | number)[];/*** The initial value.*/diff --git a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsxindex e073a95ed1..be7104fcef 100644--- a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx+++ b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx@@ -29,7 +29,7 @@ interface Data {jsUrl: string;jsHash: string;css?: string | null;- bufferPaths?: Array<Array<string | number>> | null;+ bufferPaths?: (string | number)[][] | null;initialValue: T;}@@ -179,7 +179,7 @@ async function runAnyWidgetModule(el: HTMLElement,): Promise<() => void> {const experimental: Experimental = {- invoke: async (name, msg, options) => {+ invoke: async (_name, _msg, _options) => {const message ="anywidget.invoke not supported in marimo. Please file an issue at https://github.com/marimo-team/marimo/issues";Logger.warn(message);@@ -292,7 +292,7 @@ export const visibleForTesting = {export function resolveInitialValue(raw: Record<string, any>,- bufferPaths: ReadonlyArray<ReadonlyArray<string | number>>,+ bufferPaths: readonly (readonly (string | number)[])[],) {const out = structuredClone(raw);for (const bufferPath of bufferPaths) {diff --git a/frontend/src/plugins/impl/data-editor/types.ts b/frontend/src/plugins/impl/data-editor/types.tsindex 3e48e1ab35..8ef885b9ca 100644--- a/frontend/src/plugins/impl/data-editor/types.ts+++ b/frontend/src/plugins/impl/data-editor/types.ts@@ -30,7 +30,7 @@ export interface ColumnEdit {}export interface Edits {- edits: Array<PositionalEdit | RowEdit | ColumnEdit>;+ edits: (PositionalEdit | RowEdit | ColumnEdit)[];}export type ModifiedGridColumn = GridColumn & {diff --git a/frontend/src/plugins/impl/data-explorer/components/query-form.tsx b/frontend/src/plugins/impl/data-explorer/components/query-form.tsxindex 1b50304db0..9fd26c72dc 100644--- a/frontend/src/plugins/impl/data-explorer/components/query-form.tsx+++ b/frontend/src/plugins/impl/data-explorer/components/query-form.tsx@@ -238,7 +238,7 @@ const FieldOptions = ({return null;}- let options: Array<[string, FieldFunction[]]> = [];+ let options: [string, FieldFunction[]][] = [];if (field.type === ExpandedType.QUANTITATIVE) {options = [["", QUANTITATIVE_FUNCTIONS]];diff --git a/frontend/src/plugins/impl/data-frames/types.ts b/frontend/src/plugins/impl/data-frames/types.tsindex f365f37a9d..c7b99d9301 100644--- a/frontend/src/plugins/impl/data-frames/types.ts+++ b/frontend/src/plugins/impl/data-frames/types.ts@@ -15,7 +15,7 @@ export type NumPyType = string;** We cannot use a js map, since maps don't preserve keys as ints (e.g. "1" and 1 are the same key)*/-export type RawColumnDataTypes = Array<[ColumnId, [DataType, NumPyType]]>;+export type RawColumnDataTypes = [ColumnId, [DataType, NumPyType]][];/*** Map of column Id and their data types* ES6 maps preserve keys as ints (e.g. "1" and 1 are different keys)diff --git a/frontend/src/plugins/impl/panel/PanelPlugin.tsx b/frontend/src/plugins/impl/panel/PanelPlugin.tsxindex 99171fd446..7270c9c047 100644--- a/frontend/src/plugins/impl/panel/PanelPlugin.tsx+++ b/frontend/src/plugins/impl/panel/PanelPlugin.tsx@@ -50,9 +50,9 @@ declare global {consume: (data: ArrayBuffer | string) => void;message: {content: {- events?: Array<{+ events?: {model?: { id?: string };- }>;+ }[];[key: string]: unknown;};buffers: ArrayBuffer[];diff --git a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsxindex b40a8ceb1d..b4782551ce 100644--- a/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx+++ b/frontend/src/plugins/impl/plotly/PlotlyPlugin.tsx@@ -27,7 +27,7 @@ type AxisDatum = unknown;type T =| {- points?: Array<Record<AxisName, AxisDatum>> | Plotly.PlotDatum[];+ points?: Record<AxisName, AxisDatum>[] | Plotly.PlotDatum[];indices?: number[];range?: {x?: number[];@@ -85,7 +85,7 @@ function initialLayout(figure: Figure): Partial<Plotly.Layout> {};}-const SUNBURST_DATA_KEYS: Array<keyof Plotly.SunburstPlotDatum> = [+const SUNBURST_DATA_KEYS: (keyof Plotly.SunburstPlotDatum)[] = ["color","curveNumber","entry",@@ -279,7 +279,7 @@ PlotlyComponent.displayName = "PlotlyComponent";*/function extractPoints(points: Plotly.PlotDatum[],-): Array<Record<AxisName, AxisDatum>> {+): Record<AxisName, AxisDatum>[] {if (!points) {return [];}diff --git a/frontend/src/plugins/impl/vega/__tests__/loader.test.ts b/frontend/src/plugins/impl/vega/__tests__/loader.test.tsindex 5129cdd597..d793db6136 100644--- a/frontend/src/plugins/impl/vega/__tests__/loader.test.ts+++ b/frontend/src/plugins/impl/vega/__tests__/loader.test.ts@@ -59,10 +59,10 @@ describe("DATE_MIDDLEWARE", () => {const csv = "Date,Value\n2024-13-45,100\n2024-02-30,200";// When parsing the CSV- const data = parseCsvData(csv, false) as Array<{+ const data = parseCsvData(csv, false) as {Date: string;Value: number;- }>;+ }[];// Then invalid dates should remain as stringsexpect(typeof data[0].Date).toBe("string");diff --git a/frontend/src/plugins/impl/vega/vega-component.tsx b/frontend/src/plugins/impl/vega/vega-component.tsxindex 2cff876f28..1612946802 100644--- a/frontend/src/plugins/impl/vega/vega-component.tsx+++ b/frontend/src/plugins/impl/vega/vega-component.tsx@@ -157,7 +157,7 @@ const LoadedVegaComponent = ({});const renderHelpContent = () => {- const hints: Array<[string, string]> = [];+ const hints: [string, string][] = [];if (ParamNames.hasPoint(names)) {hints.push(["Point selection",diff --git a/frontend/src/plugins/impl/vega/vega-loader.ts b/frontend/src/plugins/impl/vega/vega-loader.tsindex 7159266cba..4d9f826839 100644--- a/frontend/src/plugins/impl/vega/vega-loader.ts+++ b/frontend/src/plugins/impl/vega/vega-loader.ts@@ -7,7 +7,7 @@ import type { DataType } from "./vega-loader";// Re-export the vega-loader functions to add TypeScript typesexport function read<T = object>(- data: string | Record<string, unknown> | Array<Record<string, unknown>>,+ data: string | Record<string, unknown> | Record<string, unknown>[],format:| DataFormat| {@@ -27,7 +27,7 @@ export interface Loader {load(uri: string,options?: unknown,- ): Promise<string | Record<string, unknown> | Array<Record<string, unknown>>>;+ ): Promise<string | Record<string, unknown> | Record<string, unknown>[]>;sanitize(uri: string, options?: unknown): Promise<{ href: string }>;http(uri: string, options?: unknown): Promise<string>;file(filename: string): Promise<string>;diff --git a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx b/frontend/src/plugins/layout/NavigationMenuPlugin.tsxindex 0dd8f3968b..8a3f6f9cb5 100644--- a/frontend/src/plugins/layout/NavigationMenuPlugin.tsx+++ b/frontend/src/plugins/layout/NavigationMenuPlugin.tsx@@ -35,7 +35,7 @@ interface Data {/*** The labels for each item; raw HTML.*/- items: Array<MenuItem | MenuItemGroup>;+ items: (MenuItem | MenuItemGroup)[];/*** The orientation of the menu.diff --git a/frontend/src/plugins/plugins.ts b/frontend/src/plugins/plugins.tsindex 53028d50ed..e4172a3c54 100644--- a/frontend/src/plugins/plugins.ts+++ b/frontend/src/plugins/plugins.ts@@ -54,7 +54,7 @@ import type { IStatelessPlugin } from "./stateless-plugin";import type { IPlugin } from "./types";// List of UI plugins-export const UI_PLUGINS: Array<IPlugin<any, unknown>> = [+export const UI_PLUGINS: IPlugin<any, unknown>[] = [new ButtonPlugin(),new CheckboxPlugin(),DataTablePlugin,@@ -91,7 +91,7 @@ export const UI_PLUGINS: Array<IPlugin<any, unknown>> = [];// List of output / layout plugins-const LAYOUT_PLUGINS: Array<IStatelessPlugin<unknown>> = [+const LAYOUT_PLUGINS: IStatelessPlugin<unknown>[] = [new AccordionPlugin(),new CalloutPlugin(),new CarouselPlugin(),diff --git a/frontend/src/utils/Logger.ts b/frontend/src/utils/Logger.tsindex b45a40c640..7afab9f567 100644--- a/frontend/src/utils/Logger.ts+++ b/frontend/src/utils/Logger.ts@@ -1,5 +1,5 @@/* Copyright 2024 Marimo. All rights reserved. */-/** biome-ignore-all lint/suspicious/noConsole: for debugging */+/** biome-ignore-all lint/suspicious/noConsole: For console logging */import { Functions } from "./functions";diff --git a/frontend/src/utils/__tests__/dom.test.ts b/frontend/src/utils/__tests__/dom.test.tsindex 314f74016b..a40a12b80b 100644--- a/frontend/src/utils/__tests__/dom.test.ts+++ b/frontend/src/utils/__tests__/dom.test.ts@@ -60,14 +60,14 @@ describe("parseHtmlContent", () => {describe("ansiToPlainText", () => {test("converts ANSI color codes to plain text", () => {- const ansiString = "\x1b[31mError:\x1b[0m Something went wrong";+ const ansiString = "\u001B[31mError:\u001B[0m Something went wrong";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"Error: Something went wrong"`);});test("handles multiple ANSI color codes", () => {const ansiString =- "\x1b[32mSUCCESS:\x1b[0m \x1b[34mOperation completed\x1b[0m successfully";+ "\u001B[32mSUCCESS:\u001B[0m \u001B[34mOperation completed\u001B[0m successfully";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"SUCCESS: Operation completed successfully"`,@@ -76,14 +76,14 @@ describe("ansiToPlainText", () => {test("handles ANSI bold and color combinations", () => {const ansiString =- "\x1b[1;31mBOLD RED ERROR:\x1b[0m \x1b[33mWarning message\x1b[0m";+ "\u001B[1;31mBOLD RED ERROR:\u001B[0m \u001B[33mWarning message\u001B[0m";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"BOLD RED ERROR: Warning message"`);});test("handles Python traceback with ANSI codes", () => {const ansiString =- "\x1b[0;36m File \"\x1b[0m\x1b[0;32mtest.py\x1b[0m\x1b[0;36m\", line \x1b[0m\x1b[0;32m1\x1b[0m\x1b[0;36m, in \x1b[0m\x1b[0;35m<module>\x1b[0m\n\x1b[0;31mNameError\x1b[0m: name 'undefined_var' is not defined";+ "\u001B[0;36m File \"\u001B[0m\u001B[0;32mtest.py\u001B[0m\u001B[0;36m\", line \u001B[0m\u001B[0;32m1\u001B[0m\u001B[0;36m, in \u001B[0m\u001B[0;35m<module>\u001B[0m\n\u001B[0;31mNameError\u001B[0m: name 'undefined_var' is not defined";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`" File "test.py", line 1, in <module>@@ -93,7 +93,7 @@ describe("ansiToPlainText", () => {test("handles error messages with background colors", () => {const ansiString =- "\x1b[41;37m CRITICAL ERROR \x1b[0m \x1b[31mSystem failure detected\x1b[0m";+ "\u001B[41;37m CRITICAL ERROR \u001B[0m \u001B[31mSystem failure detected\u001B[0m";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`" CRITICAL ERROR System failure detected"`,@@ -102,7 +102,7 @@ describe("ansiToPlainText", () => {test("handles complex stack trace with mixed formatting", () => {const ansiString =- 'Traceback (most recent call last):\n \x1b[36mFile "\x1b[32m/path/to/file.py\x1b[36m", line \x1b[32m42\x1b[36m, in \x1b[35mfunction_name\x1b[0m\n \x1b[31mraise ValueError("Something went wrong")\x1b[0m\n\x1b[31mValueError\x1b[0m: Something went wrong';+ 'Traceback (most recent call last):\n \u001B[36mFile "\u001B[32m/path/to/file.py\u001B[36m", line \u001B[32m42\u001B[36m, in \u001B[35mfunction_name\u001B[0m\n \u001B[31mraise ValueError("Something went wrong")\u001B[0m\n\u001B[31mValueError\u001B[0m: Something went wrong';const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"Traceback (most recent call last):@@ -128,7 +128,7 @@ describe("ansiToPlainText", () => {test("handles whitespace and newlines correctly", () => {const ansiString =- "\x1b[31m Error: \x1b[0m\n\n \x1b[33m Warning \x1b[0m ";+ "\u001B[31m Error: \u001B[0m\n\n \u001B[33m Warning \u001B[0m ";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`" Error:@@ -139,7 +139,7 @@ describe("ansiToPlainText", () => {test("handles JavaScript error stack trace", () => {const ansiString =- "\x1b[31mReferenceError\x1b[0m: \x1b[33mvariable\x1b[0m is not defined\n at \x1b[36mObject.<anonymous>\x1b[0m (\x1b[32m/path/to/script.js\x1b[0m:\x1b[33m5\x1b[0m:\x1b[33m1\x1b[0m)";+ "\u001B[31mReferenceError\u001B[0m: \u001B[33mvariable\u001B[0m is not defined\n at \u001B[36mObject.<anonymous>\u001B[0m (\u001B[32m/path/to/script.js\u001B[0m:\u001B[33m5\u001B[0m:\u001B[33m1\u001B[0m)";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"ReferenceError: variable is not defined@@ -149,7 +149,7 @@ describe("ansiToPlainText", () => {test("handles Rust panic with ANSI formatting", () => {const ansiString =- "thread '\x1b[32mmain\x1b[0m' panicked at '\x1b[31massertion failed: `(left == right)`\x1b[0m'\n \x1b[36mleft\x1b[0m: `\x1b[33m5\x1b[0m`\n \x1b[36mright\x1b[0m: `\x1b[33m10\x1b[0m`";+ "thread '\u001B[32mmain\u001B[0m' panicked at '\u001B[31massertion failed: `(left == right)`\u001B[0m'\n \u001B[36mleft\u001B[0m: `\u001B[33m5\u001B[0m`\n \u001B[36mright\u001B[0m: `\u001B[33m10\u001B[0m`";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"thread 'main' panicked at 'assertion failed: \`(left == right)\`'@@ -160,7 +160,7 @@ describe("ansiToPlainText", () => {test("handles mix of 8-bit and 256-color ANSI codes", () => {const ansiString =- "\x1b[38;5;196mBright Red\x1b[0m and \x1b[38;5;46mBright Green\x1b[0m text";+ "\u001B[38;5;196mBright Red\u001B[0m and \u001B[38;5;46mBright Green\u001B[0m text";const result = ansiToPlainText(ansiString);expect(result).toMatchInlineSnapshot(`"Bright Red and Bright Green text"`);});diff --git a/frontend/src/utils/__tests__/id-tree.test.ts b/frontend/src/utils/__tests__/id-tree.test.tsindex 3fb76467d8..925f2cd1d7 100644--- a/frontend/src/utils/__tests__/id-tree.test.ts+++ b/frontend/src/utils/__tests__/id-tree.test.ts@@ -740,7 +740,7 @@ describe("MultiColumn", () => {});it("creates from ids and columns", () => {- const idAndColumns: Array<[string, number | undefined | null]> = [+ const idAndColumns: [string, number | undefined | null][] = [["A1", 0],["A2", 0],["B1", 1],diff --git a/frontend/src/utils/__tests__/storage.test.ts b/frontend/src/utils/__tests__/storage.test.tsindex 0cfd6185de..b86cf9e2cf 100644--- a/frontend/src/utils/__tests__/storage.test.ts+++ b/frontend/src/utils/__tests__/storage.test.ts@@ -29,7 +29,7 @@ interface TestValue {interface SerializableValue {id: string;- data: Array<[string, number]>;+ data: [string, number][];}describe("adaptForLocalStorage", () => {diff --git a/frontend/src/utils/arrays.ts b/frontend/src/utils/arrays.tsindex 7c6c2d2248..b3107806b0 100644--- a/frontend/src/utils/arrays.ts+++ b/frontend/src/utils/arrays.ts@@ -55,7 +55,7 @@ export function arrayShallowEquals<T>(a: T[], b: T[]): boolean {export const Arrays = {// eslint-disable-next-line @typescript-eslint/no-explicit-anyEMPTY: [] as any,- zip: <T, U>(a: T[], b: U[]): Array<[T, U]> => {+ zip: <T, U>(a: T[], b: U[]): [T, U][] => {invariant(a.length === b.length, "Arrays must be the same length");return a.map((item, i) => [item, b[i]]);},diff --git a/frontend/src/utils/createReducer.ts b/frontend/src/utils/createReducer.tsindex c0fb94b004..2474da985f 100644--- a/frontend/src/utils/createReducer.ts+++ b/frontend/src/utils/createReducer.ts@@ -79,11 +79,7 @@ type Middleware<State> = (export function createReducerAndAtoms<State,RH extends ReducerHandlers<NoInfer<State>>,->(- initialState: () => State,- reducers: RH,- middleware?: Array<Middleware<State>>,-) {+>(initialState: () => State, reducers: RH, middleware?: Middleware<State>[]) {const { reducer, createActions } = createReducer(initialState, reducers);const reducerWithMiddleware = (state: State, action: ReducerAction<any>) => {diff --git a/frontend/src/utils/data-views.ts b/frontend/src/utils/data-views.tsindex fca9b52834..27a10e526f 100644--- a/frontend/src/utils/data-views.ts+++ b/frontend/src/utils/data-views.ts@@ -8,7 +8,7 @@ import { Logger } from "./Logger";*/export function updateBufferPaths<T extends Record<string, unknown>>(inputObject: T,- bufferPaths: ReadonlyArray<ReadonlyArray<string | number>>,+ bufferPaths: readonly (readonly (string | number)[])[],buffers: readonly DataView[],): T {// If no buffer paths, return the original objectdiff --git a/frontend/src/utils/edit-distance.ts b/frontend/src/utils/edit-distance.tsindex 02185459c9..8156b6bdf1 100644--- a/frontend/src/utils/edit-distance.ts+++ b/frontend/src/utils/edit-distance.ts@@ -134,7 +134,7 @@ export function mergeArray<T, U>(arr2: U[],equals: (a: T, b: U) => boolean,stub: T,-): { merged: Array<T | null>; edits: EditDistanceResult } {+): { merged: (T | null)[]; edits: EditDistanceResult } {const edits = editDistanceGeneral(arr1, arr2, equals);return {merged: applyOperationsWithStub(arr1, edits.operations, stub),diff --git a/frontend/src/utils/fileToBase64.ts b/frontend/src/utils/fileToBase64.tsindex 6038f95cca..dfc89d362b 100644--- a/frontend/src/utils/fileToBase64.ts+++ b/frontend/src/utils/fileToBase64.ts@@ -34,7 +34,7 @@ export function blobToString(** Returns a promised array of tuples [file name, file contents].*/-export function filesToBase64(files: File[]): Promise<Array<[string, string]>> {+export function filesToBase64(files: File[]): Promise<[string, string][]> {return Promise.all(files.map((file) =>blobToString(file, "base64").then(diff --git a/frontend/src/utils/id-tree.tsx b/frontend/src/utils/id-tree.tsxindex 7d2beccbfe..9cb23467e3 100644--- a/frontend/src/utils/id-tree.tsx+++ b/frontend/src/utils/id-tree.tsx@@ -25,9 +25,9 @@ export type CellIndex = number & { __brand?: "CellIndex" };export class TreeNode<T> {public value: T;public isCollapsed: boolean;- public children: Array<TreeNode<T>>;+ public children: TreeNode<T>[];- constructor(value: T, isCollapsed: boolean, children: Array<TreeNode<T>>) {+ constructor(value: T, isCollapsed: boolean, children: TreeNode<T>[]) {this.value = value;this.isCollapsed = isCollapsed;this.children = children;@@ -108,10 +108,10 @@ export class TreeNode<T> {let uniqueId = 0;export class CollapsibleTree<T> {- public readonly nodes: Array<TreeNode<T>>;+ public readonly nodes: TreeNode<T>[];public readonly id: CellColumnId;- private constructor(nodes: Array<TreeNode<T>>, id: CellColumnId) {+ private constructor(nodes: TreeNode<T>[], id: CellColumnId) {this.nodes = nodes;this.id = id;}@@ -162,7 +162,7 @@ export class CollapsibleTree<T> {return newTree;}- withNodes(nodes: Array<TreeNode<T>>): CollapsibleTree<T> {+ withNodes(nodes: TreeNode<T>[]): CollapsibleTree<T> {return new CollapsibleTree(nodes, this.id);}@@ -307,7 +307,7 @@ export class CollapsibleTree<T> {* Does not collapse the children of already collapsed nodes*/collapseAll(- collapseRanges: Array<{ id: T; until: T | undefined } | null>,+ collapseRanges: ({ id: T; until: T | undefined } | null)[],): CollapsibleTree<T> {const nodes = [...this.nodes];if (collapseRanges.length === 0) {@@ -541,7 +541,7 @@ export class CollapsibleTree<T> {*/find(id: T): T[] {// We need to recursively find the node- function findNode(nodes: Array<TreeNode<T>>, path: T[]): T[] {+ function findNode(nodes: TreeNode<T>[], path: T[]): T[] {for (const node of nodes) {if (node.value === id) {return [...path, id];@@ -587,7 +587,7 @@ export class CollapsibleTree<T> {toString(): string {let depth = 0;let result = "";- const asString = (nodes: Array<TreeNode<T>>) => {+ const asString = (nodes: TreeNode<T>[]) => {for (const node of nodes) {result += `${" ".repeat(depth * 2)}${node.toString()}\n`;depth += 1;@@ -601,9 +601,9 @@ export class CollapsibleTree<T> {}export class MultiColumn<T> {- private readonly columns: ReadonlyArray<CollapsibleTree<T>>;+ private readonly columns: readonly CollapsibleTree<T>[];- constructor(columns: ReadonlyArray<CollapsibleTree<T>>) {+ constructor(columns: readonly CollapsibleTree<T>[]) {this.columns = columns;// Ensure there is always at least one column@@ -664,7 +664,7 @@ export class MultiColumn<T> {}static fromIdsAndColumns<T>(- idAndColumns: Array<[T, number | undefined | null]>,+ idAndColumns: [T, number | undefined | null][],): MultiColumn<T> {// If column is undefined, use the previous column// Ensure there is always at least one column@@ -746,7 +746,7 @@ export class MultiColumn<T> {return this.columns.length === 1;}- getColumns(): ReadonlyArray<CollapsibleTree<T>> {+ getColumns(): readonly CollapsibleTree<T>[] {return this.columns;}diff --git a/frontend/src/utils/json/json-parser.ts b/frontend/src/utils/json/json-parser.tsindex 4ffef15ac7..ca41ac5653 100644--- a/frontend/src/utils/json/json-parser.ts+++ b/frontend/src/utils/json/json-parser.ts@@ -34,7 +34,7 @@ export function jsonParseWithSpecialChar<T = unknown>(/(?<=\s|^|\[|,|:)(NaN|-Infinity|Infinity)(?=(?:[^"'\\]*(\\.|'([^'\\]*\\.)*[^'\\]*'|"([^"\\]*\\.)*[^"\\]*"))*[^"']*$)/g,`"${CHAR}$1${CHAR}"`,);- return JSON.parse(value, (key, v) => {+ return JSON.parse(value, (_key, v) => {if (typeof v !== "string") {return v;}@@ -54,7 +54,7 @@ export function jsonParseWithSpecialChar<T = unknown>(}}-export function jsonToTSV(json: Array<Record<string, unknown>>) {+export function jsonToTSV(json: Record<string, unknown>[]) {if (json.length === 0) {return "";}diff --git a/frontend/src/utils/mergeRefs.ts b/frontend/src/utils/mergeRefs.tsindex 115e0923d6..2996964d86 100644--- a/frontend/src/utils/mergeRefs.ts+++ b/frontend/src/utils/mergeRefs.ts@@ -1,6 +1,6 @@/* Copyright 2024 Marimo. All rights reserved. */export function mergeRefs<T>(- ...refs: Array<React.Ref<T>>+ ...refs: React.Ref<T>[]): (value: T | null) => void {return (value) => {refs.forEach((ref) => {diff --git a/frontend/src/utils/objects.ts b/frontend/src/utils/objects.tsindex e388377153..b47b178514 100644--- a/frontend/src/utils/objects.ts+++ b/frontend/src/utils/objects.ts@@ -17,14 +17,14 @@ export const Objects = {/*** Type-safe Object.fromEntries*/- fromEntries<K extends string | number, V>(obj: Array<[K, V]>): Record<K, V> {+ fromEntries<K extends string | number, V>(obj: [K, V][]): Record<K, V> {return Object.fromEntries(obj) as Record<K, V>;},/*** Type-safe Object.entries*/- entries<K extends string | number, V>(obj: Record<K, V>): Array<[K, V]> {- return Object.entries(obj) as Array<[K, V]>;+ entries<K extends string | number, V>(obj: Record<K, V>): [K, V][] {+ return Object.entries(obj) as [K, V][];},/*** Type-safe Object.keysdiff --git a/frontend/src/utils/pluralize.ts b/frontend/src/utils/pluralize.tsindex cddce434c0..765fd6aaea 100644--- a/frontend/src/utils/pluralize.ts+++ b/frontend/src/utils/pluralize.ts@@ -25,7 +25,7 @@ export class PluralWords {this.words = words;}- static of(...words: Array<PluralWord | string>) {+ static of(...words: (PluralWord | string)[]) {return new PluralWords(words.map((word) => {if (typeof word === "string") {diff --git a/frontend/src/utils/routes.ts b/frontend/src/utils/routes.tsindex ef0906d662..461d7842c1 100644--- a/frontend/src/utils/routes.ts+++ b/frontend/src/utils/routes.ts@@ -8,10 +8,10 @@ import {} from "path-to-regexp";export class TinyRouter {- private routes: Array<{+ private routes: {template: string;pathFunction: MatchFunction<ParamData>;- }>;+ }[];constructor(templates: string[]) {this.routes = templates.map((template) => {diff --git a/frontend/src/utils/sets.ts b/frontend/src/utils/sets.tsindex 16d3a4123d..7ced73ac5d 100644--- a/frontend/src/utils/sets.ts+++ b/frontend/src/utils/sets.ts@@ -3,7 +3,7 @@ export const Sets = {/*** Merge multiple iterables into a single set.*/- merge<T>(...sets: Array<Iterable<T>>): Set<T> {+ merge<T>(...sets: Iterable<T>[]): Set<T> {const result = new Set<T>();for (const set of sets) {for (const item of set) {diff --git a/packages/llm-info/src/generate.ts b/packages/llm-info/src/generate.tsindex 4a2eea315e..af4b8bc7f3 100644--- a/packages/llm-info/src/generate.ts+++ b/packages/llm-info/src/generate.ts@@ -5,6 +5,7 @@ import { dirname, join } from "node:path";import { fileURLToPath } from "node:url";import { parse } from "yaml";import { z } from "zod";+import { Logger } from "./simple_logger.ts";const ROLES = ["chat", "edit", "rerank", "embed"] as const;@@ -34,7 +35,7 @@ function ensureDirectoryExists(filePath: string): void {} catch (error: any) {// Ignore error if directory already exists, otherwise rethrowif (error?.code !== "EEXIST") {- console.error("Failed to create directory:", error);+ Logger.error("Failed to create directory:", error);throw error;}}@@ -53,7 +54,7 @@ function loadAndValidateModels(yamlPath: string): any[] {try {return LLMInfoSchema.parse(model);} catch (error) {- console.error(`Validation failed for model at index ${index}:`, error);+ Logger.error(`Validation failed for model at index ${index}:`, error);throw new Error(`Model validation failed at index ${index}: ${JSON.stringify(model, null, 2)}`,);@@ -76,7 +77,7 @@ function loadAndValidateProviders(yamlPath: string): any[] {try {return ProviderSchema.parse(provider);} catch (error) {- console.error(`Validation failed for provider at index ${index}:`, error);+ Logger.error(`Validation failed for provider at index ${index}:`, error);throw new Error(`Provider validation failed at index ${index}: ${JSON.stringify(provider, null, 2)}`,);@@ -113,14 +114,14 @@ async function main(): Promise<void> {const providers = loadAndValidateProviders(providersYamlPath);writeJsonFile(providersJsonPath, { providers: providers });- console.log(+ Logger.info(`Generated ${models.length} models and ${providers.length} providers`,);} catch (error) {- console.error("Generation failed:", error);+ Logger.error("Generation failed:", error);process.exit(1);}}// Run the script-main().catch(console.error);+main().catch(Logger.error);diff --git a/packages/llm-info/src/simple_logger.ts b/packages/llm-info/src/simple_logger.tsnew file mode 100644index 0000000000..d970a7e808--- /dev/null+++ b/packages/llm-info/src/simple_logger.ts@@ -0,0 +1,66 @@+/* Copyright 2025 Marimo. All rights reserved. */++/** biome-ignore-all lint/suspicious/noConsole: For logging */++declare global {+ interface Window {+ SimpleLogger?: SimpleLogger;+ }+}++class SimpleLogger {+ name: string;++ constructor(name = "LLM Info") {+ this.name = name;+ }++ _log(+ level: "info" | "warn" | "error" | "debug",+ message: string,+ ...args: any[]+ ) {+ const timestamp = new Date().toISOString();+ const topMessage = `${timestamp} [${this.name}] [${level.toUpperCase()}] ${message}`;++ switch (level) {+ case "info":+ console.info(topMessage, ...args);+ break;+ case "warn":+ console.warn(topMessage, ...args);+ break;+ case "error":+ console.error(topMessage, ...args);+ break;+ case "debug":+ console.debug(topMessage, ...args);+ break;+ }+ }++ info(message: string, ...args: any[]) {+ this._log("info", message, ...args);+ }++ warn(message: string, ...args: any[]) {+ this._log("warn", message, ...args);+ }++ error(message: string, ...args: any[]) {+ this._log("error", message, ...args);+ }++ debug(message: string, ...args: any[]) {+ this._log("debug", message, ...args);+ }+}++function getLogger(): SimpleLogger {+ if (typeof window !== "undefined") {+ return window.SimpleLogger || new SimpleLogger();+ }+ return new SimpleLogger();+}++export const Logger = getLogger();diff --git a/packages/llm-info/tsconfig.json b/packages/llm-info/tsconfig.jsonindex e7cb22ba18..18e2733f38 100644--- a/packages/llm-info/tsconfig.json+++ b/packages/llm-info/tsconfig.json@@ -2,6 +2,8 @@"extends": "@marimo-team/tsconfig/library.json","compilerOptions": {"outDir": "./dist",- "rootDir": "./src"+ "rootDir": "./src",+ "allowImportingTsExtensions": true,+ "noEmit": true}}diff --git a/packages/lsp/index.ts b/packages/lsp/index.tsindex cbb924388a..68ea95c67a 100644--- a/packages/lsp/index.ts+++ b/packages/lsp/index.ts@@ -29,21 +29,25 @@ class Logger {try {await appendFile(this.logFilePath, `${log}\n`);} catch (error) {+ // biome-ignore lint/suspicious/noConsole: For printing to the consoleconsole.error("Failed to write to log file:", error);}}debug(...args: Parameters<typeof console.log>): void {+ // biome-ignore lint/suspicious/noConsole: For printing to the consoleconsole.log(...args);void this.appendToLogFile("[DEBUG]", ...args);}log(...args: Parameters<typeof console.log>): void {+ // biome-ignore lint/suspicious/noConsole: For printing to the consoleconsole.log(...args);void this.appendToLogFile("[INFO]", ...args);}error(...args: Parameters<typeof console.error>): void {+ // biome-ignore lint/suspicious/noConsole: For printing to the consoleconsole.error(...args);void this.appendToLogFile("[ERROR]", ...args);}@@ -172,6 +176,7 @@ async function main(): Promise<void> {const argv = parseArgs(process.argv);if (argv.help) {+ // biome-ignore lint/suspicious/noConsole: For printing to the consoleconsole.log('Usage: node index.cjs --log-file <path> --lsp "<command>" [--port <port>]',);diff --git a/packages/openapi/convert_types.js b/packages/openapi/convert_types.jsindex d4aab91dc3..30e4fbbafa 100644--- a/packages/openapi/convert_types.js+++ b/packages/openapi/convert_types.js@@ -1,3 +1,5 @@+/* Copyright 2024 Marimo. All rights reserved. */+/** biome-ignore-all lint/suspicious/noConsole: for debugging */// @ts-checkimport * as fs from "node:fs";import * as process from "node:process";