Skip to content

feat: new rules to help standardize the components usage - #127

Merged
J-Sek merged 5 commits into
masterfrom
feat/no-banned-components
Mar 5, 2026
Merged

J-Sek merged 5 commits into
masterfrom
feat/no-banned-components

Conversation

@J-Sek

@J-Sek J-Sek commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor
Rule Counterpart to
custom-deprecated-components no-deprecated-components
custom-deprecated-props no-deprecated-props
custom-deprecated-events no-deprecated-events
custom-deprecated-slots no-deprecated-slots

New optional custom-deprecated-* rules lets users ban specific components, props, events and slots from templates with optional auto-fix replacements.

Common use cases:

  • enforcing standardization in large projects
  • automatic cleanup of anti-patterns when giving AI tools too much leash

(Previously it required patching internals of this library)

  • String replacement with dot notation for tag + classes (VRow: 'div.grid.grid-cols-12') — auto-fixable
  • Custom message object (VSnackbar: { message: 'Use <AppSnackbar> instead' }) — report only
  • false (VBottomSheet: false) — report only with generic message
  • requires configuration object (no defaults)
  • accepts both PascalCase and kebab-case keys
  • merges generated classes with existing class attribute
Demo.vue
<template>
  <v-app>
    <my-custom-card loading />
    <my-custom-card :loading="true" />

    <v-tabs v-model="current" slider-color="primary" />

    <my-upload-button prepend-icon="i-tabler:folder-up" />

    <v-radio @update:model-value="handler" />

    <v-dialog @click:outside="handler" />

    <my-upload-button @done="handler" />

    <v-snackbar>
      <template #action>...</template>
    </v-snackbar>

    <my-gallery-card>
      <template #title>...</template>
    </my-gallery-card>

    <v-menu>
      <template #activator="{ props }">...</template>
    </v-menu>

    <v-row>
      <v-col>...</v-col>
    </v-row>

    <v-snackbar />

    <v-bottom-sheet />

    <my-custom-card loader />
    <my-custom-card :loader="true" />
    <v-tabs v-model="current" />
    <v-radio @click="handler" />
    <v-snackbar />
    <div class="grid grid-cols-12">
      <div class="pa-3 col-span-4">...</div>
    </div>
  </v-app>
</template>

<script setup>
const current = 0
const handler = () => {}
</script>
eslint.config.ts
import { createRequire } from 'node:module'

const require = createRequire(import.meta.url)
const vuetify = require('eslint-plugin-vuetify')
const vueParser = require('vue-eslint-parser')

export default [
  ...vuetify.configs['flat/recommended-v4'],
  ...vuetify.configs['flat/tailwindcss'],
  {
    files: ['**/*.vue'],
    languageOptions: {
      parser: vueParser,
    },
  },
  {
    files: ['src/CustomDeprecated.vue'],
    rules: {
      'vuetify/custom-deprecated-props': ['error', {
        MyCustomCard: {
          loading: 'loader',
        },
        VTabs: {
          sliderColor: false,
        },
        MyUploadButton: {
          prependIcon: { message: 'Use upload-type instead' },
        },
      }],
      'vuetify/custom-deprecated-events': ['error', {
        VRadio: {
          'update:modelValue': 'click',
        },
        VDialog: {
          'click:outside': false,
        },
        MyUploadButton: {
          done: { message: 'Use @success or @error instead' },
        },
      }],
      'vuetify/custom-deprecated-slots': ['error', {
        MyGalleryCard: {
          title: false,
        },
        VMenu: {
          activator: { message: 'Prefer v-model or activator="parent" instead' },
        },
      }],
      'vuetify/custom-deprecated-components': ['error', {
        VRow: 'div.grid.grid-cols-12',
        VCol: 'div.pa-3.col-span-4',
        VSnackbar: { message: 'Use useNotification instead' },
      }],
    },
  },
]

@J-Sek J-Sek self-assigned this Mar 5, 2026
@J-Sek
J-Sek merged commit 37bb71f into master Mar 5, 2026
4 checks passed
@J-Sek J-Sek changed the title feat: new rule to help standardize the components usage feat: new rules to help standardize the components usage Mar 5, 2026
@J-Sek
J-Sek deleted the feat/no-banned-components branch March 5, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant