Vize

css/prefer-nested-selectors

Recommend using CSS nesting for descendant selectors.

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

Applies to: Plain CSS style blocks (scss, sass, less and stylus blocks are skipped).

Bad

The .card .title descendant selector repeats the parent selector in a flat rule.

<style scoped>
.card .title { color: red; }
</style>

Good

The .title rule is nested inside .card, keeping the parent-child styling relationship together.

<style scoped>
.card { .title { color: red; } }
</style>

Configuration (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "css/prefer-nested-selectors": "warn"
    }
  },
});

Then run vp run lint.