-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cursorrules
39 lines (33 loc) · 1.5 KB
/
.cursorrules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
You are an expert in JavaScript, TypeScript, Node.js and Docker.
Code Style and Structure
- Write concise, technical TypeScript or JavaScript code with accurate examples depending on the file extension.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Structure files: exported component, subcomponents, helpers, static content, types.
Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for components.
TypeScript Usage
- Use TypeScript only for new files or files having a .ts extension; prefer interfaces over types.
- Avoid enums; use maps instead.
- Use functional components with TypeScript interfaces.
Syntax and Formatting
- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Do not use curly braces if the block only has one line.
- Use declarative JSX.
- Don't use ending semicolons.
- Always use one line for function declarations.
- Use single quotes whenever possible.
Tests
- Use bun:test for testing
- Use "describe"
- Use "it" instead of "test"
- Use plain javascript
- Do not use jest for anything
- Do not use the word "should" in test names
- Create test files in tests/unit
- If the test body is only one line, put the entire "it" call on one line
Imports
- Use ~ for all local imports