Vize

vue/no-restricted-static-attribute

Proíbe o atributo estático configurado.

Severidade padrão Predefinições Correção automática Opções
warning Nenhuma Não Nenhuma

Aplicável a: Templates e blocos de SFC Vue, com o contexto do script quando exigido pela regra.

Incorreto

O botão tem o atributo proibido data-legacy.

<template>
  <button type="button" data-legacy="x">x</button>
</template>

Correto

O botão mantém apenas type.

<template>
  <button type="button">x</button>
</template>

Configuração (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "vue/no-restricted-static-attribute": "warn"
    },
    "ruleOptions": {
      "vue/no-restricted-static-attribute": [
        "data-legacy"
      ]
    }
  },
});

Depois, execute vp run lint.

Páginas relacionadas