Files
stanza/.oxlintrc.json
T
jake 743c356b17 refactor: extract CopyButton, memoize callbacks, and add oxc/vitest oxlint plugins
- Extract a shared `CopyButton` component (`apps/web/src/components/copy-button.tsx`) — the clipboard-copy + toast + tooltip pattern was duplicated verbatim in `command-bar.tsx` and `try-it.tsx`; both now import `<CopyButton value={command} />`
- Wrap `setName` and `setSelection` in `useCallback` in `builder/index.tsx`, `onDraftChange` in `command-bar.tsx`, and `ModuleCard`'s `onClick` in `slot-cards.tsx` — these were recreated on every render, causing unnecessary child re-renders
- Move `summaries.filter(m => m.slot === slot)` into `SlotSection` and pass `summaries` + `slot` instead of a pre-filtered `modules` array; return `null` from `SlotSection` when the filtered list is empty — removes an extra allocation in the parent and colocates the null-check with the data
- Memoize `dangerouslySetInnerHTML` objects in `file-preview.tsx` and `templates-list.tsx` as `useMemo(() => ({ __html: ... }))` instead of deriving a plain string and constructing a fresh object inline on every render
- Hoist the GitHub `<a>` element in `header.tsx` to a module-level constant so the Base UI `Button render=` prop receives a stable reference across renders
- Add `oxc`, `eslint`, and `vitest` plugins to `.oxlintrc.json` for both the root config and the `apps/web/**/*.tsx` override
2026-05-21 15:46:56 -04:00

54 lines
1.2 KiB
JSON

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["oxc", "eslint", "typescript", "unicorn", "import", "promise", "vitest"],
"categories": {
"correctness": "error",
"suspicious": "warn",
"perf": "warn"
},
"rules": {
"no-console": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-await-in-loop": "off",
"unicorn/no-null": "off",
"unicorn/filename-case": "off",
"unicorn/no-array-reduce": "off"
},
"ignorePatterns": [
"**/node_modules/**",
"**/dist/**",
"**/.output/**",
"**/.turbo/**",
"**/.vercel/**",
"**/*.gen.ts",
"**/coverage/**",
"registry/modules/*/templates/**"
],
"overrides": [
{
"files": ["**/*.test.ts", "**/*.test.tsx", "**/tests/**"],
"rules": {
"typescript/no-explicit-any": "off"
}
},
{
"files": ["apps/web/**/*.tsx"],
"plugins": [
"oxc",
"eslint",
"typescript",
"react",
"react-perf",
"promise",
"jsx-a11y",
"unicorn",
"import",
"vitest"
],
"rules": {
"react/react-in-jsx-scope": "off"
}
}
]
}