@mallardbay/cursor-rules 1.0.35 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,92 +0,0 @@
1
- ---
2
- description: React Native specific conventions for styling, component structure, and patterns that complement the general UI and TypeScript rules
3
- globs:
4
- alwaysApply: true
5
- ---
6
-
7
- # React Native Development Standards
8
-
9
- These rules extend the general UI, TypeScript, and code quality standards with React Native specific conventions.
10
-
11
- ## Styling
12
-
13
- ### File Ordering for Styles
14
-
15
- StyleSheet definitions must live at the **bottom** of the file, after all component and helper definitions—following the same principle as types. This keeps the scannable, important logic (exports, components, hooks) at the top.
16
-
17
- **File ordering for RN component files:**
18
-
19
- 1. Imports
20
- 2. Constants
21
- 3. Exported components / functions
22
- 4. Helpers and non-exported definitions
23
- 5. Types (when not imported)
24
- 6. StyleSheet definitions (`StyleSheet.create`)
25
-
26
- ### Prefer Hook-Based Styling Over Static StyleSheets
27
-
28
- When styles need access to **theme values, colors, spacing, or any dynamic context**, use a `useStyles` hook pattern instead of a top-level `StyleSheet.create`. This avoids hardcoding values that should come from the theme and prevents painful refactors later.
29
-
30
- - **Use `StyleSheet.create` only for truly static styles** that will never need theme values
31
- - **Use a `useStyles` hook** when styles depend on theme, colors, spacing, or dynamic values
32
- - Even when using `StyleSheet.create`, place it at the bottom of the file
33
-
34
- ```typescript
35
- // Preferred: hook-based styling with theme access
36
- function useStyles() {
37
- const theme = useTheme()
38
-
39
- return useMemo(
40
- () =>
41
- StyleSheet.create({
42
- container: {
43
- padding: theme.space[4],
44
- backgroundColor: theme.colors.background,
45
- },
46
- title: {
47
- fontSize: theme.fontSizes.lg,
48
- color: theme.colors.text,
49
- },
50
- }),
51
- [theme]
52
- )
53
- }
54
- ```
55
-
56
- ```typescript
57
- // Acceptable: static styles that genuinely don't need theme
58
- // BUT must be at the BOTTOM of the file
59
- const styles = StyleSheet.create({
60
- row: {
61
- flexDirection: "row",
62
- alignItems: "center",
63
- },
64
- })
65
- ```
66
-
67
- ### Avoid Hardcoded Style Values
68
-
69
- - Never hardcode colors — use theme colors
70
- - Never hardcode spacing — use theme spacing
71
- - Never hardcode font sizes — use theme typography
72
- - If you find yourself reaching for a hardcoded value in `StyleSheet.create`, that's a signal to switch to `useStyles`
73
-
74
- ## Performance
75
-
76
- ### Lists
77
-
78
- - Use `FlatList` or `SectionList` for long lists — never `ScrollView` with `.map()`
79
- - Always provide a `keyExtractor`
80
- - Use `getItemLayout` when item heights are known for better scroll performance
81
- - Memoize `renderItem` callbacks with `useCallback`
82
-
83
- ### Images
84
-
85
- - Use cached image libraries (e.g., `react-native-fast-image`) over the default `Image` when dealing with remote URLs
86
- - Always specify image dimensions to avoid layout thrashing
87
-
88
- ### Animations
89
-
90
- - Prefer `react-native-reanimated` over `Animated` API for complex animations
91
- - Run animations on the UI thread when possible
92
- - Avoid JS-driven animations for performance-critical interactions
@@ -1,55 +0,0 @@
1
- ---
2
- description: Defines structure, naming, reuse, and dependency guidelines to ensure clean, maintainable, and consistent TypeScript code across the project—favoring pragmatism, proven libraries, and shared conventions.
3
- alwaysApply: false
4
- ---
5
-
6
- # Code Quality Standards
7
-
8
- ## Code Structure
9
-
10
- - Maximum file length: 200 lines
11
- - Maximum function length: 50 lines
12
- - Naming conventions:
13
- - Components: PascalCase
14
- - Functions: camelCase
15
- - Constants: UPPER_SNAKE_CASE
16
- - Types: PascalCase
17
- - Exported functions/components should be defined before non-exported helpers
18
- - Types should be defined at the bottom of files or moved into separate `types` files when reused across files
19
- - Keep React component props near component definitions for readability
20
- - PropTypes should be defined before component definitions
21
- - Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
22
-
23
- ## Code Reuse
24
-
25
- - Use shared libraries to avoid duplication
26
- - Primary libraries to use:
27
- - [@mallardbay/lib-react-components](mdc:package.json)
28
- - [@mallardbay/lib-shared-helpers](mdc:package.json)
29
-
30
- ## Third party libraries
31
-
32
- - Favor battle-tested libraries over custom solutions. If a well-maintained, widely-used library solves the problem cleanly, use it. Reinventing functionality that’s already solid, reliable, and well-documented usually leads to more bugs, more maintenance, and wasted time.
33
- - Prioritize stability and ecosystem fit. Pick libraries that are actively maintained, have strong adoption, and fit well within our existing tech stack. Avoid fringe or unmaintained packages unless there’s a strong reason.
34
- - Suggest existing libraries during code review. If you spot hand-rolled code that could be replaced with a proven library, flag it. Examples:
35
- - Use zod or yup instead of custom input validation
36
- - Use date-fns instead of writing date math from scratch
37
- - Use radash for utility-heavy logic if readability or testability improves
38
- - Use react-hook-form for complex form state handling
39
- - Be pragmatic. Sometimes a simple custom solution is faster and easier than pulling in a heavy dependency—but always weigh short-term gains against long-term cost.
40
- - Make reuse easy. If we do build something custom, design it to be clean, reusable, and well-documented. That way, we’re not creating another wheel, but investing in something worth maintaining.
41
-
42
- ## String Constants
43
-
44
- - Use constants instead of string literals for:
45
- - Copy text (UI content). Most projects have a `copy-constants` file
46
- - Test IDs. Most projects have `TEST_IDS` defined
47
- - Error messages
48
- - URLs
49
- - Source constants from:
50
- - @mallardbay/lib-shared-helpers
51
- - Local constants files
52
-
53
- ## Cursor Rules
54
-
55
- - Suggest cursor rules as needed
@@ -1,46 +0,0 @@
1
- ---
2
- description: Outlines expectations for pull request size, test coverage, documentation, and review process—promoting focused, well-tested, and maintainable contributions that align with team standards and improve review efficiency.
3
- alwaysApply: false
4
- ---
5
-
6
- # Code Review Standards
7
-
8
- ## Pull Request Guidelines
9
-
10
- ### Size Requirements
11
-
12
- - Maximum PR size: 400 lines
13
- - Split large changes into smaller, focused PRs
14
- - Keep changes atomic and focused
15
- - Consider impact on review process
16
-
17
- ## Testing Requirements
18
-
19
- Ensure comprehensive test coverage:
20
-
21
- ### Test Coverage
22
-
23
- - All new code must include tests
24
- - Follow testing standards in [testing.mdc](mdc:.cursor/rules/testing.mdc)
25
- - Include unit tests for new functionality
26
- - Avoid making a ton of changes to existing tests while refactoring
27
-
28
- ### Code Documentation
29
-
30
- - Document complex logic with comments
31
- - Explain non-obvious implementation details
32
- - Document features added and important caveats in README
33
-
34
- ### Review Process
35
-
36
- - Review for code quality
37
- - Check for test coverage
38
- - Verify documentation
39
- - Ensure adherence to project standards
40
-
41
- ## Best Practices
42
-
43
- - Keep PRs focused and manageable
44
- - Include clear PR descriptions
45
- - Reference related issues/tickets
46
- - Respond to review comments promptly
@@ -1,48 +0,0 @@
1
- ---
2
- description: Defines consistent patterns for API and form error handling—focusing on clear user feedback, robust validation, and reliable logging to improve user experience, developer debugging, and overall app resilience.
3
- alwaysApply: false
4
- ---
5
-
6
- # Error Handling Standards
7
-
8
- ## API Error Handling
9
-
10
- Implement comprehensive API error handling
11
-
12
- ### Error Types
13
-
14
- - Handle network errors
15
- - Handle server errors
16
- - Handle validation errors
17
- - Handle Apollo-specific errors
18
-
19
- ### Error Presentation
20
-
21
- - Show error toasts for user feedback
22
- - Use original error messages when appropriate
23
- - Provide clear, actionable error messages
24
- - Log errors for debugging
25
-
26
- ## Form Validation
27
-
28
- Implement robust form validation
29
-
30
- - Validate all user inputs
31
- - Show validation errors clearly
32
- - Handle form submission errors
33
- - Use [@hookform/resolvers](mdc:package.json) for validation
34
-
35
- ### Error Display
36
-
37
- - Show validation errors inline
38
- - Provide clear error messages
39
- - Highlight invalid fields
40
- - Prevent form submission with invalid data
41
-
42
- ## Best Practices
43
-
44
- - Use try-catch blocks appropriately
45
- - Implement proper error boundaries
46
- - Log errors for debugging
47
- - Provide user-friendly error messages
48
- - Handle edge cases gracefully
@@ -1,190 +0,0 @@
1
- ---
2
- description: Core development principles and best practices that always apply—optimized for AI agents to produce clean, maintainable, reviewable code with low cognitive complexity, clear semantics, and incremental changes.
3
- alwaysApply: true
4
- ---
5
-
6
- # General Best Practices
7
-
8
- These principles apply to all code changes and should guide every implementation decision.
9
-
10
- ## Core Principles
11
-
12
- ### DRY (Don't Repeat Yourself)
13
- - Extract common logic into reusable functions, utilities, or shared modules
14
- - Leverage existing patterns and utilities before creating new ones
15
- - When duplicating code, ask: "Can this be abstracted?"
16
- - Prefer composition and shared utilities over copy-paste solutions
17
-
18
- ### Leverage Existing Patterns
19
- - **Always** search the codebase for similar implementations before creating new code
20
- - Follow established patterns, conventions, and architectural decisions
21
- - Use existing utilities, helpers, and shared libraries
22
- - Match the style and structure of related files
23
- - When patterns exist, use them consistently—don't invent new approaches without justification
24
-
25
- ### Incremental Changes
26
- - **Minimize large changes in a single PR or commit**
27
- - Break large features into smaller, testable increments
28
- - Make changes that are easy to review and understand
29
- - Prefer multiple small PRs over one massive change
30
- - Each change should be independently testable and reviewable
31
- - If a change touches many files, consider splitting it into logical phases
32
-
33
- ### Semantic Clarity
34
- - Use **semantic, self-documenting names** for functions, variables, and types
35
- - Function names should clearly describe what they do (e.g., `calculateTotalPrice` not `calc`)
36
- - Variable names should express intent (e.g., `userAccountBalance` not `bal`)
37
- - Terminology should be consistent across the codebase
38
- - Avoid abbreviations unless they're widely understood in the domain
39
- - Names should make code readable without comments
40
-
41
- ### Cognitive Complexity
42
- - **Keep cognitive complexity low**—code should be easy to understand at a glance
43
- - Prefer early returns and guard clauses over deep nesting
44
- - Break complex logic into smaller, well-named functions
45
- - Maximum nesting depth: 3 levels
46
- - Use intermediate variables to clarify intent
47
- - Extract complex conditionals into named boolean functions
48
- - Avoid deeply nested ternaries—use if/else or extract to function
49
-
50
- ### Separation of Concerns
51
- - **Files**: Each file should have a single, clear responsibility
52
- - **Functions**: Each function should do one thing well
53
- - Separate business logic from presentation, data access, and side effects
54
- - Keep UI components focused on rendering and user interaction
55
- - Extract business logic into pure functions or services
56
- - Avoid god objects or functions that do too much
57
-
58
- ## Code Quality Standards
59
-
60
- ### Avoid "AI Slop"
61
- - **Write code that's easy for humans to review**
62
- - Avoid generating large amounts of code without understanding context
63
- - Don't create unnecessary abstractions or over-engineered solutions
64
- - Remove unused code, imports, and dead branches
65
- - Clean up commented-out code and debugging statements
66
- - If an approach doesn't work, **clean up failed attempts** before trying another
67
- - Keep only relevant, working code—remove experimental code that didn't pan out
68
-
69
- ### Testing and Linting
70
- - **Lint and test files related to your changes** before completing work
71
- - Run linters on modified files and fix issues
72
- - Use `yarn lint:quiet` for quick iterations
73
- - Use `yarn lint:quiet:slow` for deeper checks but slower when wrapping up
74
- - **Never disable eslint rules** to make lint errors go away—fix the underlying issues instead
75
- - Do not add `eslint-disable` comments unless there's a legitimate, documented reason
76
- - Do not modify eslint config files to disable rules that are flagging real problems
77
- - If a rule seems incorrect, investigate why it exists and fix the code properly
78
- - Run tests for affected modules, not the entire test suite unnecessarily
79
- - For large changes: **use test sharding**—split tests across multiple runs
80
- - **Do not run all tests in parallel** when dealing with many changes
81
- - Tests should be **clear, fast, and minimize setup duplication**
82
- - Use shared test utilities and fixtures to reduce boilerplate
83
- - Each test should be independent and runnable in isolation
84
-
85
- ### Before Pushing
86
- - **Lint the entire project** before pushing—not just modified files. Use `yarn lint:quiet:slow` for a full deep check. Your changes may introduce lint errors in files you didn't directly edit (e.g. unused exports, circular dependencies, type mismatches)
87
- - **Run related tests** before pushing to confirm nothing is broken. Identify test files related to your changes and run them. If unsure which tests are related, err on the side of running more rather than fewer
88
- - **Fix any failures before pushing**—do not push code that fails lint or tests
89
- - These checks are a hard gate: **no push without a clean lint and passing tests**
90
-
91
- ### Code Organization
92
- - Group related functionality together
93
- - Keep related code close (cohesion)
94
- - Minimize dependencies between modules (loose coupling)
95
- - Use appropriate data structures for the problem
96
- - Prefer composition over inheritance
97
- - Make functions pure when possible (no side effects)
98
- - Handle edge cases explicitly—don't rely on implicit behavior
99
-
100
- ### Type Safety and Clarity
101
- - Use TypeScript types effectively—avoid `any` unless necessary
102
- - Make types explicit and meaningful
103
- - Use const assertions and readonly where appropriate
104
- - Prefer `const` over `let`, avoid `var`
105
- - Use type guards and discriminated unions for type narrowing
106
-
107
- ### Performance Considerations
108
- - Consider performance implications, but **avoid premature optimization**
109
- - Profile before optimizing—optimize bottlenecks, not everything
110
- - Use appropriate algorithms and data structures
111
- - Avoid unnecessary re-renders, re-computations, or API calls
112
- - Cache expensive computations when appropriate
113
-
114
- ## AI Agent Workflow
115
-
116
- ### Before Making Changes
117
- 1. **Create a plan** before making changes directly—outline the approach, identify affected files, and break down the work into steps
118
- 2. **Read existing code** to understand patterns and context
119
- 3. **Search the codebase** for similar implementations
120
- 4. **Check git history** to understand why code exists as it does
121
- 5. **Identify related files** that might be affected
122
- 6. **Ask clarifying questions** if requirements are unclear
123
- 7. **Use MCP servers when available**—leverage Model Context Protocol servers for enhanced capabilities
124
- - **Context7 MCP**: Use the context7 MCP server when available to retrieve up-to-date documentation and code examples for libraries
125
- - If context7 MCP is not available, suggest adding it to improve access to library documentation
126
- - **Suggest useful MCP servers**: When appropriate, suggest popular and useful MCP servers that could enhance development workflow based on the task at hand
127
- - Consider MCP servers for documentation, testing, debugging, and other development tasks
128
-
129
- ### During Implementation
130
- 1. Make **small, incremental changes**
131
- 2. **Test as you go**—verify each change works before moving on
132
- 3. **Lint frequently**—don't accumulate lint errors
133
- - Use `yarn lint:quiet` for quick iterations
134
- - Use `yarn lint:quiet:slow` for deeper checks when wrapping up
135
- 4. **Follow existing patterns**—don't reinvent the wheel
136
- 5. **Use semantic names**—code should be self-documenting
137
- 6. **Keep functions focused**—one responsibility per function
138
- 7. **Extract common logic**—don't duplicate code
139
-
140
- ### After Making Changes
141
- 1. **Clean up failed attempts**—remove experimental code
142
- 2. **Remove unused code**—imports, variables, functions
143
- 3. **Run linters** on modified files
144
- - Use `yarn lint:quiet` for quick iterations
145
- - Use `yarn lint:quiet:slow` for deeper checks when wrapping up
146
- 4. **Run relevant tests**—not the entire suite unless necessary
147
- 5. **Verify the change works** end-to-end
148
- 6. **Check for side effects**—ensure changes don't break unrelated code
149
-
150
- ### Before Pushing
151
- 1. **Lint the entire project** with `yarn lint:quiet:slow`—not just modified files. Fix all failures
152
- 2. **Run related tests** and ensure they pass. If unsure which tests are related, run more rather than fewer
153
- 3. **Do not push** until lint and tests are clean
154
-
155
- ### When Changes Are Large
156
- 1. **Consider splitting** into multiple smaller PRs
157
- 2. **Use test sharding**—run tests in batches, not all at once
158
- 3. **Review incrementally**—make sure each part works before moving on
159
- 4. **Document the approach**—explain why changes are structured this way
160
- 5. **Check impact** on related systems and files
161
-
162
- ## Anti-Patterns to Avoid
163
-
164
- - ❌ Copy-pasting code instead of extracting to a function
165
- - ❌ Creating new patterns when existing ones work
166
- - ❌ Making massive changes in one go
167
- - ❌ Using vague names like `data`, `temp`, `value`, `thing`
168
- - ❌ Deeply nested conditionals and loops
169
- - ❌ Functions that do multiple unrelated things
170
- - ❌ Leaving commented-out code or debugging statements
171
- - ❌ Skipping tests or linting "to save time"
172
- - ❌ Disabling eslint rules instead of fixing the underlying issues
173
- - ❌ Running entire test suite for small changes
174
- - ❌ Leaving experimental code after failed attempts
175
- - ❌ Premature optimization without profiling
176
- - ❌ Using `any` types to avoid type errors
177
- - ❌ Magic numbers or strings without constants
178
-
179
- ## Remember
180
-
181
- **Code is read far more often than it's written.** Write code that:
182
- - Is easy to understand
183
- - Is easy to review
184
- - Is easy to test
185
- - Is easy to modify
186
- - Follows established patterns
187
- - Has clear semantics
188
- - Minimizes cognitive load
189
-
190
- When in doubt, prefer clarity and simplicity over cleverness.
@@ -1,23 +0,0 @@
1
- ---
2
- description: Describes Mallard Bay’s mission to simplify and scale outfitter operations through purpose-built software—emphasizing real-world impact, outfitter collaboration, and a long-term vision to digitize and unify the outdoor experience industry.
3
- globs:
4
- alwaysApply: true
5
- ---
6
-
7
- # Mallard Bay: Outfitter Management System Overview
8
-
9
- Mallard Bay is a specialized platform designed to streamline operations for outfitters—businesses that offer guided outdoor experiences such as hunting, fishing, and eco-tourism. At its core, Mallard Bay operates as an outfitter management system, purpose-built to reduce administrative burden, improve customer experience, and unlock new revenue channels for guides and lodge operators.
10
-
11
- # Built for Outfitters, with Outfitters in Mind
12
-
13
- At Mallard Bay, we’re not just building software — we’re solving real problems for real people in the outfitting industry. Every feature we ship is grounded in one simple principle: if it doesn’t make an outfitter’s life easier or their business better, it doesn’t belong in our product.
14
-
15
- We work closely with outfitters of all sizes to understand their workflows, pain points, and growth challenges. From there, we prioritize meaningful features that drive efficiency, boost bookings, and enhance the guest experience.
16
-
17
- Whether it’s reducing no-shows with smart reminders, saving time through automated group booking tools, or enabling instant rebooking with dynamic availability, we’re laser-focused on delivering value — not fluff.
18
-
19
- We’re building tools that fit into the way outfitters actually work — not the way a generic booking platform thinks they should.
20
-
21
- # Vision
22
-
23
- Mallard Bay aims to be the digital backbone for the outfitting industry—a single source of truth for trip logistics, customer interaction, and business growth. The long-term goal is to transform an analog, fragmented market into a digital-first, scalable ecosystem.
@@ -1,45 +0,0 @@
1
- ---
2
- description: Defines best practices for optimizing React components, rendering efficiency, and dependency management—focusing on minimizing re-renders, reducing bundle size, and enabling smooth user experiences through memoization, lazy loading, and performance-aware development.
3
- alwaysApply: false
4
- ---
5
-
6
- # Performance Standards
7
-
8
- ## React Optimization
9
-
10
- Optimize React components for better performance:
11
-
12
- ### Component Optimization
13
-
14
- - Use `React.memo` for pure components
15
- - Implement `useCallback` for function props
16
- - Use `useMemo` for expensive computations
17
- - Avoid inline function definitions in render
18
-
19
- ## Rendering Optimization
20
-
21
- Prevent unnecessary re-renders:
22
-
23
- - Avoid inline styles in components
24
- - Prevent inline object creation in render
25
- - Use proper key props in lists
26
- - Memoize complex objects and callbacks
27
-
28
- ### Dependencies
29
-
30
- - Prefer existing dependencies over new ones
31
- - Review [package.json](mdc:package.json) before adding new packages
32
- - Consider bundle size impact of new dependencies
33
- - Use tree-shaking friendly imports
34
-
35
- ## Best Practices
36
-
37
- - Implement proper code splitting
38
- - Use lazy loading for routes and large components
39
- - Optimize images and assets
40
- - Monitor performance metrics
41
- - Use React DevTools for performance profiling
42
-
43
- ## File Patterns
44
-
45
- These rules apply to all TypeScript and TSX files in the project.
@@ -1,72 +0,0 @@
1
- ---
2
- description: Outlines practical, value-driven testing guidelines focused on reliability, developer confidence, and speed. Emphasizes high-impact coverage (not overkill), structured test organization, clear scenarios, and reusable mock/test utilities—enabling fast iteration without sacrificing quality.
3
- globs:
4
- alwaysApply: true
5
- ---
6
-
7
- # Testing Standards
8
-
9
- ## Test Coverage and Structure
10
-
11
- We aim for high-impact test coverage, focused on adding value and improving developer confidence and experience. The priority is to cover critical logic, edge cases, and integration points where bugs would hurt the most. Tests should act as a safety net and enable fast, fearless iteration—not as a box-ticking exercise.
12
-
13
- We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully reduce risk or help developers move faster, it’s not worth writing. The goal is smart coverage, not maximum coverage—optimize for reliability, clarity, and development speed without overengineering.
14
-
15
- **Frontend (React, React Native):** Avoid e2e tests for UI. Favor unit tests. **Backend (Node.js):** Prioritize e2e tests.
16
-
17
- ### Coverage Requirements
18
-
19
- - Minimum test coverage: 80%
20
- - Place tests in `_tests_` directory closest to the file being tested
21
- - Use `.spec.ts` or `.spec.tsx` file extensions
22
- - Do NOT Use `.test.ts` or `.test.tsx` file extensions
23
-
24
- ### Test Organization
25
-
26
- - Maximum nesting level: 2
27
- - Use `test` or `it` for test cases
28
- - Keep tests focused and atomic
29
- - Follow AAA pattern (Arrange, Act, Assert)
30
-
31
- ### Required Scenarios
32
-
33
- - Happy path testing
34
- - Error case handling
35
- - Edge case coverage within reason. Optimize for branching logic, and avoid creating nearly identical tests
36
- - Aim for simplicity
37
- - All tests must pass before completion
38
-
39
- ### Test Quality
40
-
41
- - Write clear, descriptive test names
42
- - Test one concept per test case
43
- - Avoid test interdependence
44
- - Use meaningful assertions
45
- - Avoid tests that will make the overall run slower
46
-
47
- ### Component Testing
48
-
49
- - Use `renderWithProviders` for component tests
50
- - Use `renderHookWithProviders` for hook tests
51
- - Avoid mocking dependent components
52
- - Test component behavior, not implementation
53
-
54
- ### Mocking Guidelines
55
-
56
- - Use mock helpers instead of inline mocks
57
- - Follow existing patterns for:
58
- - Entity mocks
59
- - Apollo mocks
60
- - Provider mocks
61
- - Keep mocks simple and maintainable
62
- - **Do not use variable matchers for Apollo mocks**—match exact variables (e.g. avoid `expect.anything()` or `variables: {}`) so tests fail when the component passes incorrect variables to queries or mutations
63
-
64
- ### Test Utilities
65
-
66
- - Leverage testing utilities from [@testing-library/react](mdc:package.json)
67
- - Use [@testing-library/jest-dom](mdc:package.json) for DOM assertions
68
- - Follow established patterns in existing tests
69
-
70
- ## File Patterns
71
-
72
- These rules apply to all test files with `.spec.ts` or `.spec.tsx` extensions.
@@ -1,29 +0,0 @@
1
- ---
2
- alwaysApply: true
3
- ---
4
-
5
- # TypeScript Development Standards
6
-
7
- ## Type Safety
8
-
9
- Enforce comprehensive type safety across the codebase:
10
-
11
- ### Strict Type Checking
12
-
13
- Be as strictly as possible where it delivers clear value—specifically in preventing bugs and improving the developer experience. The goal is to enforce strong types and catch issues early, without introducing excessive friction or overhead. If a strict setting improves safety, maintainability, or clarity, we’ll use it. If it creates noise or slows down iteration without real benefit, we’ll dial it back. This is about pragmatic strictness, not dogmatism.
14
-
15
- ### File Organization
16
-
17
- - Keep exported functions/components before non-exported helpers
18
- - Place most types at the bottom of files or in separate `types` files when shared across files
19
- - Keep React component props near the component definition for readability
20
- - Define PropTypes before component definitions
21
-
22
- ## Best Practices
23
-
24
- - Use TypeScript for all new code
25
- - Leverage TypeScript's type system for better code quality
26
- - Follow React best practices with TypeScript
27
- - Use proper type definitions for props and state
28
- - Utilize TypeScript's utility types when appropriate
29
- - Suggest existing libaries as needed