Skip to content

Instantly share code, notes, and snippets.

@jukbot
Created May 3, 2025 17:33
Show Gist options
  • Save jukbot/f291138b27384feb3180fdd75c50ae1c to your computer and use it in GitHub Desktop.
Save jukbot/f291138b27384feb3180fdd75c50ae1c to your computer and use it in GitHub Desktop.
Vue3 Rules

This is a set of instructions to follow when generating code for a Vue 3 project.

Vue 3 Composition Api Best Practices

  • Please use the Vue 3 Composition API for all new components and features.
  • Use setup() function for component logic
  • Utilize ref and reactive for reactive state
  • Implement computed properties with computed()
  • Use watch and watchEffect for side effects
  • Implement lifecycle hooks with onMounted, onUpdated, etc.
  • Utilize provide/inject for dependency injection

Folder structure

src/ components/ composables/ views/ router/ store/ assets/ App.vue main.js

Additional instructions

  1. Use TypeScript for type safety
  2. Implement proper props and emits definitions
  3. Utilize Vue 3's Teleport component when needed
  4. Use Suspense for async components
  5. Implement proper error handling
  6. Follow Vue 3 style guide and naming conventions
  7. Use Vite for fast development and building
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment