diff --git a/biome.jsonc b/biome.jsonc index bf5cee51122..c77c0dbb102 100644 --- a/biome.jsonc +++ b/biome.jsonc @@ -21,6 +21,7 @@ "noStaticElementInteractions": "off" }, "correctness": { + "noInvalidBuiltinInstantiation": "off", // oxlint owns new-for-builtins "noUnusedImports": "warn", "useUniqueElementIds": "off", // TODO: This is new but we want to fix it "noNestedComponentDefinitions": "off", // TODO: Investigate, since it is used by shadcn components diff --git a/site/.oxlintrc.jsonc b/site/.oxlintrc.jsonc index 7197afcb8d7..27fafc8a828 100644 --- a/site/.oxlintrc.jsonc +++ b/site/.oxlintrc.jsonc @@ -155,6 +155,7 @@ "prefer-namespace-keyword": "error", "approx-constant": "error", "no-export": "error", + "new-for-builtins": "error", "no-explicit-any": "error", // ========================================================== @@ -175,7 +176,6 @@ "jsx-no-useless-fragment": "off", // complexity/noUselessFragments (large) "no-invalid-void-type": "off", // suspicious/noConfusingVoidType (large) "no-redeclare": "off", // suspicious/noRedeclare (medium: TS declaration merging) - "new-for-builtins": "off", // correctness/noInvalidBuiltinInstantiation (medium) "no-empty-object-type": "off", // complexity/noBannedTypes (medium) "role-has-required-aria-props": "off", // a11y/useAriaPropsForRole (medium) "no-irregular-whitespace": "off", // suspicious/noIrregularWhitespace (medium) diff --git a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx index 72c782541b9..de3a7d41772 100644 --- a/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx +++ b/site/src/modules/workspaces/WorkspaceTiming/Chart/XAxis.tsx @@ -161,7 +161,7 @@ const XGrid: FC = ({ columns, ...htmlProps }) => { htmlProps.className, )} > - {[...Array(columns).keys()].map((key) => ( + {Array.from({ length: columns }, (_, key) => (
{ }); it("returns false for 9 lines of short text", () => { - const text = Array(9).fill("short line").join("\n"); + const text = new Array(9).fill("short line").join("\n"); expect(isLargePaste(text)).toBe(false); }); it("returns true for 10+ lines", () => { - const text = Array(10).fill("line").join("\n"); + const text = new Array(10).fill("line").join("\n"); expect(isLargePaste(text)).toBe(true); }); @@ -131,7 +131,7 @@ describe("isLargePaste", () => { }); it("returns false when text has 9 lines and 999 characters", () => { - const text = [...Array(8).fill("x".repeat(110)), "x".repeat(111)].join( + const text = [...new Array(8).fill("x".repeat(110)), "x".repeat(111)].join( "\n", ); expect(text.length).toBe(999); @@ -139,7 +139,7 @@ describe("isLargePaste", () => { }); it("returns true for text meeting both thresholds", () => { - const text = Array(15).fill("x".repeat(100)).join("\n"); + const text = new Array(15).fill("x".repeat(100)).join("\n"); expect(isLargePaste(text)).toBe(true); }); }); diff --git a/site/src/pages/AgentsPage/components/TextPreviewDialog.stories.tsx b/site/src/pages/AgentsPage/components/TextPreviewDialog.stories.tsx index f7f69414fd5..37d2e960eea 100644 --- a/site/src/pages/AgentsPage/components/TextPreviewDialog.stories.tsx +++ b/site/src/pages/AgentsPage/components/TextPreviewDialog.stories.tsx @@ -28,7 +28,7 @@ export const Default: Story = { export const LongContent: Story = { args: { - content: Array(100) + content: new Array(100) .fill( "This is a line of pasted text that demonstrates how the dialog handles very long content.", ) diff --git a/site/src/utils/schedule.tsx b/site/src/utils/schedule.tsx index 8c58c4859e1..359ff2c8ebb 100644 --- a/site/src/utils/schedule.tsx +++ b/site/src/utils/schedule.tsx @@ -199,7 +199,9 @@ export function getMaxDeadline(ws: Workspace | undefined): dayjs.Dayjs { // note: we count runtime from updated_at as started_at counts from the start of // the workspace build process, which can take a while. if (ws === undefined) { - throw Error("Cannot calculate max deadline because workspace is undefined"); + throw new Error( + "Cannot calculate max deadline because workspace is undefined", + ); } const startedAt = dayjs(ws.latest_build.updated_at); return startedAt.add(deadlineExtensionMax);