Skip to content

Commit 48a6930

Browse files
committed
chore: cursor utilities
1 parent cc6e91e commit 48a6930

File tree

6 files changed

+504
-0
lines changed

6 files changed

+504
-0
lines changed

.cursor/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Cursor rules documentation
2+
3+
This directory contains rules that Cursor uses to enforce consistent formatting and structure in our codebase.
4+
5+
## Rule structure
6+
7+
Rules are defined in `rules.json` and follow this structure:
8+
9+
```json
10+
{
11+
"version": 1,
12+
"rules": {
13+
"category": {
14+
"rule_name": {
15+
"enabled": true,
16+
"pattern": "regex_pattern",
17+
"message": "Error message"
18+
}
19+
}
20+
}
21+
}
22+
```
23+
24+
## Available rules
25+
26+
### Text formatting
27+
28+
- **heading_case**: Enforces sentence case in headings with specific exceptions
29+
- Applies to: `.md`, `.txt`, `.mdx` files
30+
- Exceptions: Technical terms and acronyms
31+
32+
### Jira tickets
33+
34+
- **ticket_title**: Validates Jira ticket title format
35+
- Optional component in brackets
36+
- Max length: 80 characters
37+
- **required_sections**: Ensures required sections are present
38+
- **templates**: Enforces template structure for different ticket types
39+
- **labels**: Validates that only allowed labels are used
40+
- **issue_types**: Ensures correct issue type selection
41+
42+
## Usage
43+
44+
1. Cursor will automatically enforce these rules while editing relevant files
45+
2. Rules can be toggled using the `enabled` flag
46+
3. Custom error messages will be shown when rules are violated
47+
4. Exceptions are handled through the `exceptions` field in relevant rules
48+
49+
## Updating rules
50+
51+
To modify these rules:
52+
53+
1. Edit `rules.json`
54+
2. Follow the existing structure
55+
3. Ensure valid regex patterns where applicable
56+
4. Include clear error messages
57+
5. Test changes before committing

