Cursor rule
.cursor/rules/componenting.mdc[object Object]
Cursor rules
Quality
45/100
Scores the file, not the repository.Length
174 words
4 headings · 4 code blocksRepository
0
— · pushed 377 days agoLast changed
3 days ago
First indexed 3 days ago.123456# 组件开发规范78## 1. 组件结构9```typescript10// 组件导入顺序11import React, { useState, useEffect } from 'react';12import { Button, Card } from 'antd';13import { useDispatch, useSelector } from 'react-redux';14import { customHook, utilFunction } from '@/utils';15import styles from './index.module.scss';1617// 类型定义18interface Props {19 title: string;20 onConfirm?: () => void;21}2223// 组件实现24const ComponentName: React.FC<Props> = ({ title, onConfirm }) => {25 // 状态管理26 const [loading, setLoading] = useState(false);2728 // Redux29 const user = useSelector(state => state.auth.user);30 const dispatch = useDispatch();313233 // 事件处理34 const handleConfirm = () => {35 onConfirm?.();36 };3738 // 副作用39 useEffect(() => {40 // 初始化逻辑41 }, []);424344 // 渲染45 return (46 <Card title={title}>47 <Button onClick={handleConfirm}>确认</Button>48 </Card>49 );50};5152export default ComponentName;53```5455### 2. 组件命名规范56- **组件名称:PascalCase**57```typescript58<UserProfile />59<GlobalHeader />60<ThemeDrawer />61```62- **Iconify 图标:kebab-case**63```typescript64<IconMdiHome />65<IconAntDesignUserOutlined />66```6768### 3. Props 和 State 设计69- 使用 TypeScript 接口定义 Props70- 为可选属性使用 `?` 标记71- 使用泛型提高复用性72```typescript73interface TableProps<T = any> {74 data: T[];75 loading?: boolean;76 onRowClick?: (record: T) => void;77}78```79
Also in crunl/Xingyu-Frontend
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 |
|---|---|---|---|---|---|
| crunl/Xingyu-Frontend.cursor/rules/api.mdc · 0 | Cursor rules | api | 45/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/comments.mdc · 0 | Cursor rules | securityapidocs | 46/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/naming.mdc · 0 | Cursor rules | archtypesapiui | 58/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/project.mdc · 0 | Cursor rules | no sections | 50/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/reduxing.mdc · 0 | Cursor rules | no sections | 45/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/routing.mdc · 0 | Cursor rules | no sections | 53/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/styling.mdc · 0 | Cursor rules | archui | 54/100 | 3 days ago | |
| crunl/Xingyu-Frontend.cursor/rules/typescript.mdc · 0 | Cursor rules | typesdocs | 42/100 | 3 days ago |
Diff against .cursor/rules/api.mdc Diff against .cursor/rules/comments.mdc Diff against .cursor/rules/naming.mdc Diff against .cursor/rules/project.mdc Diff against .cursor/rules/reduxing.mdc Diff against .cursor/rules/routing.mdc Diff against .cursor/rules/styling.mdc Diff against .cursor/rules/typescript.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
