Vize

css/no-utility-classes

Warn against implementing utility classes in component styles

Bad · Good

Default severity: warning
Presets: opinionated, nuxt
Automatic fix: None; review the suggested change
Applies to: CSS inside SFC style blocks
Options: No rule-specific options. Severity and preset selection are configurable.

Configuration (Vite+)

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

export default defineConfig({
  lint: {
    vize: {
      "preset": "incremental",
      "rules": {
        "css/no-utility-classes": "warn"
      }
    },
  },
});
vp run lint

Bad

The authored selectors use utility-shaped names such as .flex, .mt-4, and .text-center.

<style scoped>
.flex { display: flex; }
.mt-4 { margin-top: 1rem; }
.text-center { text-align: center; }
</style>

Good

A component-specific .my-component selector groups the component styling under one semantic name.

<style scoped>
.my-component { display: flex; margin-top: 1rem; }
</style>

Good avoids this rule's finding under the configuration above; other rules may still report diagnostics.

Implementation · All rules