Vize

type/no-unnecessary-type-parameters

Disallow type parameters that are not used more than once.

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

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

T appears only once in the signature, so it does not express a relationship between types.

<script setup lang="ts">
function logValue<T>(value: T): void {
  console.info(value);
}
</script>

Good

T relates the parameter type to the return type.

<script setup lang="ts">
function identity<T>(value: T): T {
  return value;
}
</script>

Configuration (Vite+)

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

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

Then run vp run lint.