RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/crunl/Xingyu-Frontend

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 blocks

Repository

0

— · pushed 377 days ago

Last changed

3 days ago

First indexed 3 days ago.
crunl/Xingyu-Frontend/.cursor/rules/componenting.mdcRawGitHub
1---
2description:
3globs:
4alwaysApply: false
5---
6# 组件开发规范
7 
8## 1. 组件结构
9```typescript
10// 组件导入顺序
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';
16 
17// 类型定义
18interface Props {
19 title: string;
20 onConfirm?: () => void;
21}
22 
23// 组件实现
24const ComponentName: React.FC<Props> = ({ title, onConfirm }) => {
25 // 状态管理
26 const [loading, setLoading] = useState(false);
27 
28 // Redux
29 const user = useSelector(state => state.auth.user);
30 const dispatch = useDispatch();
31 
32 
33 // 事件处理
34 const handleConfirm = () => {
35 onConfirm?.();
36 };
37 
38 // 副作用
39 useEffect(() => {
40 // 初始化逻辑
41 }, []);
42 
43 
44 // 渲染
45 return (
46 <Card title={title}>
47 <Button onClick={handleConfirm}>确认</Button>
48 </Card>
49 );
50};
51 
52export default ComponentName;
53```
54 
55### 2. 组件命名规范
56- **组件名称:PascalCase**
57```typescript
58<UserProfile />
59<GlobalHeader />
60<ThemeDrawer />
61```
62- **Iconify 图标:kebab-case**
63```typescript
64<IconMdiHome />
65<IconAntDesignUserOutlined />
66```
67 
68### 3. Props 和 State 设计
69- 使用 TypeScript 接口定义 Props
70- 为可选属性使用 `?` 标记
71- 使用泛型提高复用性
72```typescript
73interface TableProps<T = any> {
74 data: T[];
75 loading?: boolean;
76 onRowClick?: (record: T) => void;
77}
78```
79 

Sections

  • 组件开发规范
  • 1. 组件结构
  • 2. 组件命名规范
  • 3. Props 和 State 设计

Stack — with the evidence

typescript

(1.00)

vite

(1.00)

eslint

(1.00)

node

(0.70)

react

(0.70)

javascript

(0.60)

monorepo

(0.60)

pnpm

(0.60)

github-actions

(0.60)

vercel

(0.60)

Glob targeting

  • [object Object]

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
crunl
Language
—
License
—
Archived
no

All configs in this repo

Also in crunl/Xingyu-Frontend

Diff this repo’s formats

One 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?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
crunl/Xingyu-Frontend.cursor/rules/api.mdc · 0Cursor rulestypescriptvite+8api45/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/comments.mdc · 0Cursor rulestypescriptvite+8securityapidocs46/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/naming.mdc · 0Cursor rulestypescriptvite+8archtypesapiui58/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/project.mdc · 0Cursor rulestypescriptvite+8no sections50/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/reduxing.mdc · 0Cursor rulestypescriptvite+8no sections45/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/routing.mdc · 0Cursor rulestypescriptvite+8no sections53/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/styling.mdc · 0Cursor rulestypescriptvite+8archui54/1003 days ago
crunl/Xingyu-Frontend.cursor/rules/typescript.mdc · 0Cursor rulestypescriptvite+8typesdocs42/1003 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.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack