Skip to content

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

chore: add naming convention lint (#2749)

Myles Scolnickba4d1321b301
diff --git a/biome.json b/biome.json
index 94bb0c2faa..728e69dfdd 100644
--- a/biome.json
+++ b/biome.json
@@ -66,6 +66,37 @@
"noNonNullAssertion": "off",
"noParameterAssign": "off",
"noUnusedTemplateLiteral": "error",
+ "useNamingConvention": {
+ "level": "warn",
+ "options": {
+ "strictCase": false,
+ "conventions": [
+ {
+ "selector": { "kind": "const", "scope": "global" },
+ "match": ".*"
+ },
+ {
+ "selector": { "kind": "let", "scope": "global" },
+ "match": ".*"
+ },
+ {
+ "selector": { "kind": "function" },
+ "formats": ["camelCase", "PascalCase"]
+ },
+ {
+ "selector": { "kind": "variable" },
+ "formats": ["camelCase", "PascalCase", "CONSTANT_CASE"]
+ },
+ {
+ "selector": { "kind": "typeLike" },
+ "formats": ["PascalCase", "CONSTANT_CASE", "camelCase"]
+ },
+ {
+ "match": ".*"
+ }
+ ]
+ }
+ },
"useConsistentArrayType": "off",
"useImportType": "error",
"useNodejsImportProtocol": "error",
diff --git a/frontend/e2e-tests/components.spec.ts b/frontend/e2e-tests/components.spec.ts
index 0fe776cda9..f22d145922 100644
--- a/frontend/e2e-tests/components.spec.ts
+++ b/frontend/e2e-tests/components.spec.ts
@@ -4,7 +4,7 @@ import { getAppUrl } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
const appUrl = getAppUrl("components.py");
test.beforeEach(async ({ page }, info) => {
@@ -47,7 +47,7 @@ test("page renders read only view in read mode", async ({ page }) => {
// Can see output
await expect(page.locator("h1").getByText("UI Elements")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("button", async ({ page }) => {
@@ -64,7 +64,7 @@ test("button", async ({ page }) => {
// Verify output
await helper.verifyOutput("1");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("checkbox", async ({ page }) => {
@@ -85,7 +85,7 @@ test("checkbox", async ({ page }) => {
// Verify output
await helper.verifyOutput("False");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("date", async ({ page }) => {
@@ -99,7 +99,7 @@ test("date", async ({ page }) => {
// Verify output
await helper.verifyOutput("2020-01-20");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("dropdown", async ({ page }) => {
@@ -117,7 +117,7 @@ test("dropdown", async ({ page }) => {
// Verify output
await helper.verifyOutput("b");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("file button", async ({ page }) => {
@@ -130,7 +130,7 @@ test("file button", async ({ page }) => {
// Verify output
await helper.verifyOutput("None");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("file area", async ({ page }) => {
@@ -142,7 +142,7 @@ test("file area", async ({ page }) => {
// Verify output
await helper.verifyOutput("None");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("multiselect", async ({ page }) => {
@@ -166,7 +166,7 @@ test("multiselect", async ({ page }) => {
// Verify output
await helper.verifyOutput("b, c");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("number", async ({ page }) => {
@@ -186,7 +186,7 @@ test("number", async ({ page }) => {
// Verify output
await helper.verifyOutput("5");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("radio", async ({ page }) => {
@@ -204,7 +204,7 @@ test("radio", async ({ page }) => {
// Verify output
await helper.verifyOutput("b");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("slider", async ({ page }) => {
@@ -221,7 +221,7 @@ test("slider", async ({ page }) => {
// Verify output
await helper.verifyOutput("6");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("switch", async ({ page }) => {
@@ -242,7 +242,7 @@ test("switch", async ({ page }) => {
// Verify output
await helper.verifyOutput("False");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("table", async ({ page }) => {
@@ -288,7 +288,7 @@ test("table", async ({ page }) => {
{ useInnerText: true },
);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("text", async ({ page }) => {
@@ -303,7 +303,7 @@ test("text", async ({ page }) => {
// Verify output
await helper.verifyOutput("hello");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("text_area", async ({ page }) => {
@@ -318,7 +318,7 @@ test("text_area", async ({ page }) => {
// Verify output
await helper.verifyOutput("hello");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - array", async ({ page }) => {
@@ -351,7 +351,7 @@ test("complex - array", async ({ page }) => {
{ useInnerText: true },
);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - batch", async ({ page }) => {
@@ -380,7 +380,7 @@ test("complex - batch", async ({ page }) => {
{ useInnerText: true },
);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - dictionary", async ({ page }) => {
@@ -418,7 +418,7 @@ test("complex - dictionary", async ({ page }) => {
{ useInnerText: true },
);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - form", async ({ page }) => {
@@ -441,7 +441,7 @@ test("complex - form", async ({ page }) => {
// Verify output
await helper.verifyOutput("something!");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - reused in json", async ({ page }) => {
@@ -473,7 +473,7 @@ test("complex - reused in json", async ({ page }) => {
await expect(textbox.first()).toHaveValue("world");
await expect(number.first()).toHaveValue("10");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("complex - reused in markdown", async ({ page }) => {
@@ -505,5 +505,5 @@ test("complex - reused in markdown", async ({ page }) => {
await expect(textbox.first()).toHaveValue("world");
await expect(number.first()).toHaveValue("10");
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
diff --git a/frontend/e2e-tests/disabled.spec.ts b/frontend/e2e-tests/disabled.spec.ts
index f5699e5f4e..46c93ead4b 100644
--- a/frontend/e2e-tests/disabled.spec.ts
+++ b/frontend/e2e-tests/disabled.spec.ts
@@ -4,7 +4,7 @@ import { getAppUrl, resetFile } from "../playwright.config";
import { maybeRestartKernel, takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
const appUrl = getAppUrl("disabled_cells.py");
test.beforeEach(async ({ page }, info) => {
@@ -112,5 +112,5 @@ test("disabled cells", async ({ page }) => {
// Check the status
await expect(page.getByTitle("This cell is disabled")).toHaveCount(0);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
diff --git a/frontend/e2e-tests/helper.ts b/frontend/e2e-tests/helper.ts
index 310d85a0cf..8298505c4f 100644
--- a/frontend/e2e-tests/helper.ts
+++ b/frontend/e2e-tests/helper.ts
@@ -49,7 +49,7 @@ const countsForName: Record<string, number> = {};
/**
* Take a screenshot of the page.
* @example
- * await takeScreenshot(page, __filename);
+ * await takeScreenshot(page, _filename);
*/
export async function takeScreenshot(page: Page, filename: string) {
const clean = path.basename(filename).replace(".spec.ts", "");
diff --git a/frontend/e2e-tests/kitchen-sink-wasm.spec.ts b/frontend/e2e-tests/kitchen-sink-wasm.spec.ts
index ee0c929ac9..500e10f26d 100644
--- a/frontend/e2e-tests/kitchen-sink-wasm.spec.ts
+++ b/frontend/e2e-tests/kitchen-sink-wasm.spec.ts
@@ -3,7 +3,7 @@ import { expect, test } from "@playwright/test";
import { exportAsHTMLAndTakeScreenshot, takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
test.skip("can screenshot and download as html edit", async ({ page }) => {
await page.goto("http://localhost:3000");
@@ -13,7 +13,7 @@ test.skip("can screenshot and download as html edit", async ({ page }) => {
// See text Welcome
await expect(page.getByText("Welcome").first()).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
await exportAsHTMLAndTakeScreenshot(page);
});
@@ -25,5 +25,5 @@ test.skip("can screenshot and download as html in run", async ({ page }) => {
// See text Welcome
await expect(page.getByText("Welcome").first()).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
diff --git a/frontend/e2e-tests/kitchen-sink.spec.ts b/frontend/e2e-tests/kitchen-sink.spec.ts
index d81565574d..964a255c4e 100644
--- a/frontend/e2e-tests/kitchen-sink.spec.ts
+++ b/frontend/e2e-tests/kitchen-sink.spec.ts
@@ -8,14 +8,14 @@ import {
} from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
const appUrl = getAppUrl("kitchen_sink.py");
test("can screenshot and download as html", async ({ page }) => {
await page.goto(appUrl);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
await exportAsHTMLAndTakeScreenshot(page);
});
diff --git a/frontend/e2e-tests/layout-grid.spec.ts b/frontend/e2e-tests/layout-grid.spec.ts
index 1b3b5b10ea..4274fd82e4 100644
--- a/frontend/e2e-tests/layout-grid.spec.ts
+++ b/frontend/e2e-tests/layout-grid.spec.ts
@@ -4,7 +4,7 @@ import { getAppUrl } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
const runUrl = getAppUrl("layout_grid.py//run");
const runMaxWidthUrl = getAppUrl("layout_grid_max_width.py//run");
@@ -30,7 +30,7 @@ test("can run Grid layout", async ({ page }) => {
expect(bb1.y).toBe(bb2.y);
expect(bb1.x).toBeGreaterThan(bb2.x);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("can run Grid layout with max-width", async ({ page }) => {
@@ -41,7 +41,7 @@ test("can run Grid layout with max-width", async ({ page }) => {
// Verify markdown "Grid Layout"
await expect(page.getByText("Grid Layout")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("can edit Grid layout", async ({ page }) => {
@@ -81,7 +81,7 @@ test("can edit Grid layout", async ({ page }) => {
expect(bb1.x).toBe(bb2.x);
expect(bb1.y).toBeLessThan(bb2.y);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
interface BoundingBox {
diff --git a/frontend/e2e-tests/mode.spec.ts b/frontend/e2e-tests/mode.spec.ts
index 337b513115..a133af8250 100644
--- a/frontend/e2e-tests/mode.spec.ts
+++ b/frontend/e2e-tests/mode.spec.ts
@@ -8,7 +8,7 @@ import {
import { maybeRestartKernel, takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
async function gotoPage(
app: ApplicationNames,
@@ -47,7 +47,7 @@ test("page renders edit feature in edit mode", async ({ context }) => {
// Can see output
await expect(page.locator("h1").getByText("Hello Marimo!")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test.skip("can bring up the find/replace dialog", async ({ context }) => {
@@ -63,7 +63,7 @@ test.skip("can bring up the find/replace dialog", async ({ context }) => {
// Has placeholder text "Find"
await expect(page.locator("[placeholder='Find']")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("can toggle to presenter mode", async ({ context }) => {
@@ -88,7 +88,7 @@ test("can toggle to presenter mode", async ({ context }) => {
await expect(page.locator("h1").getByText("Hello Marimo!")).toBeVisible();
await expect(page.getByText("# Hello Marimo!")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test("page renders read only view in read mode", async ({ context }) => {
@@ -102,5 +102,5 @@ test("page renders read only view in read mode", async ({ context }) => {
// Can see output
await expect(page.locator("h1").getByText("UI Elements")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
diff --git a/frontend/e2e-tests/output.spec.ts b/frontend/e2e-tests/output.spec.ts
index 767c46b1fc..73ba2655ee 100644
--- a/frontend/e2e-tests/output.spec.ts
+++ b/frontend/e2e-tests/output.spec.ts
@@ -4,7 +4,7 @@ import { getAppUrl } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
test("it can clear and append output", async ({ page }) => {
const appUrl = getAppUrl("output.py//run");
@@ -29,5 +29,5 @@ test("it can clear and append output", async ({ page }) => {
await expect(page.getByText("To be replaced.")).not.toBeVisible();
await expect(page.getByText("Replaced by index!")).toBeVisible();
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
diff --git a/frontend/e2e-tests/shutdown.spec.ts b/frontend/e2e-tests/shutdown.spec.ts
index 4076c1d683..7ba3bd79e1 100644
--- a/frontend/e2e-tests/shutdown.spec.ts
+++ b/frontend/e2e-tests/shutdown.spec.ts
@@ -4,7 +4,7 @@ import { getAppUrl, startServer } from "../playwright.config";
import { takeScreenshot } from "./helper";
import { fileURLToPath } from "node:url";
-const __filename = fileURLToPath(import.meta.url);
+const _filename = fileURLToPath(import.meta.url);
test("can resume a session", async ({ page }) => {
const appUrl = getAppUrl("shutdown.py");
@@ -65,7 +65,7 @@ test("shutdown shows disconnected text", async ({ page }) => {
await page.getByRole("button", { name: "Save" }).click();
await expect(page.getByText("Download unsaved changes?")).toHaveCount(1);
- await takeScreenshot(page, __filename);
+ await takeScreenshot(page, _filename);
});
test.afterAll(() => {
diff --git a/frontend/src/components/data-table/filters.ts b/frontend/src/components/data-table/filters.ts
index 9e15613695..cd8ea6a735 100644
--- a/frontend/src/components/data-table/filters.ts
+++ b/frontend/src/components/data-table/filters.ts
@@ -79,26 +79,26 @@ export type ColumnFilterForType<T extends FilterType> = T extends FilterType
: never;
export function filterToFilterCondition(
- columnId: string,
+ columnIdString: string,
filter: ColumnFilterValue | undefined,
): ConditionType[] | ConditionType {
if (!filter) {
return [];
}
- const column_id = columnId as ColumnId;
+ const columnId = columnIdString as ColumnId;
switch (filter.type) {
case "number": {
const conditions: ConditionType[] = [];
if (filter.min !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: ">=",
value: filter.min,
});
}
if (filter.max !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: "<=",
value: filter.max,
});
@@ -107,7 +107,7 @@ export function filterToFilterCondition(
}
case "text":
return {
- column_id,
+ column_id: columnId,
operator: "contains",
value: filter.text,
};
@@ -115,14 +115,14 @@ export function filterToFilterCondition(
const conditions: ConditionType[] = [];
if (filter.min !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: ">=",
value: filter.min.toISOString(),
});
}
if (filter.max !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: "<=",
value: filter.max.toISOString(),
});
@@ -133,14 +133,14 @@ export function filterToFilterCondition(
const conditions: ConditionType[] = [];
if (filter.min !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: ">=",
value: filter.min.toISOString(),
});
}
if (filter.max !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: "<=",
value: filter.max.toISOString(),
});
@@ -151,14 +151,14 @@ export function filterToFilterCondition(
const conditions: ConditionType[] = [];
if (filter.min !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: ">=",
value: filter.min.toISOString(),
});
}
if (filter.max !== undefined) {
conditions.push({
- column_id,
+ column_id: columnId,
operator: "<=",
value: filter.max.toISOString(),
});
@@ -168,13 +168,13 @@ export function filterToFilterCondition(
case "boolean":
if (filter.value) {
return {
- column_id,
+ column_id: columnId,
operator: "is_true",
};
}
if (!filter.value) {
return {
- column_id,
+ column_id: columnId,
operator: "is_false",
};
}
@@ -182,7 +182,7 @@ export function filterToFilterCondition(
return [];
case "select":
return {
- column_id,
+ column_id: columnId,
operator: "in",
value: filter.options,
};
diff --git a/frontend/src/components/editor/chrome/panels/packages-panel.tsx b/frontend/src/components/editor/chrome/panels/packages-panel.tsx
index fcfa7baa52..f269cc523d 100644
--- a/frontend/src/components/editor/chrome/panels/packages-panel.tsx
+++ b/frontend/src/components/editor/chrome/panels/packages-panel.tsx
@@ -26,6 +26,7 @@ import { Tooltip } from "@/components/ui/tooltip";
import { cn } from "@/utils/cn";
import { Kbd } from "@/components/ui/kbd";
import { Events } from "@/utils/events";
+import { copyToClipboard } from "@/utils/copy";
export const PackagesPanel: React.FC = () => {
const [config] = useUserConfig();
@@ -212,8 +213,8 @@ const PackagesList: React.FC<{
<TableRow
key={item.name}
className="group"
- onClick={() => {
- navigator.clipboard.writeText(`${item.name}==${item.version}`);
+ onClick={async () => {
+ await copyToClipboard(`${item.name}==${item.version}`);
toast({
title: "Copied to clipboard",
});
diff --git a/frontend/src/components/editor/output/ConsoleOutput.tsx b/frontend/src/components/editor/output/ConsoleOutput.tsx
index 95bca24a86..0f355b4e73 100644
--- a/frontend/src/components/editor/output/ConsoleOutput.tsx
+++ b/frontend/src/components/editor/output/ConsoleOutput.tsx
@@ -99,7 +99,7 @@ export const ConsoleOutput = (props: Props): React.ReactNode => {
if (output.channel === "pdb") {
return null;
}
- const original_idx = consoleOutputs.length - idx - 1;
+ const originalIdx = consoleOutputs.length - idx - 1;
if (output.channel === "stdin") {
invariant(
@@ -120,7 +120,7 @@ export const ConsoleOutput = (props: Props): React.ReactNode => {
placeholder="stdin"
onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) {
- onSubmitDebugger(e.currentTarget.value, original_idx);
+ onSubmitDebugger(e.currentTarget.value, originalIdx);
}
}}
/>
diff --git a/frontend/src/core/cells/collapseConsoleOutputs.tsx b/frontend/src/core/cells/collapseConsoleOutputs.tsx
index e7b6d8d966..6f7fc498c7 100644
--- a/frontend/src/core/cells/collapseConsoleOutputs.tsx
+++ b/frontend/src/core/cells/collapseConsoleOutputs.tsx
@@ -120,12 +120,12 @@ function truncateHead(consoleOutputs: OutputMessage[], limit: number) {
const output = consoleOutputs[cutoff];
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;
+ const outputLines = output.data.split("\n");
+ const nLinesAfterOutput = nLines - outputLines.length;
const nLinesToKeep = limit - nLinesAfterOutput;
return [
warningOutput,
- { ...output, data: output_lines.slice(-nLinesToKeep).join("\n") },
+ { ...output, data: outputLines.slice(-nLinesToKeep).join("\n") },
...consoleOutputs.slice(cutoff + 1),
];
}
diff --git a/frontend/src/core/codemirror/format.ts b/frontend/src/core/codemirror/format.ts
index 09f3f2d950..24f1bfc834 100644
--- a/frontend/src/core/codemirror/format.ts
+++ b/frontend/src/core/codemirror/format.ts
@@ -30,10 +30,10 @@ export async function formatEditorViews(
lineLength: getUserConfig().formatting.line_length,
});
- for (const [_cellId, formattedCode] of Objects.entries(
+ for (const [cellIdString, formattedCode] of Objects.entries(
formatResponse.codes,
)) {
- const cellId = _cellId as CellId;
+ const cellId = cellIdString as CellId;
const originalCode = codes[cellId];
const view = views[cellId];
diff --git a/frontend/src/core/hotkeys/actions.ts b/frontend/src/core/hotkeys/actions.ts
index baae578f3e..68e2b12053 100644
--- a/frontend/src/core/hotkeys/actions.ts
+++ b/frontend/src/core/hotkeys/actions.ts
@@ -27,7 +27,7 @@ export function useSetRegisteredAction() {
},
unregisterAction: (shortcut: HotkeyAction) => {
set((actions) => {
- const { [shortcut]: _, ...rest } = actions;
+ const { [shortcut]: unused, ...rest } = actions;
return rest;
});
},
diff --git a/frontend/src/core/kernel/handlers.ts b/frontend/src/core/kernel/handlers.ts
index 67f6c3d2b7..5976c4dac3 100644
--- a/frontend/src/core/kernel/handlers.ts
+++ b/frontend/src/core/kernel/handlers.ts
@@ -140,9 +140,9 @@ export function handleRemoveUIElements(
// This removes the element from the registry to (1) clean-up
// memory and (2) make sure that the old value doesn't get re-used
// if the same cell-id is later reused for another element.
- const cell_id = data.cell_id as CellId;
- UI_ELEMENT_REGISTRY.removeElementsByCell(cell_id);
- VirtualFileTracker.INSTANCE.removeForCellId(cell_id);
+ const cellId = data.cell_id as CellId;
+ UI_ELEMENT_REGISTRY.removeElementsByCell(cellId);
+ VirtualFileTracker.INSTANCE.removeForCellId(cellId);
}
export function handleCellOperation(
diff --git a/frontend/src/core/static/virtual-file-tracker.ts b/frontend/src/core/static/virtual-file-tracker.ts
index 2cf3bf11ae..08ed59cf71 100644
--- a/frontend/src/core/static/virtual-file-tracker.ts
+++ b/frontend/src/core/static/virtual-file-tracker.ts
@@ -28,7 +28,7 @@ export class VirtualFileTracker {
track(message: Pick<CellMessage, "cell_id" | "output">): void {
const output = message.output;
- const cell_id = message.cell_id as CellId;
+ const cellId = message.cell_id as CellId;
if (!output) {
return;
}
@@ -36,10 +36,10 @@ export class VirtualFileTracker {
switch (output.mimetype) {
case "application/json":
case "text/html": {
- const prev = this.virtualFiles.get(cell_id);
+ const prev = this.virtualFiles.get(cellId);
const matches = findVirtualFiles(output.data);
prev?.forEach((file) => matches.add(file));
- this.virtualFiles.set(cell_id, matches);
+ this.virtualFiles.set(cellId, matches);
return;
}
default:
diff --git a/frontend/src/plugins/impl/FileUploadPlugin.tsx b/frontend/src/plugins/impl/FileUploadPlugin.tsx
index 5b53c5eacf..a4f4921c0c 100644
--- a/frontend/src/plugins/impl/FileUploadPlugin.tsx
+++ b/frontend/src/plugins/impl/FileUploadPlugin.tsx
@@ -174,7 +174,7 @@ export const FileUpload = (props: FileUploadProps): JSX.Element => {
const uploadedFiles = (
<ul>
- {value.map(([fileName, _]) => (
+ {value.map(([fileName]) => (
<li key={fileName}>{fileName}</li>
))}
</ul>
diff --git a/frontend/src/plugins/impl/data-frames/python/python-print.ts b/frontend/src/plugins/impl/data-frames/python/python-print.ts
index 79cd48bda8..8e1577e269 100644
--- a/frontend/src/plugins/impl/data-frames/python/python-print.ts
+++ b/frontend/src/plugins/impl/data-frames/python/python-print.ts
@@ -67,8 +67,8 @@ export function pythonPrint(dfName: string, transform: TransformType): string {
}
return `${dfName}.agg({${column_ids
.map(
- (column_id) =>
- `${asLiteral(column_id)}: ${listOfStrings(aggregations)}`,
+ (columnId) =>
+ `${asLiteral(columnId)}: ${listOfStrings(aggregations)}`,
)
.join(", ")}})`;
}
@@ -107,8 +107,8 @@ export function pythonPrint(dfName: string, transform: TransformType): string {
return `${dfName}.explode(${listOfStrings(column_ids)})`;
}
case "expand_dict": {
- const column_id = asLiteral(transform.column_id);
- const args = `df.pop(${column_id}).values.tolist())`;
+ const columnId = asLiteral(transform.column_id);
+ const args = `df.pop(${columnId}).values.tolist())`;
return `${dfName}.join(pd.DataFrame(${args})`;
}
default:
diff --git a/frontend/src/plugins/impl/panel/PanelPlugin.tsx b/frontend/src/plugins/impl/panel/PanelPlugin.tsx
index c59e1de0c5..b1aececc05 100644
--- a/frontend/src/plugins/impl/panel/PanelPlugin.tsx
+++ b/frontend/src/plugins/impl/panel/PanelPlugin.tsx
@@ -224,11 +224,11 @@ const PanelSlot = (props: Props) => {
...renderJson,
roots: {},
};
- for (const model_id of Object.keys(renderJson.roots)) {
- const root_id = renderJson.roots[model_id];
+ for (const modelId of Object.keys(renderJson.roots)) {
+ const rootId = renderJson.roots[modelId];
if (ref.current) {
- const el = ref.current.querySelector(`#${root_id}`);
- renderItem.roots[model_id] = el as HTMLElement | null;
+ const el = ref.current.querySelector(`#${rootId}`);
+ renderItem.roots[modelId] = el as HTMLElement | null;
}
}
const modelId = Object.keys(renderItem.roots)[0];
diff --git a/frontend/src/utils/createReducer.ts b/frontend/src/utils/createReducer.ts
index db23265c1b..1807ce4783 100644
--- a/frontend/src/utils/createReducer.ts
+++ b/frontend/src/utils/createReducer.ts
@@ -16,7 +16,7 @@ type IfUnknown<T, Y, N> = unknown extends T ? Y : N;
type ReducerHandler<State, Payload> = (state: State, payload: Payload) => State;
interface ReducerHandlers<State> {
- [K: string]: ReducerHandler<State, any>;
+ [k: string]: ReducerHandler<State, any>;
}
type ReducerActions<RH extends ReducerHandlers<any>> = {
diff --git a/frontend/src/utils/id-tree.tsx b/frontend/src/utils/id-tree.tsx
index 0c7f279488..4f921b394b 100644
--- a/frontend/src/utils/id-tree.tsx
+++ b/frontend/src/utils/id-tree.tsx
@@ -411,7 +411,7 @@ export class MultiColumn<T> {
// Ensure there is always at least one column
const numColumns = Math.max(
1,
- ...idAndColumns.map(([_, column]) => (column ?? 0) + 1),
+ ...idAndColumns.map(([, column]) => (column ?? 0) + 1),
);
const idsList: T[][] = Array.from({ length: numColumns }, () => []);