|
| 1 | +# Repository technical context |
| 2 | + |
| 3 | +This is a modern, ESM-only React library that wraps TradingView's Lightweight Charts with idiomatic React components. |
| 4 | +The repository contains library code and example usage. |
| 5 | + |
| 6 | +## General Guidelines |
| 7 | + |
| 8 | +- Use React 16.8.0+ and ESM-only syntax. |
| 9 | +- All components are functional and use React Hooks only. No class components. |
| 10 | +- Follow strict TypeScript typing. Avoid `any` unless absolutely necessary. |
| 11 | +- Use named exports for all components and hooks. |
| 12 | +- Library files are not placed in the root, but under `lib/` directory. |
| 13 | +- The library supports tree-shaking. Ensure exports stay modular and side-effect free. |
| 14 | +- Do not include React state or props unrelated to chart rendering. |
| 15 | +- lightweight-charts is a peer dependency of the project. |
| 16 | +- Only lightweight-charts 5+ version is compatible with this library. |
| 17 | +- Library internal hooks should be named with the `use` prefix, e.g., `useChart`, `useSeries`. |
| 18 | + |
| 19 | +## Styling & DOM |
| 20 | + |
| 21 | +- Do not use external CSS. Library does not need any styling. |
| 22 | +- Never use className or style props unless the chart component explicitly needs a wrapper div. |
| 23 | + |
| 24 | +## Testing |
| 25 | + |
| 26 | +- Tests use Vitest. |
| 27 | +- Mock DOM and chart dependencies where needed. |
| 28 | + |
| 29 | +## Code Style |
| 30 | + |
| 31 | +- Use `tsx` for all component files. |
| 32 | +- Keep props interfaces named as `ComponentNameProps`. |
| 33 | +- Use `PascalCase` for components and `camelCase` for hooks. |
| 34 | +- Write clear JSDoc comments for public components and utilities. |
| 35 | +- Use `eslint` and `prettier` for code formatting and linting. |
| 36 | +- Implement comprehensive error handling |
| 37 | +- Write maintainable, self-documenting code |
| 38 | +- Follow security best practices |
| 39 | +- Ensure proper type coverage |
0 commit comments