Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .context/global/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ created: 2026-05-06
Nesalia Inc.

## Description
Une entreprise qui développe le futur de l'excellence informatique, education et software de demain avec DeesseJS comme framework principal. Comme Vercel pour l'éducation informatique.
A company developing the future of computer science excellence, education, and software with DeesseJS as the primary framework. Like Vercel for computer science education.

## Size
Small (2-10)
Expand Down
2 changes: 1 addition & 1 deletion .context/project/rules/conventions/imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { Hono } from 'hono';
import { createRouter } from './router';
```

## Why
## Rationale
Clear separation makes dependencies explicit and helps identify what belongs where.

## Enforcement
Expand Down
158 changes: 158 additions & 0 deletions .context/project/rules/conventions/typescript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
created: 2026-05-07
type: convention
domain: code
---

# Convention: Use `type` Instead of `interface`

## Rule

Prefer `type` aliases over `interface` declarations for defining object shapes and type aliases.

## Details

Using `type` provides better consistency with the codebase's functional approach. It also allows for union types, intersections, and utility types without requiring augmentation. Type aliases are more lightweight and align with TypeScript's recommendation for most use cases.

## Examples

### ✅ Correct

```typescript
type User = {
id: string;
name: string;
};

type Id = string | number;
type Response<T> = { data: T; error: null } | { data: null; error: Error };
```

### ❌ Incorrect

```typescript
interface User {
id: string;
name: string;
}

interface Response<T> {
data: T;
error: null;
}
```

## Enforcement

ESLint rule `typescript-eslint/consistent-type-definitions` set to `"type"`.

---

# Convention: No `any` — Use Generics

## Rule

Never use `any`. Use generics, `unknown`, or type guards instead.

## Details

Using `any` bypasses TypeScript's type safety, making code harder to maintain and refactor. Generics provide flexible, type-safe abstractions without sacrificing safety. Use `unknown` when the type is truly indeterminate and narrow it with type guards or type assertions.

## Examples

### ✅ Correct

```typescript
function parse<T>(input: string): T {
return JSON.parse(input) as T;
}

function process<T>(items: T[]): T[] {
return items.map((item) => item);
}

function identity<T>(value: T): T {
return value;
}

function safeStringify(value: unknown): string {
if (typeof value === 'string') return value;
return JSON.stringify(value);
}
```

### ❌ Incorrect

```typescript
function parse(input: string): any {
return JSON.parse(input);
}

function process(items: any[]): any[] {
return items.map((item) => item);
}

function identity(value: any): any {
return value;
}
```

## Enforcement

ESLint rules:
- `@typescript-eslint/no-explicit-any`
- `@typescript-eslint/no-explicit-any` (error-level)
- `@typescript-eslint/consistent-type-assertions` (for `as any` violations)

---

# Convention: No `function` Declarations — Use `const` with Arrow Functions

## Rule

Do not use the `function` keyword. Use `const` with arrow functions instead.

## Details

Arrow functions provide a consistent style across the codebase. They are more concise, lexically bind `this`, and align with the functional-first approach. Using `const` with arrow functions also makes it clearer that the value is not reassigned.

## Examples

### ✅ Correct

```typescript
const parse = <T>(input: string): T => {
return JSON.parse(input) as T;
};

const process = <T>(items: T[]): T[] => {
return items.map((item) => item);
};

const identity = <T>(value: T): T => value;

const safeStringify = (value: unknown): string => {
if (typeof value === 'string') return value;
return JSON.stringify(value);
};
```

### ❌ Incorrect

```typescript
function parse<T>(input: string): T {
return JSON.parse(input) as T;
}

function process<T>(items: T[]): T[] {
return items.map((item) => item);
}

function identity<T>(value: T): T {
return value;
}
```

## Enforcement

ESLint rule `@typescript-eslint/func-style` set to `arrow-expression`.
Loading
Loading