Skip to content

Commit 9284441

Browse files
chore: add React component file structure conventions to CLAUDE.md (#16125)
## Summary Adds guidance to CLAUDE.md for React/SCSS file organization. Each component should have its own named folder with `index.tsx` and `index.scss` rather than multiple `ComponentName.tsx` files sharing a single `.scss` in one directory.
1 parent a6735f3 commit 9284441

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,20 @@ Payload is a monorepo structured around Next.js, containing the core CMS platfor
7171
- Invalid: `payload.logger.error('message', err)` - don't pass error as second argument
7272
- Use `err` not `error`, use `msg` not `message` in object form
7373

74+
### React Component File Structure
75+
76+
Each React component should have its own named folder:
77+
78+
```
79+
ComponentName/
80+
├── index.tsx # Component implementation
81+
└── index.scss # Styles (if applicable)
82+
```
83+
84+
- **Do:** Create a folder per component with `index.tsx` and `index.scss`
85+
- **Don't:** Place multiple `ComponentName.tsx` files in a single folder with one shared `.scss` file
86+
- Re-export from barrel files (`index.ts`) when grouping related components in a parent directory
87+
7488
### Running Dev Server
7589

7690
- `pnpm run dev` - Start dev server with default config (`test/_community/config.ts`)

0 commit comments

Comments
 (0)