.cursorrules (deprecated)
.cursorrules.cursorrulesroot
Quality
81/100
Scores the file, not the repository.Length
932 words
21 headings · 12 code blocksRepository
5
— · pushed 221 days agoLast changed
3 days ago
First indexed 3 days ago.1# Rules23## 1. Material UI Imports (CRITICAL - 500KB+ Bundle Impact)45⚠️ Pre-push hook will REJECT incorrect imports67### ✅ CORRECT (Tree-shakeable):8```typescript9// Components - one per line10import Button from '@mui/material/Button';11import Box from '@mui/material/Box';1213// Icons - one per line14import SearchIcon from '@mui/icons-material/Search';15import EditIcon from '@mui/icons-material/Edit';1617// Hooks from /styles18import { useTheme, styled } from '@mui/material/styles';1920// Types use 'import type'21import type { PaletteMode } from '@mui/material';22import type { SvgIconProps } from '@mui/material/SvgIcon';23```2425### ❌ WRONG (Bloats bundle):26```typescript27import { Button, Box } from '@mui/material'; // NO!28import { Search, Edit } from '@mui/icons-material'; // NO!29import { PaletteMode } from '@mui/material'; // NO! Use 'import type'30```3132**Common Components Quick Reference**:33```typescript34// Layout: Box, Container, Grid, Stack35// Inputs: Button, TextField, Select, MenuItem, Checkbox, Switch36// Feedback: Alert, Dialog, Snackbar, CircularProgress37// Data: Table, TableBody, TableCell, TableHead, TableRow, Chip, Tooltip38// Navigation: Tabs, Tab, Drawer39// Utils: IconButton, Divider, Paper, Typography40```4142**Validation**: Run `./scripts/check-mui-imports.sh` or `yarn build:analyze`4344## 2. Component File Organization (MANDATORY)4546Every component MUST follow the `index.tsx` pattern:4748```49ComponentName/50├── index.tsx # Main component (REQUIRED)51├── SubComponent.tsx # Sub-components in same dir52├── helpers.ts # Component-specific utilities53├── types.ts # Component-specific types54└── styles.css # Component-specific styles55```5657**Rules**:58- ✅ Every component dir has `index.tsx` (main entry point)59- ✅ Sub-components stay in parent directory, named `PascalCase.tsx`60- ✅ Helper files: `helpers.ts`, `types.ts`, `constants.ts`, `utils.ts`61- ✅ Shared/reusable → `shared/` or `common/` directory62- ❌ NO components at root level without directory63- ❌ NO redundant naming: `MyComponent/MyComponent.tsx` → use `MyComponent/index.tsx`6465**Examples**:66```67theme-toggle/68└── index.tsx6970admin-console/71├── index.tsx72├── layout/index.tsx73├── maps-page/index.tsx74└── accounts-page/index.tsx7576action-widget/pane/77├── topic-style-editor/78│ ├── index.tsx79│ ├── IconCollection.tsx80│ └── ColorPicker.tsx81└── shared/82 ├── StyledTabs.tsx83 └── StyledEditorContainer.tsx84```8586**Clean Imports Result**:87```typescript88import ThemeToggle from '../common/theme-toggle'; // ✅ Clean89import MapsPage from '../admin-console/maps-page'; // ✅ Clean90// vs91import ThemeToggle from '../common/theme-toggle/ThemeToggle'; // ❌ Redundant92```9394## 3. Code Standards9596- **Language**: TypeScript preferred over JavaScript97- **React**: Functional components + hooks (no class components)98- **Naming**:99 - Components: `PascalCase` (`MyComponent.tsx`)100 - Utilities: `camelCase` (`myUtility.ts`)101 - Constants: `UPPER_SNAKE_CASE` (`MAX_VALUE`)102- **Git**:103 - Clear commit messages104 - No force push to `main`105 - Branch names: `feature/name`, `fix/name`106107## 4. Performance108109- Check for duplicate dependencies before adding packages110- Use dynamic imports for code splitting when appropriate111- Run `yarn build:analyze` to verify bundle sizes112113## 5. Testing114115- Unit tests: `*.test.ts` or `*.test.tsx`116- Integration tests: Cypress117- Aim for good coverage on critical paths118119## 6. TypeScript Type Safety (CRITICAL)120121**MANDATORY**: All TypeScript code must be properly typed. NO exceptions.122123### Prohibited:124- ❌ **NEVER use `any` type** - Always use specific types125- ❌ **NEVER use `@ts-ignore` or `@ts-expect-error`** without discussion126- ❌ **NEVER leave implicit `any`** from function parameters or variables127128### Required Practices:129130#### 1. Import Proper Types:131```typescript132// ✅ CORRECT - Import types from mindplot133import { Topic, Designer } from '@wisemapping/mindplot';134135// ❌ WRONG - Using 'any'136const topic: any = ...;137```138139#### 2. Handle Nullable Types Correctly:140```typescript141// ✅ CORRECT - Properly handle Topic | null142const getTopicDepth = (topic: Topic): number => {143 let current: Topic | null = topic;144 while (current && current.getParent() !== null) {145 current = current.getParent(); // Returns Topic | null146 }147};148149// ❌ WRONG - Type mismatch150const getTopicDepth = (topic: Topic): number => {151 let current = topic; // TypeScript infers Topic152 current = current.getParent(); // ERROR: Topic | null not assignable to Topic153};154```155156#### 3. Use Unknown for Truly Unknown Types:157```typescript158// ✅ If you truly don't know the type159const data: unknown = JSON.parse(str);160if (typeof data === 'object' && data !== null) {161 // Type guard before use162}163164// ❌ WRONG165const data: any = JSON.parse(str);166```167168## 7. Linting and Code Quality (CRITICAL)169170**MANDATORY**: AI MUST check linter errors after EVERY file creation or modification.171172### When to Run Linter (REQUIRED):173- ✅ **IMMEDIATELY after creating a new file**174- ✅ **IMMEDIATELY after modifying an existing file**175- ✅ **Before declaring a task complete**176- ✅ **After any code generation or refactoring**177178### Linting Workflow (ENFORCED):179```180For EACH file created/modified:1811. Write/modify the code1822. IMMEDIATELY run read_lints([specific_file_path])1833. Fix ALL errors found1844. Re-run read_lints to verify1855. Only then move to next file186187At task completion:1881. Run read_lints on ALL modified files together1892. Fix any remaining issues1903. Final verification1914. Task complete192```193194### How to Check Lints:195```typescript196// ✅ CORRECT - Check specific files you modified197read_lints([198 "packages/editor/src/components/new-component/index.tsx",199 "packages/editor/src/components/new-component/styled.ts"200])201202// ❌ WRONG - Checking entire codebase (too noisy)203read_lints() // or read_lints([])204```205206### Common ESLint Rules to Follow:207- `@typescript-eslint/no-explicit-any` - NO `any` types208- `@typescript-eslint/no-unused-vars` - Remove unused imports/variables209- `@typescript-eslint/explicit-function-return-type` - Type function returns when needed210- Proper null/undefined handling211- Material UI imports must follow tree-shakeable pattern (see rule #2)212213### AI Assistant Workflow (MANDATORY):214```2151. Create/modify TypeScript file2162. Add proper type imports (Topic, Designer, etc.)2173. Use correct types for all variables and parameters2184. Handle nullable types with | null or | undefined2195. RUN read_lints([file_path]) - DO NOT SKIP THIS2206. Fix all errors found2217. Verify with read_lints again2228. Move to next file/task223```224225### Priority:226- **ZERO tolerance for linting errors** in completed tasks227- Fix ALL errors before declaring task complete228- If a linting rule seems incorrect, discuss with user before bypassing229- Never commit code with linting errors230
Also in bashdeban/fastmind
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| SkeneTechnologies/skene-cookbook.cursorrules · 51 | .cursorrules | setuptestlint-formatstyle+11 | 96/100 | 2 days ago | |
| HerringtonDarkholme/megarepo.cursorrules · 17 | .cursorrules | setupbuildtestlint-format+13 | 96/100 | 3 days ago | |
| survivorforge/cursor-rulesrules/devops-docker/.cursorrules · 16 | .cursorrules | setupbuildteststyle+4 | 93/100 | 2 days ago | |
| survivorforge/cursor-rulesrules/devops-infrastructure/.cursorrules · 16 | .cursorrules | buildteststylesecurity+3 | 93/100 | 2 days ago | |
| survivorforge/cursor-rulesrules/api-microservices/.cursorrules · 16 | .cursorrules | buildteststylearch+5 | 92/100 | 2 days ago | |
| fall-out-bug/sdp_lab.cursorrules · 0 | .cursorrules | setupbuildtestlint-format+3 | 86/100 | 3 days ago | |
| storybookjs/storybook.cursorrules · 91k | .cursorrules | teststylearchdo-not+1 | 78/100 | 3 days ago | |
| forem/forem.cursorrules · 23k | .cursorrules | teststyletypesdatabase+4 | 71/100 | 3 days ago |
