Vize

script/define-props-destructuring

Enforce consistent style for defineProps destructuring in <script setup>.

Default severity Presets Automatic fix Options
warning None No Rule options

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

Bad

defineProps is assigned to the single props binding rather than destructured, contrary to the default destructuring preference.

<script setup lang="ts">
const props = defineProps<{ foo: string }>()
</script>

Good

The object pattern binds foo and bar directly and gives the optional bar a default. This relies on Vue 3.5+ reactive props destructuring; the configurable never mode prefers the opposite form.

<script setup lang="ts">
const { foo, bar = 'default' } = defineProps<{ foo: string; bar?: string }>()
</script>

Configuration (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "script/define-props-destructuring": "warn"
    }
  },
});

Then run vp run lint.