Skip to content

Commit 305b489

Browse files
committed
Sync alphalib
1 parent b9b50d9 commit 305b489

File tree

5 files changed

+47
-27
lines changed

5 files changed

+47
-27
lines changed

.cursor/rules/coding-style.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Coding Style
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Favor `async run() {` over `run = async () => {` inside ES6 classes
7+
- Favor `if (!(err instanceof Error)) { throw new Error(`Was thrown a non-error: ${err}`) }` inside
8+
`catch` blocks to ensure the `error` is always an instance of `Error`
9+
- Favor using real paths (`../lib/schemas.ts`) over aliases (`@/app/lib/schemas`).
10+
- Favor `for (const comment of comments) {` over `comments.forEach((comment) => {`
11+
- Favor named exports over default exports, with the exception of Next.js pages

.cursor/rules/general.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: General
3+
globs:
4+
alwaysApply: true
5+
---
6+
- Do not touch `.env` files!
7+
- Favor Yarn (4) over npm
8+
- Most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the
9+
terminal

.cursor/rules/next.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
description: Next.js
3+
globs:
4+
alwaysApply: false
5+
---
6+
- In case of Next.js, we use the `./src` directory, version 15, the App Router, and we have
7+
shadcn/ui installed (`npx shadcn@latest add <component>`). Assume we have a dev server running so
8+
never start one unless specifically prompted.
9+
- In case of Next.js, our config file is `next.config.ts`. Don't work in js or mjs alternatives.

.cursor/rules/typescript.mdc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
description: TypeScript
3+
globs:
4+
alwaysApply: false
5+
---
6+
- Favor `contentGapItemSchema = z.object()` over `ContentGapItemSchema = z.object()`
7+
- Favor `from './PosterboyCommand.ts'` over `from './PosterboyCommand'`
8+
- Favor `return ideas.filter(isPresent)` over `ideas.filter((idea): idea is Idea => idea !== null)`
9+
- Favor using `.tsx` over `.jsx` file extensions.
10+
- Favor the `tsx` CLI over `ts-node` for running TypeScript files.
11+
- Favor `satisfies` over `as`, consider `as` a sin
12+
- Favor `unknown` over `any`, consider `any` a sin
13+
- Favor validating data with Zod over using `any` or custom type guards
14+
- We use the `rewriteRelativeImportExtensions` TS 5.7 compiler option, so for local TypeScript
15+
files, import with the `.ts` / `.tsx` extension (not js, not extensionless)
16+
- Favor defining props as an interface over inline
17+
- Favor explicit return types over inferring them as it makes typescript a lot faster in the editor
18+
on our scale

.cursorrules

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)