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: enable more biome rules (#2117)

Myles Scolnick729244508dfc
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 19dc8e2dc7..49c6d4c4d2 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -31,7 +31,7 @@ repos:
rev: v0.4.0
hooks:
- id: biome-check
- args: [--config-path, biome.json]
+ args: [--config-path, biome.json, --diagnostic-level, warn]
additional_dependencies: ['@biomejs/[email protected]']
exclude: |
(?x)^(
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 607c4c8956..eb10ce73db 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,5 +7,8 @@
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
+ },
+ "[json]": {
+ "editor.defaultFormatter": "biomejs.biome"
}
}
diff --git a/biome.json b/biome.json
index 6183906abc..04d7ebc625 100644
--- a/biome.json
+++ b/biome.json
@@ -39,47 +39,47 @@
"recommended": true,
"a11y": {
"noAutofocus": "off",
- "noSvgWithoutTitle": "off",
- "useButtonType": "off",
- "useIframeTitle": "off",
+ "noSvgWithoutTitle": "info",
+ "useButtonType": "info",
+ "useIframeTitle": "info",
"useKeyWithClickEvents": "off",
- "useMediaCaption": "off"
+ "useMediaCaption": "info"
},
"complexity": {
"noBannedTypes": "off",
"noForEach": "off",
- "useArrowFunction": "off"
+ "useArrowFunction": "error"
},
"correctness": {
- "noInnerDeclarations": "off",
+ "noInnerDeclarations": "error",
"noUnusedImports": "error",
"useExhaustiveDependencies": "off",
- "useHookAtTopLevel": "off"
+ "useHookAtTopLevel": "info"
},
"security": {
"noDangerouslySetInnerHtml": "off"
},
"style": {
- "noCommaOperator": "off",
+ "noCommaOperator": "error",
"noNonNullAssertion": "off",
"noParameterAssign": "off",
- "noUnusedTemplateLiteral": "off",
+ "noUnusedTemplateLiteral": "error",
"useConsistentArrayType": "off",
- "useImportType": "off",
- "useNodejsImportProtocol": "off",
- "useSingleVarDeclarator": "off",
- "useTemplate": "off"
+ "useImportType": "error",
+ "useNodejsImportProtocol": "error",
+ "useSingleVarDeclarator": "error",
+ "useTemplate": "error"
},
"suspicious": {
"noArrayIndexKey": "off",
- "noAssignInExpressions": "off",
+ "noAssignInExpressions": "info",
"noConsoleLog": "off",
- "noDoubleEquals": "off",
- "noEmptyBlockStatements": "off",
+ "noDoubleEquals": "error",
+ "noEmptyBlockStatements": "info",
"noExplicitAny": "off",
- "noImplicitAnyLet": "off",
- "noRedeclare": "off",
- "noShadowRestrictedNames": "off"
+ "noImplicitAnyLet": "error",
+ "noRedeclare": "info",
+ "noShadowRestrictedNames": "error"
}
}
},
diff --git a/frontend/e2e-tests/bugs.spec.ts b/frontend/e2e-tests/bugs.spec.ts
index 3e4e410226..4a339af478 100644
--- a/frontend/e2e-tests/bugs.spec.ts
+++ b/frontend/e2e-tests/bugs.spec.ts
@@ -32,7 +32,7 @@ test("correctly initializes cells", async ({ page }, info) => {
await createCellBelow({
page,
cellSelector: "text=bug 1",
- content: `bug_1`,
+ content: "bug_1",
run: true,
});
diff --git a/frontend/islands/vite.config.mts b/frontend/islands/vite.config.mts
index 27df09ce0d..2c4ab55be4 100644
--- a/frontend/islands/vite.config.mts
+++ b/frontend/islands/vite.config.mts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
import { type Plugin, defineConfig } from "vite";
-import fs from "fs";
-import path from "path";
+import fs from "node:fs";
+import path from "node:path";
import react from "@vitejs/plugin-react-swc";
import tsconfigPaths from "vite-tsconfig-paths";
import packageJson from "../package.json";
@@ -16,7 +16,7 @@ const htmlDevPlugin = (): Plugin => {
"utf-8",
);
- return "<!DOCTYPE html>\n" + indexHtml;
+ return `<!DOCTYPE html>\n${indexHtml}`;
},
};
};
diff --git a/frontend/package.json b/frontend/package.json
index ece1eb01f2..9957b5997f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -148,7 +148,7 @@
"build": "vite build",
"test": "vitest",
"typecheck": "tsc --noEmit",
- "lint": "run-s lint:eslint lint:stylelint format",
+ "lint": "run-s lint:eslint lint:stylelint lint:biome format",
"lint:biome": "biome lint --write .",
"lint:eslint": "TIMING=1 eslint src e2e-tests --max-warnings=0 --fix",
"lint:stylelint": "stylelint src/**/*.css --fix",
diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts
index d3882aa8e6..81470e4613 100644
--- a/frontend/playwright.config.ts
+++ b/frontend/playwright.config.ts
@@ -108,7 +108,7 @@ export function startServer(app: ApplicationNames): void {
}
const WASM_SERVER = {
- command: `PYODIDE=true vite --port 3000`,
+ command: "PYODIDE=true vite --port 3000",
url: "http://localhost:3000",
reuseExistingServer: !!process.env.CI,
};
diff --git a/frontend/src/components/debugger/debugger-code.tsx b/frontend/src/components/debugger/debugger-code.tsx
index a0e942d9f2..7c48743dfe 100644
--- a/frontend/src/components/debugger/debugger-code.tsx
+++ b/frontend/src/components/debugger/debugger-code.tsx
@@ -47,7 +47,7 @@ const DebuggerOutput: React.FC<{
ref={ref}
theme="dark"
value={props.code}
- className={`[&>*]:outline-none [&>.cm-editor]:pr-0 overflow-hidden dark`}
+ className={"[&>*]:outline-none [&>.cm-editor]:pr-0 overflow-hidden dark"}
readOnly={true}
editable={false}
basicSetup={{
@@ -89,7 +89,9 @@ const DebuggerInput: React.FC<{
<ReactCodeMirror
minHeight="18px"
theme="dark"
- className={`debugger-input [&>*]:outline-none cm-focused [&>.cm-editor]:pr-0 overflow-hidden dark border-t-4`}
+ className={
+ "debugger-input [&>*]:outline-none cm-focused [&>.cm-editor]:pr-0 overflow-hidden dark border-t-4"
+ }
value={value}
autoFocus={true}
basicSetup={{
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 2c78943c52..3a6af39ab1 100644
--- a/frontend/src/components/editor/ai/add-cell-with-ai.tsx
+++ b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
@@ -31,7 +31,7 @@ export const AddCellWithAI: React.FC<{
handleInputChange,
handleSubmit,
} = useCompletion({
- api: asURL(`api/ai/completion`).toString(),
+ api: asURL("api/ai/completion").toString(),
headers: API.headers(),
streamMode: "text",
body: {
diff --git a/frontend/src/components/editor/links/cell-link.tsx b/frontend/src/components/editor/links/cell-link.tsx
index 026813d910..e05c4d4042 100644
--- a/frontend/src/components/editor/links/cell-link.tsx
+++ b/frontend/src/components/editor/links/cell-link.tsx
@@ -38,7 +38,7 @@ export const CellLink = (props: Props): JSX.Element => {
onClick={(e) => {
// Scratch causes a crash since scratch is not registered like a
// normal cell.
- if (cellId == SCRATCH_CELL_ID) {
+ if (cellId === SCRATCH_CELL_ID) {
return false;
}
showCellIfHidden({ cellId });
@@ -78,7 +78,7 @@ export const CellLinkTraceback = ({
variant={"destructive"}
className="traceback-cell-link"
formatCellName={(name: string) =>
- cellId == SCRATCH_CELL_ID
+ cellId === SCRATCH_CELL_ID
? "scratch"
: `marimo://${filename || "untitled"}#cell=${name}`
}
diff --git a/frontend/src/components/editor/output/CalloutOutput.styles.ts b/frontend/src/components/editor/output/CalloutOutput.styles.ts
index 7cea822922..b120a0eaca 100644
--- a/frontend/src/components/editor/output/CalloutOutput.styles.ts
+++ b/frontend/src/components/editor/output/CalloutOutput.styles.ts
@@ -6,13 +6,14 @@ export const calloutStyles = cva(
{
variants: {
kind: {
- neutral: `border-[var(--slate-9)] shadow-[var(--slate-8)]`,
+ neutral: "border-[var(--slate-9)] shadow-[var(--slate-8)]",
// @deprecated, use danger instead
- alert: `bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]`,
- info: `bg-[var(--sky-1)] border-[var(--sky-8)] shadow-[var(--sky-7)]`,
- danger: `bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]`,
- warn: `bg-[var(--amber-2)] border-[var(--amber-9)] shadow-[var(--amber-8)]`,
- success: `bg-[var(--grass-2)] border-[var(--grass-9)] shadow-[var(--grass-8)]`,
+ alert: "bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]",
+ info: "bg-[var(--sky-1)] border-[var(--sky-8)] shadow-[var(--sky-7)]",
+ danger: "bg-[var(--red-2)] border-[var(--red-9)] shadow-[var(--red-8)]",
+ warn: "bg-[var(--amber-2)] border-[var(--amber-9)] shadow-[var(--amber-8)]",
+ success:
+ "bg-[var(--grass-2)] border-[var(--grass-9)] shadow-[var(--grass-8)]",
},
},
defaultVariants: {
diff --git a/frontend/src/components/editor/output/JsonOutput.tsx b/frontend/src/components/editor/output/JsonOutput.tsx
index a7208af9b6..ab93bc7976 100644
--- a/frontend/src/components/editor/output/JsonOutput.tsx
+++ b/frontend/src/components/editor/output/JsonOutput.tsx
@@ -131,6 +131,6 @@ function renderLeaf(
try {
return render(leafData(leaf));
} catch {
- return <TextOutput text={`Invalid leaf: {leaf}`} />;
+ return <TextOutput text={"Invalid leaf: {leaf}"} />;
}
}
diff --git a/frontend/src/components/editor/output/MarimoErrorOutput.tsx b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
index 018943c9f4..8a9ba2f5e1 100644
--- a/frontend/src/components/editor/output/MarimoErrorOutput.tsx
+++ b/frontend/src/components/editor/output/MarimoErrorOutput.tsx
@@ -62,7 +62,7 @@ export const MarimoErrorOutput = ({
<CellLinkError cellId={edge[0] as CellId} />
<span className="text-muted-foreground">
{" -> "}
- {edge[1].length == 1 ? edge[1] : edge[1].join(", ")}
+ {edge[1].length === 1 ? edge[1] : edge[1].join(", ")}
{" -> "}
</span>
<CellLinkError cellId={edge[2] as CellId} />
@@ -98,8 +98,7 @@ export const MarimoErrorOutput = ({
return (
<Fragment key={idx}>
<div className="mt-4">
- {`The variable '${error.name}' can't be deleted because it was defined by another cell ` +
- `(`}
+ {`The variable '${error.name}' can't be deleted because it was defined by another cell (`}
<CellLinkError cellId={error.cells[0] as CellId} />
{")"}
</div>
diff --git a/frontend/src/core/cells/collapseConsoleOutputs.tsx b/frontend/src/core/cells/collapseConsoleOutputs.tsx
index b122491b5f..e7b6d8d966 100644
--- a/frontend/src/core/cells/collapseConsoleOutputs.tsx
+++ b/frontend/src/core/cells/collapseConsoleOutputs.tsx
@@ -95,7 +95,7 @@ function handleCarriageReturns(
function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
let nLines = 0;
- let i;
+ let i: number;
for (i = consoleOutputs.length - 1; i >= 0 && nLines < limit; i--) {
const output: OutputMessage = consoleOutputs[i];
if (output.mimetype === "text/plain") {
@@ -118,7 +118,7 @@ function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
timestamp: -1,
};
const output = consoleOutputs[cutoff];
- if (output.mimetype == "text/plain") {
+ if (output.mimetype === "text/plain") {
invariant(typeof output.data === "string", "expected string");
const output_lines = output.data.split("\n");
const nLinesAfterOutput = nLines - output_lines.length;
diff --git a/frontend/src/core/codemirror/__tests__/setup.test.ts b/frontend/src/core/codemirror/__tests__/setup.test.ts
index af21829fa1..6cbe48433e 100644
--- a/frontend/src/core/codemirror/__tests__/setup.test.ts
+++ b/frontend/src/core/codemirror/__tests__/setup.test.ts
@@ -101,7 +101,7 @@ describe("snapshot all duplicate keymaps", () => {
);
// Total duplicates:
// if this changes, please make sure to validate they are not conflicting
- expect(Object.values(duplicates).flat().length).toMatchInlineSnapshot(`20`);
+ expect(Object.values(duplicates).flat().length).toMatchInlineSnapshot("20");
expect(duplicates).toMatchSnapshot();
});
@@ -114,7 +114,7 @@ describe("snapshot all duplicate keymaps", () => {
);
// Total duplicates:
// if this changes, please make sure to validate they are not conflicting
- expect(Object.values(duplicates).flat().length).toMatchInlineSnapshot(`19`);
+ expect(Object.values(duplicates).flat().length).toMatchInlineSnapshot("19");
expect(duplicates).toMatchSnapshot();
});
});
diff --git a/frontend/src/core/codemirror/find-replace/search-highlight.ts b/frontend/src/core/codemirror/find-replace/search-highlight.ts
index e7d2044a04..080c6059aa 100644
--- a/frontend/src/core/codemirror/find-replace/search-highlight.ts
+++ b/frontend/src/core/codemirror/find-replace/search-highlight.ts
@@ -99,7 +99,7 @@ export const searchHighlighter = ViewPlugin.fromClass(
update(update: ViewUpdate) {
const state = update.state.field(searchState);
if (
- state != update.startState.field(searchState) ||
+ state !== update.startState.field(searchState) ||
update.docChanged ||
update.selectionSet ||
update.viewportChanged
@@ -124,7 +124,7 @@ export const searchHighlighter = ViewPlugin.fromClass(
}
query.highlight(view.state, from, to, (from, to) => {
const selected = view.state.selection.ranges.some(
- (r) => r.from == from && r.to == to,
+ (r) => r.from === from && r.to === to,
);
builder.add(from, to, selected ? selectedMatchMark : matchMark);
});
diff --git a/frontend/src/core/codemirror/language/__tests__/sql.test.ts b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
index 5fe44349f0..f70578c7aa 100644
--- a/frontend/src/core/codemirror/language/__tests__/sql.test.ts
+++ b/frontend/src/core/codemirror/language/__tests__/sql.test.ts
@@ -59,7 +59,7 @@ describe("SQLLanguageAdapter", () => {
const pythonCode = 'next_df = print("Hello, World!")';
expect(() =>
adapter.transformIn(pythonCode),
- ).toThrowErrorMatchingInlineSnapshot(`[Error: Not supported]`);
+ ).toThrowErrorMatchingInlineSnapshot("[Error: Not supported]");
});
it("should handle an empty string", () => {
diff --git a/frontend/src/core/codemirror/language/markdown.ts b/frontend/src/core/codemirror/language/markdown.ts
index be455e307d..42789f5644 100644
--- a/frontend/src/core/codemirror/language/markdown.ts
+++ b/frontend/src/core/codemirror/language/markdown.ts
@@ -149,7 +149,7 @@ export class MarkdownLanguageAdapter implements LanguageAdapter {
// Find all { } groupings
const pattern = /{(.*?)}/g;
- let match;
+ let match: RegExpExecArray | null;
while ((match = pattern.exec(text)) !== null) {
const start = match.index + 1;
diff --git a/frontend/src/core/codemirror/markdown/commands.ts b/frontend/src/core/codemirror/markdown/commands.ts
index 516055d015..a33d8b1bd1 100644
--- a/frontend/src/core/codemirror/markdown/commands.ts
+++ b/frontend/src/core/codemirror/markdown/commands.ts
@@ -274,8 +274,8 @@ export function insertUL(view: EditorView) {
}
const { changes } = view.state.changeByRange((range) => {
- const markupOne = `- `;
- const markupTwo = `* `;
+ const markupOne = "- ";
+ const markupTwo = "* ";
const rangeText = view.state
.sliceDoc(range.from, range.to + markupTwo.length)
diff --git a/frontend/src/core/wasm/worker/getPyodideVersion.ts b/frontend/src/core/wasm/worker/getPyodideVersion.ts
index 205fcf7079..db267b5262 100644
--- a/frontend/src/core/wasm/worker/getPyodideVersion.ts
+++ b/frontend/src/core/wasm/worker/getPyodideVersion.ts
@@ -11,7 +11,7 @@ export async function importPyodide(marimoVersion: string) {
// Vite does not like imports with dynamic urls
return marimoVersion.includes("dev") && ALLOW_DEV_VERSIONS
? // @ts-expect-error typescript does not like
- await import(`https://cdn.jsdelivr.net/pyodide/dev/full/pyodide.js`)
+ await import("https://cdn.jsdelivr.net/pyodide/dev/full/pyodide.js")
: // @ts-expect-error typescript does not like
- await import(`https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js`);
+ await import("https://cdn.jsdelivr.net/pyodide/v0.26.2/full/pyodide.js");
}
diff --git a/frontend/src/plugins/core/__test__/RenderHTML.test.ts b/frontend/src/plugins/core/__test__/RenderHTML.test.ts
index 132e2fad88..e7562daf5e 100644
--- a/frontend/src/plugins/core/__test__/RenderHTML.test.ts
+++ b/frontend/src/plugins/core/__test__/RenderHTML.test.ts
@@ -54,13 +54,13 @@ describe("RenderHTML", () => {
test("custom tags - valid", () => {
let html = "<foobar></foobar>";
- expect(renderHTML({ html })).toMatchInlineSnapshot(`<foobar />`);
+ expect(renderHTML({ html })).toMatchInlineSnapshot("<foobar />");
html = "<foobar2></foobar2>";
- expect(renderHTML({ html })).toMatchInlineSnapshot(`<foobar2 />`);
+ expect(renderHTML({ html })).toMatchInlineSnapshot("<foobar2 />");
html = "<marimo-slider></marimo-slider>";
- expect(renderHTML({ html })).toMatchInlineSnapshot(`<marimo-slider />`);
+ expect(renderHTML({ html })).toMatchInlineSnapshot("<marimo-slider />");
});
test("custom tags - invalid", () => {
diff --git a/frontend/src/plugins/impl/common/error-banner.tsx b/frontend/src/plugins/impl/common/error-banner.tsx
index 56624150c7..48b1e1f8d0 100644
--- a/frontend/src/plugins/impl/common/error-banner.tsx
+++ b/frontend/src/plugins/impl/common/error-banner.tsx
@@ -61,9 +61,10 @@ export const ErrorBanner = ({
const bannerStyle = cva("text-sm p-2 border whitespace-pre-wrap", {
variants: {
kind: {
- danger: `text-error border-[var(--red-6)] shadow-smError bg-[var(--red-1)]`,
- info: `text-primary border-[var(--blue-6)] shadow-smAccent bg-[var(--blue-1)]`,
- warn: `text-warning border-[var(--yellow-6)] bg-[var(--yellow-2)]`,
+ danger:
+ "text-error border-[var(--red-6)] shadow-smError bg-[var(--red-1)]",
+ info: "text-primary border-[var(--blue-6)] shadow-smAccent bg-[var(--blue-1)]",
+ warn: "text-warning border-[var(--yellow-6)] bg-[var(--yellow-2)]",
},
clickable: {
true: "cursor-pointer",
diff --git a/frontend/src/plugins/impl/data-frames/forms/form-utils.ts b/frontend/src/plugins/impl/data-frames/forms/form-utils.ts
index 31fe09d2ed..f9066d83ce 100644
--- a/frontend/src/plugins/impl/data-frames/forms/form-utils.ts
+++ b/frontend/src/plugins/impl/data-frames/forms/form-utils.ts
@@ -77,5 +77,5 @@ export function getUnionLiteral<T extends z.ZodType<unknown>>(
if (schema instanceof z.ZodUnion) {
return getUnionLiteral(schema._def.options[0]);
}
- throw new Error(`Invalid schema`);
+ throw new Error("Invalid schema");
}
diff --git a/frontend/src/plugins/impl/data-frames/forms/form.tsx b/frontend/src/plugins/impl/data-frames/forms/form.tsx
index bb14f8d663..02326f79b2 100644
--- a/frontend/src/plugins/impl/data-frames/forms/form.tsx
+++ b/frontend/src/plugins/impl/data-frames/forms/form.tsx
@@ -619,7 +619,7 @@ const FilterForm = ({
const children = [
<ColumnFormField
- key={`column_id`}
+ key={"column_id"}
schema={columnIdSchema}
form={form}
path={`${path}.column_id`}
@@ -654,7 +654,7 @@ const FilterForm = ({
if (operators.length === 0) {
children.push(
<div
- key={`no_operator`}
+ key={"no_operator"}
className="text-muted-foreground text-xs font-semibold"
>
<FormLabel className="whitespace-pre"> </FormLabel>
@@ -664,7 +664,7 @@ const FilterForm = ({
} else {
children.push(
<FormField
- key={`operator`}
+ key={"operator"}
control={form.control}
name={`${path}.operator`}
render={({ field }) => (
@@ -706,7 +706,7 @@ const FilterForm = ({
const operandSchemas = getSchemaForOperator(dtype, operator);
if (operandSchemas.length === 1) {
children.push(
- <React.Fragment key={`value`}>
+ <React.Fragment key={"value"}>
<ColumnNameContext.Provider value={columnId}>
{renderZodSchema(operandSchemas[0], form, `${path}.value`)}
</ColumnNameContext.Provider>
diff --git a/frontend/src/plugins/impl/vega/__tests__/vega.test.ts b/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
index 6c2904ef81..64131a45ee 100644
--- a/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
+++ b/frontend/src/plugins/impl/vega/__tests__/vega.test.ts
@@ -97,7 +97,7 @@ yield_error,yield_center
});
it("should parse csv data with out of bound integers", async () => {
- const csvData = `id\n912312851340981241284`;
+ const csvData = "id\n912312851340981241284";
vi.spyOn(vegaLoader, "load").mockReturnValue(Promise.resolve(csvData));
const data = await vegaLoadData(
@@ -128,7 +128,7 @@ yield_error,yield_center
});
it("should handle when there is no format given", async () => {
- const csvData = `id\n912312851340981241284`;
+ const csvData = "id\n912312851340981241284";
vi.spyOn(vegaLoader, "load").mockReturnValue(Promise.resolve(csvData));
const format = undefined;
const data = await vegaLoadData(csvData, format, { handleBigInt: true });
diff --git a/frontend/src/utils/__tests__/id-tree.test.ts b/frontend/src/utils/__tests__/id-tree.test.ts
index c55fadbbc4..95261b82fb 100644
--- a/frontend/src/utils/__tests__/id-tree.test.ts
+++ b/frontend/src/utils/__tests__/id-tree.test.ts
@@ -104,7 +104,7 @@ describe("CollapsibleTree", () => {
expect(() =>
tree.collapse("five", undefined),
).toThrowErrorMatchingInlineSnapshot(
- `[Error: Node five not found in tree. Valid ids: one,two,three,four]`,
+ "[Error: Node five not found in tree. Valid ids: one,two,three,four]",
);
expect(() =>
tree.collapse("one", "five"),
@@ -141,7 +141,7 @@ describe("CollapsibleTree", () => {
it("fails to expand", () => {
expect(() => tree.expand("five")).toThrowErrorMatchingInlineSnapshot(
- `[Error: Node five not found in tree. Valid ids: one,two,three,four]`,
+ "[Error: Node five not found in tree. Valid ids: one,two,three,four]",
);
expect(() => {
tree.expand("one");
@@ -305,7 +305,7 @@ describe("CollapsibleTree", () => {
it("fails to delete nodes", () => {
expect(() => tree.delete(5)).toThrowErrorMatchingInlineSnapshot(
- `[Error: Node at index 5 not found in tree]`,
+ "[Error: Node at index 5 not found in tree]",
);
});
@@ -351,7 +351,7 @@ describe("CollapsibleTree", () => {
it("atOrThrow throws if not found", () => {
expect(() => tree.atOrThrow(5)).toThrowErrorMatchingInlineSnapshot(
- `[Error: Node at index 5 not found in tree]`,
+ "[Error: Node at index 5 not found in tree]",
);
});
@@ -400,6 +400,6 @@ describe("CollapsibleTree", () => {
`);
// We only get descendants of the top level
- expect(tree.getDescendants("three")).toMatchInlineSnapshot(`[]`);
+ expect(tree.getDescendants("three")).toMatchInlineSnapshot("[]");
});
});
diff --git a/frontend/src/utils/staticImplements.ts b/frontend/src/utils/staticImplements.ts
index 2d615ff1b6..fccd9707e0 100644
--- a/frontend/src/utils/staticImplements.ts
+++ b/frontend/src/utils/staticImplements.ts
@@ -1,7 +1,7 @@
/* Copyright 2024 Marimo. All rights reserved. */
export function staticImplements<T>() {
- return <U extends T>(constructor: U) => {
+ return <U extends T>(_constructor: U) => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
- constructor;
+ _constructor;
};
}
diff --git a/frontend/vite.config.mts b/frontend/vite.config.mts
index 858694aae2..030706d817 100644
--- a/frontend/vite.config.mts
+++ b/frontend/vite.config.mts
@@ -46,7 +46,7 @@ const htmlDevPlugin = (): Plugin => {
}
html = html.replace("{{ filename }}", "notebook.py");
html = html.replace("{{ mode }}", modeFromUrl);
- html = html.replace(/<\/head>/, `<marimo-wasm></marimo-wasm></head>`);
+ html = html.replace(/<\/head>/, "<marimo-wasm></marimo-wasm></head>");
return html;
}
@@ -100,7 +100,7 @@ const htmlDevPlugin = (): Plugin => {
devDoc.head.append(element);
});
- return "<!DOCTYPE html>\n" + devDoc.documentElement.outerHTML;
+ return `<!DOCTYPE html>\n${devDoc.documentElement.outerHTML}`;
},
};
};
diff --git a/lsp/index.ts b/lsp/index.ts
index 209f80bfc0..072d16e619 100644
--- a/lsp/index.ts
+++ b/lsp/index.ts
@@ -1,16 +1,17 @@
-import * as http from "http";
+import type * as http from "node:http";
import parseArgs from "minimist";
-import ws, { WebSocketServer } from "ws";
-import * as rpc from "@sourcegraph/vscode-ws-jsonrpc";
+import type ws from "ws";
+import { WebSocketServer } from "ws";
+import type * as rpc from "@sourcegraph/vscode-ws-jsonrpc";
import * as rpcServer from "@sourcegraph/vscode-ws-jsonrpc/lib/server";
-import path from "path";
+import path from "node:path";
// Adapted from https://github.com/wylieconlon/jsonrpc-ws-proxy
const argv = parseArgs(process.argv.slice(2));
if (argv.help) {
- console.log(`Usage: index.js --port 3000`);
+ console.log("Usage: index.js --port 3000");
process.exit(1);
}
@@ -53,7 +54,7 @@ wss.on("connection", (client: ws, request: http.IncomingMessage) => {
let langServer: string[] | undefined;
Object.keys(languageServers).forEach((key) => {
- if (request.url === "/" + key) {
+ if (request.url === `/${key}`) {
langServer = languageServers[key];
}
});
@@ -73,7 +74,7 @@ wss.on("connection", (client: ws, request: http.IncomingMessage) => {
const connection = rpcServer.createWebSocketConnection(socket);
rpcServer.forward(connection, localConnection);
- console.log(`Forwarding new client`);
+ console.log("Forwarding new client");
socket.onClose((code, reason) => {
console.log("Client closed", reason);
diff --git a/openapi/src/index.ts b/openapi/src/index.ts
index 20195f0d24..9d04d55d57 100644
--- a/openapi/src/index.ts
+++ b/openapi/src/index.ts
@@ -1,6 +1,6 @@
export type * from "./api";
-import createClient, { ClientOptions } from "openapi-fetch";
+import createClient, { type ClientOptions } from "openapi-fetch";
import type { paths } from "./api";
export function createMarimoClient(opts: ClientOptions) {