Vize

script/valid-define-options

Enforce valid defineOptions() usage (single object arg, no props/emits/expose/slots).

Default severity Presets Automatic fix Options
error essential, happy-path, ecosystem, nuxt, opinionated No None

Applies to: JS/TS scripts in Vue SFCs; examples show the relevant Options API or script setup form.

Bad

The first call puts the dedicated props declaration inside defineOptions; the later calls also repeat the macro and include a non-object argument. These illustrate the forbidden shape and repeated-call constraints.

<script setup lang="ts">
defineOptions({ props: ['foo'] })   // use defineProps instead
defineOptions({ name: 'Foo' })
defineOptions({ name: 'Bar' })      // duplicate call
defineOptions('Foo')                // not an object literal
</script>

Good

One defineOptions call receives an object containing only the supported ordinary options name and inheritAttrs.

<script setup lang="ts">
defineOptions({ name: 'Foo', inheritAttrs: false })
</script>

Configuration (Vite+)

import { defineConfig } from "@vizejs/vite-plugin/vite-plus";

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "script/valid-define-options": "error"
    }
  },
});

Then run vp run lint.