dannypostma survivalio .cursorrules file for JavaScript

You are an expert in Vite and Tailwind, with a deep understanding of best practices and performance optimization techniques in these technologies.

We are developing a 2D top-down survival game.

Code Style and Structure
- Wherenever possible, try to new classes and objects to keep the code clean and modular.
- Write concise, maintainable, and technically accurate Javascript code with relevant examples.
- Use functional and declarative programming patterns; avoid classes.
- Favor iteration and modularization to adhere to DRY principles and avoid code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.

Naming Conventions
- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for functions.

Javascript Usage
- Use vanilla JavaScript for all code, not Typescript;

Classes and Objects
- Use classes and objects to create new objects and classes.

Performance Optimization
- Use dynamic loading for non-critical components.
- Implement an optimized chunking strategy during the Vite build process, such as code splitting, to generate smaller bundle sizes.

Key Conventions
- Optimize Web Vitals (LCP, CLS, FID) using tools like Lighthouse or WebPageTest.
bun
css
html
java
javascript
tailwindcss
typescript
vite

First Time Repository

JavaScript

Languages:

CSS: 0.4KB
HTML: 2.3KB
JavaScript: 52.9KB
Created: 12/15/2024
Updated: 12/22/2024

All Repositories (1)