Skip to content

Commit d166996

Browse files
authored
Merge branch 'MetaMask:main' into main
2 parents 9143a97 + d813dab commit d166996

File tree

6,390 files changed

+710068
-226900
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,390 files changed

+710068
-226900
lines changed

.circleci/config.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.cursor/BUGBOT.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# BUGBOT Rules
2+
3+
## Core Mission
4+
5+
Automated test quality enforcement and bug detection for MetaMask Extension codebase
6+
7+
## Execution Protocol
8+
9+
### 1. General Coding Guidelines
10+
11+
- **ALWAYS** load and reference [coding-guidelines](rules/coding-guidelines/RULE.md)
12+
- Applies to all files (alwaysApply: true)
13+
- Check for TypeScript usage in new code
14+
- Verify functional components and hooks are used in React
15+
- Check for proper component optimization (memoization, useEffect usage)
16+
- Verify object destructuring for props
17+
- Check file organization patterns
18+
- Verify naming conventions (PascalCase for components, camelCase for functions, `use` prefix for hooks, `with` prefix for HOCs)
19+
- Check code reusability (DRY principle)
20+
- Verify documentation requirements (TSDoc for utilities, README for components)
21+
- Ensure tests are written for all components and utilities
22+
- Verify external packages are well-maintained and necessary
23+
24+
Use the rules in the [coding-guidelines](rules/coding-guidelines/RULE.md) to enforce the test quality and bug detection.
25+
26+
### 2. Unit Tests
27+
28+
- **ALWAYS** load and reference [unit testing guidelines](rules/unit-testing-guidelines/RULE.md)
29+
- Verify test file naming pattern: `*.test.{ts,tsx,js,jsx}`
30+
- Check for proper Jest and testing library imports
31+
- Ensure tests are colocated with implementation files
32+
33+
Use the rules in the [unit testing guidelines](rules/unit-testing-guidelines/RULE.md) to enforce the test quality and bug detection.
34+
35+
### 3. E2E Tests
36+
37+
- **ALWAYS** load and reference [e2e-testing-guidelines](rules/e2e-testing-guidelines/RULE.md)
38+
- Verify test file naming pattern: `test/e2e/**/*.spec.{ts,js}`
39+
- Check for proper imports from the E2E framework
40+
- Verify Page Object Model pattern is used
41+
- Ensure tests are written in TypeScript (.spec.ts)
42+
43+
Use the rules in the [e2e-testing-guidelines](rules/e2e-testing-guidelines/RULE.md) to enforce the test quality and bug detection.
44+
45+
### 4. Controller Guidelines
46+
47+
- **ALWAYS** load and reference [controller-guidelines](rules/controller-guidelines/RULE.md)
48+
- Auto-detect controller files based on naming patterns: `*Controller.ts`, `*Controller.js`, `*-controller.ts`, `*-controller.js`
49+
- Only apply when analyzing controller files
50+
- Verify controller inherits from BaseController
51+
- Verify that controller has state
52+
- Check state management patterns (partial state acceptance, default state functions, state metadata)
53+
- Verify constructor uses single options bag pattern
54+
- Check for messenger usage instead of callbacks for inter-controller communication
55+
- Verify selectors are used instead of getter methods for derived state
56+
- Check that action methods model high-level user actions, not low-level setters
57+
- Verify minimal state (no derived values stored)
58+
- Check proper lifecycle management (initialization, cleanup in `destroy()`)
59+
60+
Use the rules in the [controller-guidelines](rules/controller-guidelines/RULE.md) to enforce the test quality and bug detection.
61+
62+
### 5. Front-End Performance Guidelines
63+
64+
#### 5.1 Hooks & Effects Optimization
65+
66+
- **ALWAYS** load and reference [front-end-performance-hooks-effects](rules/front-end-performance-hooks-effects/RULE.md)
67+
- Auto-detect files: `use*.{ts,tsx,js,jsx}`, `*.{tsx,jsx}`
68+
- Check useEffect usage patterns, dependency management (never use JSON.stringify)
69+
- Verify cleanup functions for intervals, subscriptions, and async operations
70+
- Ensure proper hook usage (unconditional calls, refs for persistent values)
71+
72+
Use the rules in the [front-end-performance-hooks-effects](rules/front-end-performance-hooks-effects/RULE.md) to enforce the test quality and bug detection.
73+
74+
#### 5.2 React Compiler & Anti-Patterns
75+
76+
- **ALWAYS** load and reference [front-end-performance-react-compiler](rules/front-end-performance-react-compiler/RULE.md)
77+
- Auto-detect files: `*.{tsx,jsx,ts,js}`
78+
- Verify manual memoization for cross-file dependencies, Redux selectors, and external state
79+
- Keep existing useMemo/useCallback for effect dependencies
80+
- Check proper list keys and avoid over-memoization
81+
82+
Use the rules in the [front-end-performance-react-compiler](rules/front-end-performance-react-compiler/RULE.md) to enforce the test quality and bug detection.
83+
84+
#### 5.3 Rendering Performance
85+
86+
- **ALWAYS** load and reference [front-end-performance-rendering](rules/front-end-performance-rendering/RULE.md)
87+
- Auto-detect files: `*.{tsx,jsx,ts,js}`
88+
- Verify unique keys, virtualization for long lists, and React.memo usage
89+
- Check code splitting (React.lazy/Suspense) and pagination patterns
90+
- Ensure expensive computations use useMemo or Redux selectors
91+
92+
Use the rules in the [front-end-performance-rendering](rules/front-end-performance-rendering/RULE.md) to enforce the test quality and bug detection.
93+
94+
#### 5.4 State Management & Redux
95+
96+
- **ALWAYS** load and reference [front-end-performance-state-management](rules/front-end-performance-state-management/RULE.md)
97+
- Auto-detect files: `*selector*.{ts,js}`, `*reducer*.{ts,js}`, `*ducks*.{ts,js}`, `*slice*.{ts,js}`
98+
- Verify immutable reducers, no side effects, and serializable state
99+
- Check normalized state structure (byId/allIds) and proper selector memoization
100+
- Ensure efficient selector patterns (avoid Object.values() without memoization, combine multiple useSelector calls)
101+
102+
Use the rules in the [front-end-performance-state-management](rules/front-end-performance-state-management/RULE.md) to enforce the test quality and bug detection.

0 commit comments

Comments
 (0)