From 4c4eac151ae0511d36b0ac9f197aef1c62549dde Mon Sep 17 00:00:00 2001 From: AlexProgrammerDE <40795980+AlexProgrammerDE@users.noreply.github.com> Date: Sun, 29 Nov 2026 00:26:09 +0100 Subject: [PATCH] build(lint): enable 60 more oxlint rules The config left many style, restriction, and nursery rules off even though the code already follows most of them. Turning them on keeps those patterns from creeping back in. It also updates 10 file(s) to satisfy the new rules. Code changes: - The music ducking `reduce` became `Math.min(...entries.map(...))`. - The test helpers use `await` instead of `.then()`. - `RemotionRoot` is a function declaration. Co-Authored-By: Claude Opus 5.5 --- .oxlintrc.json | 64 ++++++++++++++++++++++++ scripts/elevenlabs.test.ts | 7 ++- scripts/io.test.ts | 4 +- scripts/master-audio.ts | 2 +- src/Root.tsx | 82 ++++++++++++++++--------------- src/Showcase.tsx | 22 ++++----- src/components/shotcraft/theme.ts | 1 + src/scenes/Gameplay.tsx | 1 + src/shotcraft/BrandMark.tsx | 1 + src/shotcraft/FocusContent.tsx | 1 + src/shotcraft/IntroScene.tsx | 1 + 11 files changed, 129 insertions(+), 57 deletions(-) diff --git a/.oxlintrc.json b/.oxlintrc.json index aacf6e8..588b107 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -70,6 +70,70 @@ } ], "rules": { + "eslint/default-param-last": "error", + "eslint/guard-for-in": "error", + "eslint/no-duplicate-imports": [ + "error", + { "allowSeparateTypeImports": true } + ], + "eslint/no-extra-label": "error", + "eslint/no-implicit-coercion": ["error", { "allow": ["!!"] }], + "eslint/no-implicit-globals": "error", + "eslint/no-label-var": "error", + "eslint/no-lone-blocks": "error", + "eslint/no-multi-str": "error", + "eslint/no-new-func": "error", + "eslint/no-proto": "error", + "eslint/no-return-assign": "error", + "eslint/no-sequences": "error", + "eslint/no-useless-computed-key": "error", + "eslint/prefer-exponentiation-operator": "error", + "eslint/prefer-numeric-literals": "error", + "eslint/unicode-bom": "error", + "eslint/vars-on-top": "error", + "eslint/yoda": "error", + "import/newline-after-import": "error", + "import/no-amd": "error", + "import/no-mutable-exports": "error", + "oxc/bad-bitwise-operator": "error", + "oxc/no-const-enum": "error", + "promise/no-return-in-finally": "error", + "promise/prefer-await-to-then": "error", + "promise/prefer-catch": "error", + "promise/spec-only": "error", + "react/function-component-definition": "error", + "react/no-redundant-should-component-update": "error", + "react/no-set-state": "error", + "react/prefer-es6-class": "error", + "react/require-render-return": "error", + "typescript/adjacent-overload-signatures": "error", + "typescript/ban-tslint-comment": "error", + "typescript/consistent-type-assertions": "error", + "typescript/method-signature-style": "error", + "typescript/no-unnecessary-qualifier": "error", + "typescript/prefer-find": "error", + "typescript/prefer-literal-enum-member": "error", + "typescript/prefer-regexp-exec": "error", + "typescript/prefer-return-this-type": "error", + "typescript/unified-signatures": "error", + "unicorn/consistent-date-clone": "error", + "unicorn/consistent-template-literal-escape": "error", + "unicorn/no-array-reduce": "error", + "unicorn/no-length-as-slice-end": "error", + "unicorn/no-useless-iterator-to-array": "error", + "unicorn/prefer-bigint-literals": "error", + "unicorn/prefer-class-fields": "error", + "unicorn/prefer-classlist-toggle": "error", + "unicorn/prefer-global-this": "error", + "unicorn/prefer-includes": "error", + "unicorn/prefer-keyboard-event-key": "error", + "unicorn/prefer-module": "error", + "unicorn/prefer-negative-index": "error", + "unicorn/prefer-object-from-entries": "error", + "unicorn/prefer-reflect-apply": "error", + "unicorn/prefer-string-trim-start-end": "error", + "unicorn/require-module-attributes": "error", + "unicorn/switch-case-break-position": "error", "react-hooks-js/static-components": "error", "react-hooks-js/use-memo": "error", "react-hooks-js/preserve-manual-memoization": "error", diff --git a/scripts/elevenlabs.test.ts b/scripts/elevenlabs.test.ts index 0494701..e11b0f9 100644 --- a/scripts/elevenlabs.test.ts +++ b/scripts/elevenlabs.test.ts @@ -25,10 +25,9 @@ const request: ElevenLabsRequest = { timeoutSeconds: 5, rejected: (status) => `Eleven Music returned ${status}`, }; -const failure = (env: Record, input = request) => - Effect.runPromise(Effect.flip(elevenLabs(input).pipe(withEnv(env)))).then( - (error) => error.message, - ); +const failure = async (env: Record, input = request) => + (await Effect.runPromise(Effect.flip(elevenLabs(input).pipe(withEnv(env))))) + .message; afterEach(() => { spyOn(globalThis, "fetch").mockRestore(); diff --git a/scripts/io.test.ts b/scripts/io.test.ts index 5ab00e1..c9b6415 100644 --- a/scripts/io.test.ts +++ b/scripts/io.test.ts @@ -5,8 +5,8 @@ import { Effect } from "effect"; import { emptyProduction } from "../src/production"; import { decodeProduction, run } from "./io"; -const failure = (effect: Effect.Effect) => - Effect.runPromise(Effect.flip(effect)).then((error) => error.message); +const failure = async (effect: Effect.Effect) => + (await Effect.runPromise(Effect.flip(effect))).message; describe("process helpers", () => { test("run returns trimmed stdout", async () => { diff --git a/scripts/master-audio.ts b/scripts/master-audio.ts index 3f51303..c8ab757 100644 --- a/scripts/master-audio.ts +++ b/scripts/master-audio.ts @@ -27,7 +27,7 @@ export const masterAudio = Effect.fnUntraced(function* (path: string) { const [stderr, code] = yield* io("Audio loudness analysis", () => Promise.all([new Response(analysis.stderr).text(), analysis.exited]), ); - const report = stderr.match(/\{[^{}]+\}/u)?.[0]; + const report = /\{[^{}]+\}/u.exec(stderr)?.[0]; if (code !== 0 || report === undefined) return yield* fail("Audio loudness analysis failed"); const measured = yield* decode( diff --git a/src/Root.tsx b/src/Root.tsx index 0055aae..039c7b2 100644 --- a/src/Root.tsx +++ b/src/Root.tsx @@ -8,43 +8,47 @@ import { Thumbnail } from "./Thumbnail"; import "@fontsource/anton"; import "@fontsource-variable/space-grotesk"; -export const RemotionRoot: React.FC = () => ( - <> - - {(["landscape", "vertical"] as const).map((edition: Edition) => ( - ({ - durationInFrames: duration(props.production, edition), - props: { ...props, edition }, - })} +export function RemotionRoot() { + return ( + <> + + {(["landscape", "vertical"] as const).map((edition: Edition) => ( + ({ + durationInFrames: duration(props.production, edition), + props: { ...props, edition }, + })} + /> + ))} + - ))} - - - -); + + + ); +} diff --git a/src/Showcase.tsx b/src/Showcase.tsx index 97b456e..7bf6eda 100644 --- a/src/Showcase.tsx +++ b/src/Showcase.tsx @@ -72,21 +72,21 @@ export function Showcase({ production, captions, draft, edition }: VideoProps) {