diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-25 16:16:42 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:46:35 +0200 |
| commit | 2c0fd4f86b011bbc8c0d86c61f96ade3ea249508 (patch) | |
| tree | 660cbe303457d212d4c1d5398b02ed64945b7099 /.cursor/rules/ultracite.mdc | |
| parent | 5e2b829f8a682a619cd0de6681ddd9f542235ebf (diff) | |
| download | opencut-2c0fd4f86b011bbc8c0d86c61f96ade3ea249508.tar.gz | |
untrack .cursor/
Diffstat (limited to '.cursor/rules/ultracite.mdc')
| -rw-r--r-- | .cursor/rules/ultracite.mdc | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/.cursor/rules/ultracite.mdc b/.cursor/rules/ultracite.mdc deleted file mode 100644 index 83e14c18..00000000 --- a/.cursor/rules/ultracite.mdc +++ /dev/null @@ -1,101 +0,0 @@ ---- -alwaysApply: false ---- -# Project Context - -Ultracite enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's formatter. - -## Key Principles - -- Zero configuration required -- Subsecond performance -- Maximum type safety -- AI-friendly code generation - -## Before Writing Code - -1. Analyze existing patterns in the codebase -2. Consider edge cases and error scenarios -3. Follow the rules below strictly -4. Validate accessibility requirements -5. Avoid code duplication - -## Rules - -### Accessibility (a11y) - -- Always include a `title` element for icons unless there's text beside the icon. -- Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`. -- Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`. - -### Code Complexity and Quality - -- Don't use primitive type aliases or misleading types. -- Don't use the comma operator. -- Use for...of statements instead of Array.forEach. -- Don't initialize variables to undefined. -- Use .flatMap() instead of map().flat() when possible. - -### React and JSX Best Practices - -- Don't import `React` itself. -- Don't use both `children` and `dangerouslySetInnerHTML` props on the same element. -- Don't insert comments as text nodes. -- Use `<>...</>` instead of `<Fragment>...</Fragment>`. - -### Function Parameters and Props - -- Always use destructured props objects instead of individual parameters in functions. -- Example: `function helloWorld({ prop }: { prop: string })` instead of `function helloWorld(param: string)`. -- This applies to all functions, not just React components. - -### Correctness and Safety - -- Don't assign a value to itself. -- Avoid unused imports and variables. -- Don't use await inside loops. -- Don't hardcode sensitive data like API keys and tokens. -- Don't use the TypeScript directive @ts-ignore. -- Make sure the `preconnect` attribute is used when using Google Fonts. -- Don't use the `delete` operator. -- Don't use `require()` in TypeScript/ES modules - use proper `import` statements. - -### TypeScript Best Practices - -- Don't use TypeScript enums. -- Use either `T[]` or `Array<T>` consistently. -- Don't use the `any` type. - -### Style and Consistency - -- Don't use global `eval()`. -- Use `String.slice()` instead of `String.substr()` and `String.substring()`. -- Don't use `else` blocks when the `if` block breaks early. -- Put default function parameters and optional function parameters last. -- Use `new` when throwing an error. -- Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`. - -### Next.js Specific Rules - -- Don't use `<img>` elements in Next.js projects. -- Don't use `<head>` elements in Next.js projects. - -## Example: Error Handling - -```typescript -// ✅ Good: Comprehensive error handling -try { - const result = await fetchData(); - return { success: true, data: result }; -} catch (error) { - console.error("API call failed:", error); - return { success: false, error: error.message }; -} - -// ❌ Bad: Swallowing errors -try { - return await fetchData(); -} catch (e) { - console.log(e); -} -``` |
