Vize

type/no-base-to-string

Disallow stringifying values that fall back to Object.prototype.toString().

Default severity Presets Automatic fix Options
warning nuxt, opinionated No Rule options

Applies to: Type information in Vue SFC scripts and templates, for the constructs shown below.

This rule reads type information from your TypeScript project (tsconfig.json), so the configuration sets typeAware: true. typeAware does not turn on opt-in rules by itself.

Bad

plain is a plain object, so toString() falls back to Object.prototype.toString().

<script setup lang="ts">
const plain = { a: 1 };
plain.toString();
</script>

Good

label is already a string, so toString() uses the string conversion.

<script setup lang="ts">
const label = "a";
label.toString();
</script>

Configuration (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "type/no-base-to-string": "warn"
    },
    "typeAware": true
  },
});

Then run vp run lint.