|
| 1 | +# GitHub Copilot Instructions |
| 2 | + |
| 3 | +## Development Philosophy |
| 4 | + |
| 5 | +- **Quality over quantity**: Write clean, maintainable, and well-structured code |
| 6 | +- **Senior-level TypeScript**: Leverage advanced TypeScript features for type safety |
| 7 | +- **Minimal and focused**: Every line of code should serve a clear purpose |
| 8 | +- **Performance-conscious**: Consider efficiency and avoid unnecessary complexity |
| 9 | + |
| 10 | +## TypeScript & ESLint Rules |
| 11 | + |
| 12 | +- **No console.log**: Use proper logging or remove debug statements |
| 13 | +- **Consistent type imports**: Use `import type` for type-only imports |
| 14 | +- **No unused vars**: Prefix with `_` if intentionally unused |
| 15 | +- **No unnecessary conditions**: Avoid redundant null checks |
| 16 | +- **No non-null assertions**: Use proper type guards instead of `!` |
| 17 | +- **Prefer top-level type imports**: Keep type imports at the top |
| 18 | +- **Array type syntax**: Use `readonly T[]` instead of `ReadonlyArray<T>` |
| 19 | +- **Prefer nullish coalescing**: Use `??` instead of `||` for safer null/undefined checks |
| 20 | +- **Prefer optional chaining**: Use `?.` for more concise and readable property access |
| 21 | +- **No import extensions**: Never use `.js`, `.ts` extensions in imports |
| 22 | +- **No useless path segments**: Avoid `/index` in import paths when possible |
| 23 | +- **Prefer directory imports**: Use `../src` instead of `../src/index` for cleaner imports |
| 24 | + |
| 25 | +## Prettier Configuration |
| 26 | + |
| 27 | +- **Print width**: 100 characters max |
| 28 | +- **No semicolons**: Use semicolon-free style |
| 29 | +- **Import order**: Follow the specified import grouping: |
| 30 | + 1. Types first |
| 31 | + 2. React/Next.js/Expo (if applicable) |
| 32 | + 3. Third-party modules |
| 33 | + 4. @vorsteh-queue packages |
| 34 | + 5. Relative imports (~/,../, ./) |
| 35 | + |
| 36 | +## Code Generation Guidelines |
| 37 | + |
| 38 | +- Remove all `console.log` statements from generated code |
| 39 | +- Use proper TypeScript types instead of `any` when possible |
| 40 | +- **Use type-fest when available** - Prefer battle-tested utility types from type-fest over custom implementations |
| 41 | +- Add ESLint disable comments only when absolutely necessary |
| 42 | +- Follow the import order specified in prettier config |
| 43 | +- Use consistent naming conventions (camelCase for variables, PascalCase for types) |
| 44 | +- **Generic type parameters**: Always prefix with `T` (e.g., `TJobPayload`, `TResult`, `TEventData`) |
| 45 | +- Prefer explicit return types for functions |
| 46 | +- Use proper error handling instead of throwing generic errors |
| 47 | +- Write self-documenting code that doesn't need excessive comments |
| 48 | +- Prefer functional programming patterns where appropriate |
| 49 | +- Use advanced TypeScript features (generics, utility types, conditional types) |
| 50 | +- Optimize for readability and maintainability |
| 51 | + |
| 52 | +## File Structure |
| 53 | + |
| 54 | +- Keep imports organized according to prettier rules |
| 55 | +- Use meaningful variable and function names |
| 56 | +- Add proper JSDoc comments for public APIs |
| 57 | +- Prefer composition over inheritance |
| 58 | +- Use readonly arrays and objects where appropriate |
0 commit comments