Skip to content

Commit 34ad597

Browse files
gamegeeaammami-ledger
authored andcommitted
chore(cursor): minor fixes on cursor rules + add cursor commands (try it)
Signed-off-by: Simon Bruneaud <simon.bruneaud@ledger.fr>
1 parent e1eddca commit 34ad597

File tree

8 files changed

+140
-9
lines changed

8 files changed

+140
-9
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Adress github pull request comments
2+
3+
## Overview
4+
Fetch the unresolved comments from github and fix them
5+
6+
## Steps
7+
8+
1. **Fetch the comments**
9+
- Use gh CLI to fetch unresolved comments body
10+
- For each comment make a brief summary of the comment
11+
- Render the result in a table
12+
- Ask in the prompt if it should be fixed
13+
14+
2. **Fix comments**
15+
- Fix comments one by one
16+
- Make sure lint and tests pass
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Code Review Checklist
2+
3+
Checklist for code reviews in the LDLS monorepo (`ui-react` and `ui-rnative`).
4+
Check the code diff from main
5+
6+
---
7+
8+
Output summary in a table that's easy to understand and read.
9+
Show details of the errors if there are only fews, otherwise show the number of errors by category
10+
11+
## General
12+
13+
- [ ] Code works correctly and handles edge cases
14+
- [ ] No obvious bugs, security issues, or hardcoded secrets
15+
- [ ] Code is readable with descriptive names
16+
- [ ] No code duplication
17+
18+
## TypeScript
19+
20+
- [ ] Top-level functions are typesafe (except JSX components)
21+
- [ ] No `any` types
22+
- [ ] Typecheck for affected nx libs/apps passes
23+
24+
## Lint
25+
26+
- [ ] Lint for affected nx libs/apps passes
27+
28+
## Components
29+
30+
- [ ] Components use **PascalCase** folders (`Button/`)
31+
- [ ] Other files use **dash-case** (`use-controllable-state.ts`)
32+
- [ ] Files organized: `Component.tsx`, `Component.test.tsx`, `Component.stories.tsx`, `Component.mdx`, `index.ts`
33+
- [ ] Types are defined in a separate file `types.ts` of the component, with clear, consistent description and default if component props has a default
34+
- [ ] `index.ts` expose the component, compound components and types
35+
- [ ] Namings are explicit, makes sense and follow standards
36+
37+
## Design System React
38+
39+
- [ ] Uses design tokens from design-core tailwind preset for web
40+
- Typography: `body-1`, `heading-2` (not `font-bold`, `text-sm`)
41+
- Colors: `text-base`, `bg-accent` (not `text-gray-500`)
42+
- Sizes: token values only (no `w-[108px]`)
43+
- [ ] Uses `cn()` for conditional classes
44+
- [ ] Uses `cva` for variant composition
45+
46+
## Design System React-Native
47+
48+
- [ ] Uses design tokens from design-core theme js object preset for react-native
49+
- theme.colors.bg.accent
50+
- theme.spacings.s20
51+
- ...
52+
- [ ] Uses `cn()` for conditional classes
53+
- [ ] Uses `sva` for variant composition
54+
55+
## Storybook
56+
57+
- [ ] Default story named `Base` (not `Default` or `Primary`)
58+
- [ ] Showcase stories use `{Property}Showcase` pattern if necessary
59+
- [ ] Stories have `layout: 'centered'` and `backgrounds: { default: 'light' }`
60+
61+
---
62+
63+
## Platform-Specific
64+
65+
| Check | React (`ui-react`) | React Native (`ui-rnative`) |
66+
|-------|-------------------|----------------------------|
67+
| Test ID | `data-testid` | `testID` |
68+
| Test framework | Vitest | Jest |
69+
| Test imports | `import { vi } from 'vitest'` | `import { jest } from '@jest/globals'` |
70+
| Click handler | `onClick` | `onPress` |
71+
| Mock function | `vi.fn()` | `jest.fn()` |
72+
73+
---
74+

