@mallardbay/cursor-rules 1.0.28 → 1.0.29
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.
- package/.cursor/rules/code-quality.mdc +7 -1
- package/.cursor/rules/testing.mdc +3 -2
- package/.cursor/rules/typescript.mdc +7 -1
- package/.cursor/shared/rules/code-quality.mdc +7 -1
- package/.cursor/shared/rules/testing.mdc +3 -2
- package/.cursor/shared/rules/typescript.mdc +7 -1
- package/package.json +1 -1
|
@@ -14,7 +14,13 @@ alwaysApply: false
|
|
|
14
14
|
- Functions: camelCase
|
|
15
15
|
- Constants: UPPER_SNAKE_CASE
|
|
16
16
|
- Types: PascalCase
|
|
17
|
-
-
|
|
17
|
+
- Follow this ordering within files:
|
|
18
|
+
1. Imports
|
|
19
|
+
2. Constants
|
|
20
|
+
3. Exported functions / components
|
|
21
|
+
4. Helpers and other non-exported definitions
|
|
22
|
+
5. Types (when not imported)
|
|
23
|
+
- Exported members always come before non-exported members
|
|
18
24
|
- PropTypes should be defined before component definitions
|
|
19
25
|
- Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
|
|
20
26
|
|
|
@@ -53,13 +53,14 @@ We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully
|
|
|
53
53
|
|
|
54
54
|
### Mocking Guidelines
|
|
55
55
|
|
|
56
|
-
-
|
|
57
|
-
- Follow existing patterns for:
|
|
56
|
+
- **Always use mock helpers**—never define mocks inline. All mocks should come from dedicated mock helper files following existing patterns for:
|
|
58
57
|
- Entity mocks
|
|
59
58
|
- Apollo mocks
|
|
60
59
|
- Provider mocks
|
|
60
|
+
- **Mock data through Apollo mocks, not module mocks**—use Apollo mock providers to control query/mutation responses instead of mocking modules or components directly
|
|
61
61
|
- Keep mocks simple and maintainable
|
|
62
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
|
+
- **Never mock `@mallardbay/lib-react-components`**—if truly unavoidable, stop and ask for approval first
|
|
63
64
|
|
|
64
65
|
### Test Utilities
|
|
65
66
|
|
|
@@ -14,7 +14,13 @@ Be as strictly as possible where it delivers clear value—specifically in preve
|
|
|
14
14
|
|
|
15
15
|
### File Organization
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- Follow this ordering within files:
|
|
18
|
+
1. Imports
|
|
19
|
+
2. Constants
|
|
20
|
+
3. Exported functions / components
|
|
21
|
+
4. Helpers and other non-exported definitions
|
|
22
|
+
5. Types (when not imported)
|
|
23
|
+
- Exported members always come before non-exported members
|
|
18
24
|
- Define PropTypes before component definitions
|
|
19
25
|
|
|
20
26
|
## Best Practices
|
|
@@ -14,7 +14,13 @@ alwaysApply: false
|
|
|
14
14
|
- Functions: camelCase
|
|
15
15
|
- Constants: UPPER_SNAKE_CASE
|
|
16
16
|
- Types: PascalCase
|
|
17
|
-
-
|
|
17
|
+
- Follow this ordering within files:
|
|
18
|
+
1. Imports
|
|
19
|
+
2. Constants
|
|
20
|
+
3. Exported functions / components
|
|
21
|
+
4. Helpers and other non-exported definitions
|
|
22
|
+
5. Types (when not imported)
|
|
23
|
+
- Exported members always come before non-exported members
|
|
18
24
|
- PropTypes should be defined before component definitions
|
|
19
25
|
- Prefer using alias for importing components. Only use relative for tests or when there's a direct sibling
|
|
20
26
|
|
|
@@ -56,13 +56,14 @@ We do not chase 100% coverage for its own sake. If a test doesn’t meaningfully
|
|
|
56
56
|
|
|
57
57
|
### Mocking Guidelines
|
|
58
58
|
|
|
59
|
-
-
|
|
60
|
-
- Follow existing patterns for:
|
|
59
|
+
- **Always use mock helpers**—never define mocks inline. All mocks should come from dedicated mock helper files following existing patterns for:
|
|
61
60
|
- Entity mocks
|
|
62
61
|
- Apollo mocks
|
|
63
62
|
- Provider mocks
|
|
63
|
+
- **Mock data through Apollo mocks, not module mocks**—use Apollo mock providers to control query/mutation responses instead of mocking modules or components directly
|
|
64
64
|
- Keep mocks simple and maintainable
|
|
65
65
|
- **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
|
|
66
|
+
- **Never mock `@mallardbay/lib-react-components`**—if truly unavoidable, stop and ask for approval first
|
|
66
67
|
|
|
67
68
|
### Test Utilities
|
|
68
69
|
|
|
@@ -14,7 +14,13 @@ Be as strictly as possible where it delivers clear value—specifically in preve
|
|
|
14
14
|
|
|
15
15
|
### File Organization
|
|
16
16
|
|
|
17
|
-
-
|
|
17
|
+
- Follow this ordering within files:
|
|
18
|
+
1. Imports
|
|
19
|
+
2. Constants
|
|
20
|
+
3. Exported functions / components
|
|
21
|
+
4. Helpers and other non-exported definitions
|
|
22
|
+
5. Types (when not imported)
|
|
23
|
+
- Exported members always come before non-exported members
|
|
18
24
|
- Define PropTypes before component definitions
|
|
19
25
|
|
|
20
26
|
## Best Practices
|