\n \n
\n\n```\n\n## Store Implementation\n\n### Basic Store Structure\n\n```typescript\nimport { defineStore } from 'pinia'\nimport { Decimal } from 'break_infinity.js'\nimport type { IResourceState } from '@/types'\n\nexport const useResourceStore = defineStore('resources', {\n state: (): IResourceState => ({\n gold: new Decimal(0),\n gems: new Decimal(0),\n }),\n\n getters: {\n formattedGold(): string {\n return this.gold.toExponential(2)\n },\n },\n\n actions: {\n addGold(amount: Decimal): void {\n this.gold = this.gold.plus(amount)\n },\n },\n})\n```\n\n## Type Definitions\n\n### Interface Examples\n\n```typescript\ninterface IResourceState {\n gold: Decimal\n gems: Decimal\n}\n\ninterface IUpgrade {\n id: string\n cost: Decimal\n multiplier: Decimal\n level: number\n}\n```\n\n## Error Handling\n\n### Store Actions\n\n```typescript\nasync function fetchUserData(): Promise\n
\n\n \n \n Resources\n
\n \n\n```\n\n## Testing Examples\n\n### Store Tests\n\n```typescript\nimport { describe, it, expect } from 'vitest'\nimport { useResourceStore } from '@/stores/resource-store'\nimport { Decimal } from 'break_infinity.js'\n\ndescribe('Resource Store', () => {\n it('should add resources correctly', () => {\n const store = useResourceStore()\n store.addGold(new Decimal(10))\n expect(store.gold.equals(new Decimal(10))).toBe(true)\n })\n})\n```\n\n## Naming Conventions\n\n### Examples\n\n```typescript\n// Components (PascalCase)\nResourceDisplay.vue\nBaseButton.vue\n\n// Files (kebab-case)\nresource-store.ts\nformat-utils.ts\n\n// Stores (use[StoreName])\nuseResourceStore\nuseGameStore\n\n// Interfaces (IPascalCase)\ninterface IResourceData\ninterface IUpgradeConfig\n\n// Types (TPascalCase)\ntype TResourceKey = 'gold' | 'gems'\n\n// Constants (UPPER_SNAKE_CASE)\nconst MAX_LEVEL = 100\n```\n\n## Git Commit Standards\n\n### Examples\n\n```bash\n# Feature\ngit commit -m \"feat: add resource production system\"\n\n# Bug fix\ngit commit -m \"fix: correct calculation overflow\"\n\n# Refactor\ngit commit -m \"refactor: optimize store performance\"\n\n# Documentation\ngit commit -m \"docs: update README with new features\"\n```\n\n## Branch Naming\n\n```bash\nfeature/resource-system\nbugfix/calculation-overflow\nhotfix/critical-game-loop\n```\n\nRemember:\n\n- Keep components focused and single-responsibility\n- Use TypeScript strict mode\n- Prefer early returns\n- Document complex logic\n- Write tests for critical features\n- Follow mobile-first approach\n- Use semantic HTML\n- Keep commits atomic and meaningful\n\n```\n\n```\n","breadcrumb":{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://www.notsobrightideas.com/"},{"@type":"ListItem","position":2,"name":"Cursor Rules","item":"https://www.notsobrightideas.com//cursorrules"},{"@type":"ListItem","position":3,"name":"Rule for idle-complaints","item":"https://www.notsobrightideas.com//cursorrules/TWV6ZW1hbjEvaWRsZS1jb21wbGFpbnRzLy5jdXJzb3JydWxlcw"}]},"about":[{"@type":"SoftwareSourceCode","name":"idle-complaints","codeRepository":"https://github.com/Mezeman1/idle-complaints/blob/54a875320c747c3d4a116753041c69fdf4fc06ca/.cursorrules","programmingLanguage":"TypeScript"},{"@type":"SoftwareSourceCode","name":"idle-complaints","codeRepository":"https://github.com/Mezeman1/idle-complaints/blob/54a875320c747c3d4a116753041c69fdf4fc06ca/.cursorrules","programmingLanguage":"TypeScript"}]}
# Vue 3 + TypeScript Project Standards
## Project Structure
```typescript
src/
├── stores/ # Pinia stores (split by feature)
│ ├── resource-store.ts
│ ├── upgrade-store.ts
│ └── game-store.ts
├── components/ # Reusable Vue components
│ ├── base/
│ └── features/
├── views/ # Page-level components
├── assets/ # Static assets
├── types/ # TypeScript definitions
└── utils/ # Helper functions
```
## Component Standards
### Script Setup Format
```vue
<script setup lang="ts">
// 1. Vue imports
import { ref, computed } from 'vue'
// 2. External libraries
import Decimal from 'break_infinity.js'
// 3. Store imports
import { useResourceStore } from '@/stores/resource-store'
import { storeToRefs } from 'pinia'
// 4. Component imports
import BaseButton from '@/components/base/BaseButton.vue'
// 5. Type imports
import type { IResourceData } from '@/types'
// 6. Utils & Assets
import { formatNumber } from '@/utils/formatters'
// Component logic here...
</script>
<template>
<div class="flex flex-col space-y-4">
<!-- Use semantic HTML and Tailwind exclusively -->
</div>
</template>
```
## Store Implementation
### Basic Store Structure
```typescript
import { defineStore } from 'pinia'
import { Decimal } from 'break_infinity.js'
import type { IResourceState } from '@/types'
export const useResourceStore = defineStore('resources', {
state: (): IResourceState => ({
gold: new Decimal(0),
gems: new Decimal(0),
}),
getters: {
formattedGold(): string {
return this.gold.toExponential(2)
},
},
actions: {
addGold(amount: Decimal): void {
this.gold = this.gold.plus(amount)
},
},
})
```
## Type Definitions
### Interface Examples
```typescript
interface IResourceState {
gold: Decimal
gems: Decimal
}
interface IUpgrade {
id: string
cost: Decimal
multiplier: Decimal
level: number
}
```
## Error Handling
### Store Actions
```typescript
async function fetchUserData(): Promise<void> {
try {
const data = await api.getData()
this.userData = data
} catch (error) {
console.error('Failed to fetch user data:', error)
throw new Error('Unable to load user data')
}
}
```
## Styling Guidelines
### Tailwind Usage
```vue
<template>
<!-- ✅ Correct usage -->
<div class="flex flex-col p-4 dark:bg-gray-800">
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">
Resources
</h1>
</div>
<!-- ❌ Avoid -->
<div style="display: flex"> <!-- No inline styles -->
</template>
```
## Testing Examples
### Store Tests
```typescript
import { describe, it, expect } from 'vitest'
import { useResourceStore } from '@/stores/resource-store'
import { Decimal } from 'break_infinity.js'
describe('Resource Store', () => {
it('should add resources correctly', () => {
const store = useResourceStore()
store.addGold(new Decimal(10))
expect(store.gold.equals(new Decimal(10))).toBe(true)
})
})
```
## Naming Conventions
### Examples
```typescript
// Components (PascalCase)
ResourceDisplay.vue
BaseButton.vue
// Files (kebab-case)
resource-store.ts
format-utils.ts
// Stores (use[StoreName])
useResourceStore
useGameStore
// Interfaces (IPascalCase)
interface IResourceData
interface IUpgradeConfig
// Types (TPascalCase)
type TResourceKey = 'gold' | 'gems'
// Constants (UPPER_SNAKE_CASE)
const MAX_LEVEL = 100
```
## Git Commit Standards
### Examples
```bash
# Feature
git commit -m "feat: add resource production system"
# Bug fix
git commit -m "fix: correct calculation overflow"
# Refactor
git commit -m "refactor: optimize store performance"
# Documentation
git commit -m "docs: update README with new features"
```
## Branch Naming
```bash
feature/resource-system
bugfix/calculation-overflow
hotfix/critical-game-loop
```
Remember:
- Keep components focused and single-responsibility
- Use TypeScript strict mode
- Prefer early returns
- Document complex logic
- Write tests for critical features
- Follow mobile-first approach
- Use semantic HTML
- Keep commits atomic and meaningful
```
```
css
golang
html
javascript
nestjs
tailwindcss
typescript
vite
+3 more
First Time Repository
TypeScript
Languages:
CSS: 1.2KB
HTML: 0.5KB
JavaScript: 1.8KB
TypeScript: 66.5KB
Vue: 56.6KB
Created: 1/16/2025
Updated: 1/16/2025