.cursor/commands/lint-and-fix.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Run Lint and Fix
2+
3+
## Overview
4+
Execute the lint suite of the impacted apps or libs and systematically fix any failures.
5+
6+
## Steps
7+
- Run lint commands on the affected app or libs
8+
- Look at errors, focus on the important ones.
9+
- Show summary per libs/apps as prompt result and show easily fixable errors
10+
- Ask users if he wants to fix easily fixable errors

.cursor/commands/test-and-fix.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Run Tests and Fix Failures
2+
3+
## Overview
4+
Execute the test suite of the impacted apps or libs and systematically fix any failures, ensuring code quality and functionality.
5+
6+
## Steps
7+
8+
1. **Run test suite**
9+
- Determines the affected nx apps or libs (compare to main) and run typecheck commands on these
10+
- Capture output and identify failures
11+
- Check both unit and integration tests
12+
13+
2. **Analyze failures**
14+
- Categorize by type: flaky, broken, new failures
15+
- Prioritize fixes based on impact
16+
- Check if failures are related to recent changes
17+
- Ask user if he wants to fix issues
18+
19+
3. **Fix issues systematically**
20+
- Start with the most critical failures
21+
- Fix one issue at a time
22+
- Re-run tests after each fix

.cursor/commands/typecheck.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Run Typecheck and Fix
2+
3+
## Overview
4+
Execute the typecheck suite of the impacted apps or libs and systematically fix any failures.
5+
6+
## Steps
7+
- Turn ASK mode ON
8+
- Determines the affected nx apps or libs (compare to main)
9+
- Run nx build-deps in one command on affecteds
10+
- Run nx typecheck in one command on affecteds "--nx-bail=false"
11+
- Show summary per libs/apps as prompt result

.cursor/rules/components.mdc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ globs:
44
alwaysApply: true
55
---
66

7-
87
# class-variance-authority (cva)
98
- Use cva at the top of the file to compose classnames when there is variants composition
109
- Use cva at the top of the file when there are lots of classnames to declare for a given element

.cursor/rules/design-system.mdc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ Before using width/height utilities:
6767
- Use `border` for default width
6868
- Use `border-2` for active/emphasized states
6969

70-
- Drop shadow utilities from `createDropShadowPlugin`:
71-
- `drop-shadow-sm`: 1px 4px rgba(0, 0, 0, 0.16)
72-
- `drop-shadow-md`: 2px 8px rgba(0, 0, 0, 0.16)
73-
- `drop-shadow-lg`: 4px 16px rgba(0, 0, 0, 0.16)
74-
- `drop-shadow-xl`: 6px 24px rgba(0, 0, 0, 0.16)
75-
- `drop-shadow-2xl`: 8px 32px rgba(0, 0, 0, 0.16)
70+
- Shadow utilities from `createShadowPlugin`:
71+
- `shadow-sm`: 1px 4px rgba(0, 0, 0, 0.16)
72+
- `shadow-md`: 2px 8px rgba(0, 0, 0, 0.16)
73+
- `shadow-lg`: 4px 16px rgba(0, 0, 0, 0.16)
74+
- `shadow-xl`: 6px 24px rgba(0, 0, 0, 0.16)
75+
- `shadow-2xl`: 8px 32px rgba(0, 0, 0, 0.16)
7676

7777
# Gradients
7878

apps/app-sandbox-rnative/src/app/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
21
import {
32
GlobalSelectBottomSheet,
43
GlobalTooltipBottomSheet,
@@ -49,7 +48,7 @@ export const App = () => {
4948
<SafeAreaView className={`${colorScheme} flex flex-1 bg-canvas`}>
5049
<StatusBar />
5150
<ThemeProvider
52-
themes={ledgerLiveThemes}
51+
themes={{ test: 'yo' }}
5352
colorScheme={colorScheme}
5453
locale={locale}
5554
>

0 commit comments

Comments
 (0)