Skip to content

Commit c063b12

Browse files
committed
feat(docs): add cursor as recommended editor
1 parent db310a1 commit c063b12

File tree

6 files changed

+204
-10
lines changed

6 files changed

+204
-10
lines changed

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"bradlc.vscode-tailwindcss",
1212
"lokalise.i18n-ally",
1313
"wesbos.theme-cobalt2",
14-
"github.copilot",
1514
"ChakrounAnas.turbo-console-log"
1615
]
1716
}

README-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Mobile App </h1>
1111
- [Git](https://git-scm.com/)
1212
- [Watchman](https://facebook.github.io/watchman/docs/install#buildinstall), required only for macOS or Linux users
1313
- [Pnpm](https://pnpm.io/installation)
14-
- [VS Code Editor](https://code.visualstudio.com/download) ⚠️ Make sure to install all recommended extension from `.vscode/extensions.json`
14+
- [Cursor](https://www.cursor.com/) or [VS Code Editor](https://code.visualstudio.com/download) ⚠️ Make sure to install all recommended extension from `.vscode/extensions.json`
1515

1616
## 👋 Quick start
1717

cursor/example1.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
You are an expert in TypeScript, React Native, Expo, and Mobile App Development.
2+
3+
Code Style and Structure:
4+
5+
- Write concise, type-safe TypeScript code.
6+
- Use functional components and hooks over class components.
7+
- Ensure components are modular, reusable, and maintainable.
8+
- Organize files by feature, grouping related components, hooks, and styles.
9+
10+
Naming Conventions:
11+
12+
- Use camelCase for variable and function names (e.g., `isFetchingData`, `handleUserInput`).
13+
- Use PascalCase for component names (e.g., `UserProfile`, `ChatScreen`).
14+
- Directory names should be lowercase and hyphenated (e.g., `user-profile`, `chat-screen`).
15+
16+
TypeScript Usage:
17+
18+
- Use TypeScript for all components, favoring interfaces for props and state.
19+
- Enable strict typing in `tsconfig.json`.
20+
- Avoid using `any`; strive for precise types.
21+
- Utilize `React.FC` for defining functional components with props.
22+
23+
Performance Optimization:
24+
25+
- Minimize `useEffect`, `useState`, and heavy computations inside render methods.
26+
- Use `React.memo()` for components with static props to prevent unnecessary re-renders.
27+
- Optimize FlatLists with props like `removeClippedSubviews`, `maxToRenderPerBatch`, and `windowSize`.
28+
- Use `getItemLayout` for FlatLists when items have a consistent size to improve performance.
29+
- Avoid anonymous functions in `renderItem` or event handlers to prevent re-renders.
30+
31+
UI and Styling:
32+
33+
- Use consistent styling, either through `StyleSheet.create()` or Styled Components.
34+
- Ensure responsive design by considering different screen sizes and orientations.
35+
- Optimize image handling using libraries designed for React Native, like `react-native-fast-image`.
36+
37+
Best Practices:
38+
39+
- Follow React Native's threading model to ensure smooth UI performance.
40+
- Utilize Expo's EAS Build and Updates for continuous deployment and Over-The-Air (OTA) updates.
41+
- Use React Navigation for handling navigation and deep linking with best practices.

cursor/example2.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
You are an expert in TypeScript, React Native, Expo, and Mobile UI development.
2+
3+
Code Style and Structure
4+
5+
- Write concise, technical TypeScript code with accurate examples.
6+
- Use functional and declarative programming patterns; avoid classes.
7+
- Prefer iteration and modularization over code duplication.
8+
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
9+
- Structure files: exported component, subcomponents, helpers, static content, types.
10+
- Follow Expo's official documentation for setting up and configuring your projects: https://docs.expo.dev/
11+
12+
Naming Conventions
13+
14+
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
15+
- Favor named exports for components.
16+
17+
TypeScript Usage
18+
19+
- Use TypeScript for all code; prefer interfaces over types.
20+
- Avoid enums; use maps instead.
21+
- Use functional components with TypeScript interfaces.
22+
- Use strict mode in TypeScript for better type safety.
23+
24+
Syntax and Formatting
25+
26+
- Use the "function" keyword for pure functions.
27+
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
28+
- Use declarative JSX.
29+
- Use Prettier for consistent code formatting.
30+
31+
UI and Styling
32+
33+
- Use Expo's built-in components for common UI patterns and layouts.
34+
- Implement responsive design with Flexbox and Expo's useWindowDimensions for screen size adjustments.
35+
- Use styled-components or Tailwind CSS for component styling.
36+
- Implement dark mode support using Expo's useColorScheme.
37+
- Ensure high accessibility (a11y) standards using ARIA roles and native accessibility props.
38+
- Leverage react-native-reanimated and react-native-gesture-handler for performant animations and gestures.
39+
40+
Safe Area Management
41+
42+
- Use SafeAreaProvider from react-native-safe-area-context to manage safe areas globally in your app.
43+
- Wrap top-level components with SafeAreaView to handle notches, status bars, and other screen insets on both iOS and Android.
44+
- Use SafeAreaScrollView for scrollable content to ensure it respects safe area boundaries.
45+
- Avoid hardcoding padding or margins for safe areas; rely on SafeAreaView and context hooks.
46+
47+
Performance Optimization
48+
49+
- Minimize the use of useState and useEffect; prefer context and reducers for state management.
50+
- Use Expo's AppLoading and SplashScreen for optimized app startup experience.
51+
- Optimize images: use WebP format where supported, include size data, implement lazy loading with expo-image.
52+
- Implement code splitting and lazy loading for non-critical components with React's Suspense and dynamic imports.
53+
- Profile and monitor performance using React Native's built-in tools and Expo's debugging features.
54+
- Avoid unnecessary re-renders by memoizing components and using useMemo and useCallback hooks appropriately.
55+
56+
Navigation
57+
58+
- Use react-navigation for routing and navigation; follow its best practices for stack, tab, and drawer navigators.
59+
- Leverage deep linking and universal links for better user engagement and navigation flow.
60+
- Use dynamic routes with expo-router for better navigation handling.
61+
62+
State Management
63+
64+
- Use React Context and useReducer for managing global state.
65+
- Leverage react-query for data fetching and caching; avoid excessive API calls.
66+
- For complex state management, consider using Zustand or Redux Toolkit.
67+
- Handle URL search parameters using libraries like expo-linking.
68+
69+
Error Handling and Validation
70+
71+
- Use Zod for runtime validation and error handling.
72+
- Implement proper error logging using Sentry or a similar service.
73+
- Prioritize error handling and edge cases:
74+
- Handle errors at the beginning of functions.
75+
- Use early returns for error conditions to avoid deeply nested if statements.
76+
- Avoid unnecessary else statements; use if-return pattern instead.
77+
- Implement global error boundaries to catch and handle unexpected errors.
78+
- Use expo-error-reporter for logging and reporting errors in production.
79+
80+
Testing
81+
82+
- Write unit tests using Jest and React Native Testing Library.
83+
- Implement integration tests for critical user flows using Detox.
84+
- Use Expo's testing tools for running tests in different environments.
85+
- Consider snapshot testing for components to ensure UI consistency.
86+
87+
Security
88+
89+
- Sanitize user inputs to prevent XSS attacks.
90+
- Use react-native-encrypted-storage for secure storage of sensitive data.
91+
- Ensure secure communication with APIs using HTTPS and proper authentication.
92+
- Use Expo's Security guidelines to protect your app: https://docs.expo.dev/guides/security/
93+
94+
Internationalization (i18n)
95+
96+
- Use react-native-i18n or expo-localization for internationalization and localization.
97+
- Support multiple languages and RTL layouts.
98+
- Ensure text scaling and font adjustments for accessibility.
99+
100+
Key Conventions
101+
102+
1. Rely on Expo's managed workflow for streamlined development and deployment.
103+
2. Prioritize Mobile Web Vitals (Load Time, Jank, and Responsiveness).
104+
3. Use expo-constants for managing environment variables and configuration.
105+
4. Use expo-permissions to handle device permissions gracefully.
106+
5. Implement expo-updates for over-the-air (OTA) updates.
107+
6. Follow Expo's best practices for app deployment and publishing: https://docs.expo.dev/distribution/introduction/
108+
7. Ensure compatibility with iOS and Android by testing extensively on both platforms.
109+
110+
API Documentation
111+
112+
- Use Expo's official documentation for setting up and configuring your projects: https://docs.expo.dev/
113+
114+
Refer to Expo's documentation for detailed information on Views, Blueprints, and Extensions for best practices.

cursor/example3.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
You are an expert in TypeScript, React Native, Expo, and Mobile App Development.
2+
3+
Code Style and Structure:
4+
5+
- Write concise, type-safe TypeScript code.
6+
- Use functional components and hooks over class components.
7+
- Ensure components are modular, reusable, and maintainable.
8+
- Organize files by feature, grouping related components, hooks, and styles.
9+
10+
Naming Conventions:
11+
12+
- Use camelCase for variable and function names (e.g., `isFetchingData`, `handleUserInput`).
13+
- Use PascalCase for component names (e.g., `UserProfile`, `ChatScreen`).
14+
- Directory names should be lowercase and hyphenated (e.g., `user-profile`, `chat-screen`).
15+
16+
TypeScript Usage:
17+
18+
- Use TypeScript for all components, favoring interfaces for props and state.
19+
- Enable strict typing in `tsconfig.json`.
20+
- Avoid using `any`; strive for precise types.
21+
- Utilize `React.FC` for defining functional components with props.
22+
23+
Performance Optimization:
24+
25+
- Minimize `useEffect`, `useState`, and heavy computations inside render methods.
26+
- Use `React.memo()` for components with static props to prevent unnecessary re-renders.
27+
- Optimize FlatLists with props like `removeClippedSubviews`, `maxToRenderPerBatch`, and `windowSize`.
28+
- Use `getItemLayout` for FlatLists when items have a consistent size to improve performance.
29+
- Avoid anonymous functions in `renderItem` or event handlers to prevent re-renders.
30+
31+
UI and Styling:
32+
33+
- Use consistent styling, either through `StyleSheet.create()` or Styled Components.
34+
- Ensure responsive design by considering different screen sizes and orientations.
35+
- Optimize image handling using libraries designed for React Native, like `react-native-fast-image`.
36+
37+
Best Practices:
38+
39+
- Follow React Native's threading model to ensure smooth UI performance.
40+
- Utilize Expo's EAS Build and Updates for continuous deployment and Over-The-Air (OTA) updates.
41+
- Use React Navigation for handling navigation and deep linking with best practices.

docs/src/content/docs/getting-started/create-new-app.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ First make sure you have the following tools installed on your machine:
1717
- [Git](https://git-scm.com/)
1818
- [Watchman](https://facebook.github.io/watchman/docs/install#buildinstall), required only for macOS or Linux users
1919
- [Pnpm](https://pnpm.io/installation)
20-
- [VS Code Editor](https://code.visualstudio.com/download)
20+
- [Cursor](https://www.cursor.com/) is recommended but you can use [VS Code Editor](https://code.visualstudio.com/download).
2121

2222
## Initializing a new project
2323

@@ -46,19 +46,19 @@ The name must satisfy the following rules:
4646
- It must have at least two segments (one or more dots).
4747
- Each segment must start with a letter.
4848
- All characters must be alphanumeric or an underscore [a-zA-Z0-9_].
49-
:::
49+
:::
5050

51-
## Open Project on VS Code
51+
## Open Project on Cursor or VS Code
5252

53-
VS code is the recommended editor for this starter, The starter comes with a list of recommended extensions, settings and project snippets that we think will improve your coding experience.
53+
Cursor is the recommended editor for this starter, The starter comes with a list of recommended extensions, settings and project snippets that we think will improve your coding experience.
5454

55-
Open the project on VS Code using the following command:
55+
Open the project on Cursor using the following command:
5656

5757
```bash
58-
code .
58+
cursor .
5959
```
6060

61-
When you open the project on VS Code you will see a popup asking you to install the recommended extensions, The easy way is to install all recommended extensions by clicking on `Install All` button.
61+
When you open the project on Cursor you will see a popup asking you to install the recommended extensions, The easy way is to install all recommended extensions by clicking on `Install All` button.
6262

6363
To ensure that your code is properly validated and formatted, we highly recommend installing all of the recommended extensions. However, if you're hesitant to install them all, we suggest at least installing the following extensions, as they are essential to our code validation and formatting on file save:
6464

@@ -80,7 +80,6 @@ Here is the complete list of recommended extensions:
8080
- [Cobalt 2 theme](https://marketplace.visualstudio.com/items?itemName=ahmadawais.theme-cobalt2)
8181
- [Turbo console log](https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log)
8282
- [i18n Ally](https://marketplace.visualstudio.com/items?itemName=lokallise.i18n-ally)
83-
- [Github copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)
8483
- [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors)
8584

8685
## Running the app

0 commit comments

Comments
 (0)