mirror of
https://github.com/voideditor/void
synced 2026-05-23 09:28:23 +00:00
add cursor rule (#2)
Co-authored-by: David Halim <david.halim@rakuten.com>
This commit is contained in:
parent
17e7a5b152
commit
45b9da45e4
4 changed files with 88 additions and 0 deletions
25
.cursor/rules/naming-conventions.mdc
Normal file
25
.cursor/rules/naming-conventions.mdc
Normal 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>();
|
||||
```
|
||||
23
.cursor/rules/scope-and-validation.mdc
Normal file
23
.cursor/rules/scope-and-validation.mdc
Normal 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.
|
||||
28
.cursor/rules/typescript-conventions.mdc
Normal file
28
.cursor/rules/typescript-conventions.mdc
Normal 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.
|
||||
12
.cursor/rules/void-context.mdc
Normal file
12
.cursor/rules/void-context.mdc
Normal 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.
|
||||
Loading…
Reference in a new issue