Skip to content

Style Guide

Use Composition API and TypeScript

We write our Vue.js components using the Composition API + TypeScript.

<script setup lang="ts">
  const { data } = useMyComposable();
</script>

Using v-html

We have the vue/no-v-html ESLint rule enabled. It’s advised to avoid using the v-html directive, however, if it is absolutely necessary, then feel free to disable the rule using the eslint-disable-next-line vue/no-v-html comment.

<!-- eslint-disable-next-line vue/no-v-html -->
<div v-html="safeHtml"></div>

Checking if a property exists

OK

const hasProp = property in object;

Avoid

const hasProp = object.hasOwnProperty("property");