.cursorrules 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Project Coding Standards
  2. Follow these coding standards strictly for all code in this project.
  3. ## 1. Variable Naming
  4. Meaningful variable names, file names, folder names. Use abbreviations for words over ten characters. Abbreviations must be over three characters.
  5. - ✅ `update-btn` (refresh button), `device-list`, `user-profile-settings` (profile = abbreviation)
  6. - ❌ `btn` (too vague), `d1` (meaningless), `temp` (unclear), `us` (abbreviation too short)
  7. ## 2. Word Separation: Kebab-Case
  8. Use hyphens (`-`) for multi-word names.
  9. ## 3. Comments: One Block, One Comment, English Only
  10. ## 4. No Try-Catch
  11. Never use try-catch. Let errors crash.
  12. ## 5. GUI File Structure: Separate JSX, JS, SCSS
  13. GUI components must split into three files:
  14. - `.jsx`: Layout only (no logic, no styles)
  15. - `.js`: Logic only (functions, state, business logic)
  16. - `.scss`: Styles only (no logic, no JSX)
  17. **Never write logic or inline styles in `.jsx` files.**
  18. ## 6. Code Simplicity: Minimal Code
  19. Use the least code to implement functionality.
  20. ## 7. No Console.log
  21. Do not add any `console.log` statements in production code.
  22. ## 8. Avoid Creating Script Files
  23. Do not create script files unnecessarily. If you can call PowerShell directly, use PowerShell instead of creating a separate script file.
  24. ## 9. Ask Before Creating New Files
  25. If you need to create any new files, you must ask first.
  26. ## 10. Prefer Switch Statements Over If-Else Chains
  27. Use `switch` statements instead of multiple `if-else` chains when checking the same variable against multiple values.