|
8 | 8 | - It uses Nitro Modules to bridge JS & C++.
|
9 | 9 | - Use the documentation of Nitro Modules if you have access locally to its llms.txt file.
|
10 | 10 | - 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. |
12 | 12 |
|
13 | 13 | ## Tech Stack
|
14 | 14 | - React Native
|
15 | 15 | - Typescript
|
16 | 16 | - Nitro Modules
|
17 | 17 | - C++ 20 and higher, modern
|
18 | 18 | - OpenSSL 3.3 and higher
|
| 19 | +- TypeScript package manager is `bun` 1.2 or higher |
19 | 20 | - don't ask to run tests. They have to be run in an example React Native app.
|
20 | 21 |
|
21 | 22 | ## Rules
|
22 | 23 | - for C++ includes, do not try to add absolute or relative paths. They have to be resolved by the build system.
|
23 | 24 | - use smart pointers in C++
|
24 | 25 | - 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