add cursor rule (#2)

Co-authored-by: David Halim <david.halim@rakuten.com>
This commit is contained in:
davi0015 2026-04-20 15:48:33 +08:00 committed by GitHub
parent 17e7a5b152
commit 45b9da45e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 88 additions and 0 deletions

View file

@ -0,0 +1,25 @@
---
description: Naming conventions for value mappings in the Void project
alwaysApply: true
---
# Naming Conventions
## Mapping Types: `bOfA`
All types/variables that map from a value **A** to a value **B** should be named **`bOfA`**.
Examples:
- A hashmap from `toolId` to `toolName` → `toolNameOfToolId`
- A map from `userId` to `userEmail` → `userEmailOfUserId`
- A map from `fileUri` to `fileContent` → `fileContentOfFileUri`
```typescript
// BAD
const toolMap: Record<string, string> = {};
const idToName = new Map<ToolId, ToolName>();
// GOOD
const toolNameOfToolId: Record<ToolId, ToolName> = {};
const userEmailOfUserId = new Map<UserId, Email>();
```

View file

@ -0,0 +1,23 @@
---
description: Scope guardrails and validation policy for the Void project
alwaysApply: true
---
# Scope & Validation
## Modification Scope
**Never** modify files outside `src/vs/workbench/contrib/void` without consulting with the user first.
If a change appears to require touching files in other parts of the repo (e.g. core VSCode files, build configs, other contribs), pause and ask before editing.
## Validation Policy
Do **not** run anything to validate your changes. This includes:
- `npm run`, `yarn`, `pnpm` build/test/lint scripts
- `tsc`, `eslint`, or any type-checker / linter directly
- Launching the app
Instead, **tell the user what to run** to validate the changes, e.g.:
> To validate, please run `npm run watch` and reload the Extension Host window.

View file

@ -0,0 +1,28 @@
---
description: TypeScript conventions for the Void project
globs: **/*.ts,**/*.tsx
alwaysApply: false
---
# TypeScript Conventions
## No Unnecessary Casting
Do **NOT** cast to types if not necessary. **NEVER** lazily cast to `any`. Find the correct type to apply and use it.
```typescript
// BAD
const result = (data as any).value;
const node = something as MyType;
// GOOD
const result: ValueType = data.value;
// If types genuinely don't line up, fix the source type or use a type guard:
if (isMyType(something)) {
const node = something;
}
```
## Semicolons
Do **not** add or remove semicolons in existing files. Follow the existing convention of the file and make the **least** number of changes.

View file

@ -0,0 +1,12 @@
---
description: Project context for the Void repo (a VSCode fork)
alwaysApply: true
---
# Void Project Context
This is a fork of the VSCode repo called **Void**.
- Most code we care about lives in `src/vs/workbench/contrib/void`.
- You may often need to explore the full repo to find relevant parts of code.
- Look for existing services and built-in functions you might need to reuse instead of re-implementing functionality.