Vize

script/no-boolean-default

Disallow a default on a Boolean prop.

Default severity Presets Automatic fix Options
warning opinionated, nuxt No None

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

Bad

Both disabled and checked declare a default on a prop whose sole constructor is Boolean; the rule rejects even an explicit false default.

<script lang="ts">
export default {
  props: {
    // Boolean props already default to false; an explicit default is confusing.
    disabled: { type: Boolean, default: true },
    checked: { type: Boolean, default: false }
  }
}
</script>

Good

The Boolean-only props omit default, using Vue’s implicit false value. The [Boolean, String] union and the Number prop illustrate that this check is limited to the sole Boolean constructor.

<script lang="ts">
export default {
  props: {
    // No explicit default: defaults to false.
    disabled: { type: Boolean },
    disabled2: Boolean,
    // Union type may legitimately need a default.
    value: { type: [Boolean, String], default: '' },
    // Non-Boolean prop.
    count: { type: Number, default: 0 }
  }
}
</script>

Configuration (Vite+)

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

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

Then run vp run lint.