.cursor/config.json

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
{
2+
"text_formatting": {
3+
"headings": {
4+
"case": "sentence",
5+
"files": ["**/*.md", "**/*.txt", "**/*.mdx"],
6+
"message": "Use sentence case (capitalize only the first word and proper nouns/acronyms)",
7+
"inline": true
8+
},
9+
"patterns": ["**/*.md", "**/*.txt", "**/*.mdx"]
10+
},
11+
"validation": {
12+
"jira_tickets": {
13+
"title": {
14+
"pattern": "^\\[?[A-Za-z0-9-]+\\]?\\s.+$",
15+
"max_length": 80,
16+
"message": "Jira ticket title must start with optional component in brackets and not exceed 80 characters"
17+
},
18+
"required_sections": ["Acceptance case", "Overview"],
19+
"labels": {
20+
"a11y": "Accessibility issues",
21+
"API": "Component API changes",
22+
"docs": "Documentation updates",
23+
"engineering-processes": "Engineering workflow improvements",
24+
"feature": "New features",
25+
"hold": "Suspended tickets",
26+
"i18n": "Internationalization work",
27+
"iOS": "iOS-specific issues",
28+
"mobile": "Mobile platform issues",
29+
"necromancy": "Old backlog tickets (>2 years)",
30+
"product-processes": "Product team process improvements",
31+
"refactor": "Code restructuring",
32+
"research": "Investigation tasks",
33+
"RFC": "Request for Comments",
34+
"s2foundations": "S2 Foundations work",
35+
"spectrum2": "Spectrum 2 tasks",
36+
"team-processes": "Team workflow improvements",
37+
"testing": "Test implementation",
38+
"triage": "Needs assessment",
39+
"VoiceOver": "VoiceOver specific issues"
40+
},
41+
"issue_types": ["Bug", "Epic", "Story", "Task"],
42+
"templates": {
43+
"bug": {
44+
"required_fields": [
45+
"Expected behaviour",
46+
"Actual behaviour",
47+
"Reproduction steps",
48+
"Severity"
49+
]
50+
},
51+
"feature": {
52+
"required_fields": ["Overview", "Acceptance criteria"],
53+
"optional_fields": [
54+
"Estimated internal impact",
55+
"Estimated external impact",
56+
"Anticipated reviewing audience",
57+
"Proposed solutions",
58+
"Supplementary documentation"
59+
]
60+
}
61+
}
62+
}
63+
},
64+
"jira_tickets": {
65+
"title_format": {
66+
"pattern": "^\\[?[A-Za-z0-9-]+\\]?\\s.+$",
67+
"max_length": 80
68+
},
69+
"required_sections": ["Acceptance case", "Overview"],
70+
"labels": {
71+
"a11y": "Accessibility issues",
72+
"API": "Component API changes",
73+
"docs": "Documentation updates",
74+
"engineering-processes": "Engineering workflow improvements",
75+
"feature": "New features",
76+
"hold": "Suspended tickets",
77+
"i18n": "Internationalization work",
78+
"iOS": "iOS-specific issues",
79+
"mobile": "Mobile platform issues",
80+
"necromancy": "Old backlog tickets (>2 years)",
81+
"product-processes": "Product team process improvements",
82+
"refactor": "Code restructuring",
83+
"research": "Investigation tasks",
84+
"RFC": "Request for Comments",
85+
"s2foundations": "S2 Foundations work",
86+
"spectrum2": "Spectrum 2 tasks",
87+
"team-processes": "Team workflow improvements",
88+
"testing": "Test implementation",
89+
"triage": "Needs assessment",
90+
"VoiceOver": "VoiceOver specific issues"
91+
},
92+
"issue_types": ["Bug", "Epic", "Story", "Task"],
93+
"templates": {
94+
"bug": {
95+
"required_fields": [
96+
"Expected behaviour",
97+
"Actual behaviour",
98+
"Reproduction steps",
99+
"Severity"
100+
]
101+
},
102+
"feature": {
103+
"required_fields": ["Overview", "Acceptance criteria"],
104+
"optional_fields": [
105+
"Estimated internal impact",
106+
"Estimated external impact",
107+
"Anticipated reviewing audience",
108+
"Proposed solutions",
109+
"Supplementary documentation"
110+
]
111+
}
112+
}
113+
},
114+
"git": {
115+
"branchNameTemplate": "{username}/{type}-{description}{?-{issue}}",
116+
"types": [
117+
"feat",
118+
"fix",
119+
"docs",
120+
"style",
121+
"refactor",
122+
"perf",
123+
"test",
124+
"build",
125+
"ci",
126+
"chore",
127+
"revert"
128+
],
129+
"promptForIssueNumber": true,
130+
"allowEmptyIssueNumber": true,
131+
"transformDescription": "lowercase-dashed"
132+
},
133+
"editor": {
134+
"formatOnSave": true,
135+
"defaultFormatter": "prettier",
136+
"tabSize": 4,
137+
"insertSpaces": true,
138+
"endOfLine": "auto",
139+
"charset": "utf-8"
140+
},
141+
"language": {
142+
"typescript": {
143+
"formatOnSave": true,
144+
"organizeImportsOnSave": true,
145+
"addMissingImports": "prompt",
146+
"defaultFormatter": "eslint"
147+
},
148+
"javascript": {
149+
"formatOnSave": true,
150+
"organizeImportsOnSave": true,
151+
"addMissingImports": "prompt",
152+
"moduleResolution": "auto",
153+
"snippets": {
154+
"newScript": {
155+
"detectModuleFormat": true,
156+
"preferESM": true
157+
}
158+
}
159+
},
160+
"css": {
161+
"formatOnSave": true,
162+
"defaultFormatter": "stylelint"
163+
}
164+
},
165+
"terminal": {
166+
"defaultProfile": "${os.shell}",
167+
"integrated": {
168+
"fontFamily": "${os.monospace}",
169+
"fontSize": 12,
170+
"shell": {
171+
"windows": "powershell.exe",
172+
"linux": "bash",
173+
"osx": "bash"
174+
}
175+
}
176+
},
177+
"search": {
178+
"exclude": {
179+
"**/node_modules": true,
180+
"**/dist": true,
181+
"**/.git": true,
182+
"**/.vs": true,
183+
"**/.idea": true,
184+
"**/*.css.js": true,
185+
"**/*.css.ts": true,
186+
"**/*.d.ts": true,
187+
"**/coverage": true,
188+
"**/.wireit": true,
189+
"**/*.tsbuildinfo": true,
190+
"**/custom-elements.json": true,
191+
"**/test/benchmark/results": true,
192+
"**/storybook-static": true,
193+
"**/*.min.*": true,
194+
"**/*.map": true
195+
},
196+
"useGitIgnore": true,
197+
"followSymlinks": false
198+
}
199+
}

.cursor/rules/branch-naming.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "Branch naming format",
3+
"description": "Suggests the ideal branch naming format for Spectrum Web Components contributions",
4+
"pattern": "^[a-z0-9]+\\/(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)-[a-z0-9-]+(-swc-[0-9]+)?$",
5+
"message": "Consider following the preferred branch naming format: <username>/<type>-<description>[-swc-<issue>]\n\nUsername will be automatically pulled from your git config settings.\n\nGuidelines:\n- Use lowercase letters and numbers only\n- Separate words with dashes (not camelCase)\n- Use conventional commit types:\n • feat: New feature\n • fix: Bug fix\n • docs: Documentation only\n • style: Code style/formatting\n • refactor: Code change that neither fixes a bug nor adds a feature\n • perf: Code change that improves performance\n • test: Adding missing tests or correcting existing tests\n • build: Changes that affect the build system or external dependencies\n • ci: Changes to CI configuration files and scripts\n • chore: Other changes that don't modify src or test files\n • revert: Reverts a previous commit\n- Optional issue number format: -swc-XXX\n\nGood examples:\n- johndoe/feat-add-new-button-swc-123\n- janedoe/fix-dropdown-alignment\n- alice/refactor-component-structure\n- bob/perf-optimize-rendering\n\nAvoid:\n- johnDoe/feat-addNewButton (no camelCase)\n- jane/fix-Dropdown-Bug (no uppercase)\n\nThis is a recommended format to maintain consistency, but not required.",
6+
"severity": "warning",
7+
"scope": "git_branch"
8+
}

0 commit comments

Comments
 (0)