Vize

vue/no-props-shadow

Interdit aux déclarations de script setup de masquer les props.

Gravité par défaut Préréglages Correction automatique Options
warning Aucune Non Aucune

Champ d’application : Templates et blocs des SFC Vue, avec le contexte du script requis par la règle.

Mauvais

La déclaration locale value masque la prop homonyme.

<script setup>
defineProps({ value: String })
const value = "local"
</script>
<template />

Bon

La liaison locale utilise un nom distinct.

<script setup>
defineProps({ value: String })
const localValue = "local"
</script>
<template />

Configuration (Vite+)

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

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

Lancez ensuite vp run lint.

Voir aussi