Skip to content

Commit ecffb7e

Browse files
committed
chore: more rules
1 parent 5303d9e commit ecffb7e

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.rules

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,46 @@ code.
88
- It uses Nitro Modules to bridge JS & C++.
99
- Use the documentation of Nitro Modules if you have access locally to its llms.txt file.
1010
- Part of the API strives to be a polyfill of the Node.js {crypto} module.
11-
- The goal is to migrate 0.x of this library that uses OpenSSL 1.1.1 to now use OpenSSL 3.3and modern C++ with Nitro Modules.
11+
- The goal is to migrate 0.x of this library that uses OpenSSL 1.1.1 to now use OpenSSL 3.3 and modern C++ with Nitro Modules.
1212

1313
## Tech Stack
1414
- React Native
1515
- Typescript
1616
- Nitro Modules
1717
- C++ 20 and higher, modern
1818
- OpenSSL 3.3 and higher
19+
- TypeScript package manager is `bun` 1.2 or higher
1920
- don't ask to run tests. They have to be run in an example React Native app.
2021

2122
## Rules
2223
- for C++ includes, do not try to add absolute or relative paths. They have to be resolved by the build system.
2324
- use smart pointers in C++
2425
- use modern C++ features
26+
- Attempt to reduce the amount of code rather than add more.
27+
- Prefer iteration and modularization over code duplication.
28+
29+
# TypeScript Best Practices
30+
31+
- Use TypeScript for all code; prefer interfaces over types.
32+
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
33+
- Favor named exports for components.
34+
- Avoid any and enums; use explicit types and maps instead.
35+
- Use functional components with TypeScript interfaces.
36+
- Enable strict mode in TypeScript for better type safety.
37+
- Suggest the optimal implementation considering:
38+
- Performance impact
39+
- Maintenance overhead
40+
- Testing strategy
41+
- Code examples should follow Typescript best practices.
42+
43+
# React Best Practices
44+
45+
- Minimize the use of useEffect. They should be a last resort.
46+
- Use named functions for useEffects with a meaningful function name. Avoiding adding unnecessary comments on effect behavior.
47+
48+
# Syntax & Formatting
49+
50+
- Use the function keyword for pure functions.
51+
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
52+
- Use declarative JSX.
53+
- Use Prettier for consistent code formatting.

0 commit comments

Comments
 (0)