Skip to content

noVueOptionsApi (JavaScript)

Language JavaScript (and super languages)
  • Rule available since: v2.3.12
  • Diagnostic Category: lint/style/noVueOptionsApi
  • This rule isn’t recommended, so you need to enable it.
  • This rule doesn’t have a fix.
  • The default severity of this rule is information.
  • This rule belongs to the following domains:
biome.json
{
"linter": {
"rules": {
"style": {
"noVueOptionsApi": "error"
}
}
}
}

Disallow the use of Vue Options API.

Vue 3.6’s Vapor Mode does not support the Options API. Components must use the Composition API (<script setup> or defineComponent with function signature) instead.

This rule helps prepare codebases for Vapor Mode by detecting Options API patterns that are incompatible with the new rendering mode.

<script>
export default {
data() {
return { count: 0 }
}
}
</script>
code-block.vue:2:16 lint/style/noVueOptionsApi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Using the Options API is not allowed.

1 │ <script>
> 2 │ export default {
│ ^
> 3 │ data() {
> 4 │ return { count: 0 }
> 5 │ }
> 6 │ }
│ ^
7 │ </script>
8 │

ℹ Although the Options API is still supported by Vue, using the Composition API is recommended, and makes it possible to use Vue's Vapor mode for better performance.

ℹ Use <script setup> or defineComponent with a function signature to use the Composition API instead.

<script>
export default {
methods: {
increment() {
this.count++
}
}
}
</script>
code-block.vue:2:16 lint/style/noVueOptionsApi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Using the Options API is not allowed.

1 │ <script>
> 2 │ export default {
│ ^
> 3 │ methods: {
> 4 │ increment() {
> 5 │ this.count++
> 6 │ }
> 7 │ }
> 8 │ }
│ ^
9 │ </script>
10 │

ℹ Although the Options API is still supported by Vue, using the Composition API is recommended, and makes it possible to use Vue's Vapor mode for better performance.

ℹ Use <script setup> or defineComponent with a function signature to use the Composition API instead.

<script>
export default {
computed: {
doubled() {
return this.count * 2
}
}
}
</script>
code-block.vue:2:16 lint/style/noVueOptionsApi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Using the Options API is not allowed.

1 │ <script>
> 2 │ export default {
│ ^
> 3 │ computed: {
> 4 │ doubled() {
> 5 │ return this.count * 2
> 6 │ }
> 7 │ }
> 8 │ }
│ ^
9 │ </script>
10 │

ℹ Although the Options API is still supported by Vue, using the Composition API is recommended, and makes it possible to use Vue's Vapor mode for better performance.

ℹ Use <script setup> or defineComponent with a function signature to use the Composition API instead.

<script>
export default {
mounted() {
console.log('Component mounted')
}
}
</script>
code-block.vue:2:16 lint/style/noVueOptionsApi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Using the Options API is not allowed.

1 │ <script>
> 2 │ export default {
│ ^
> 3 │ mounted() {
> 4 │ console.log('Component mounted')
> 5 │ }
> 6 │ }
│ ^
7 │ </script>
8 │

ℹ Although the Options API is still supported by Vue, using the Composition API is recommended, and makes it possible to use Vue's Vapor mode for better performance.

ℹ Use <script setup> or defineComponent with a function signature to use the Composition API instead.

import { defineComponent } from 'vue'
defineComponent({
name: 'MyComponent',
data() {
return { count: 0 }
}
})
code-block.js:3:17 lint/style/noVueOptionsApi ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

ℹ Using the Options API is not allowed.

1 │ import { defineComponent } from 'vue'
2 │
> 3 │ defineComponent({
│ ^
> 4 │ name: 'MyComponent',
> 5 │ data() {
> 6 │ return { count: 0 }
> 7 │ }
> 8 │ })
│ ^
9 │

ℹ Although the Options API is still supported by Vue, using the Composition API is recommended, and makes it possible to use Vue's Vapor mode for better performance.

ℹ Use <script setup> or defineComponent with a function signature to use the Composition API instead.

<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
<script setup>
import { ref, computed } from 'vue'
const count = ref(0)
const doubled = computed(() => count.value * 2)
</script>
<script setup>
import { onMounted } from 'vue'
onMounted(() => {
console.log('Component mounted')
})
</script>
  • useVueVapor: Enforces the use of Vapor mode in Vue components