Vize

musea/prefer-design-tokens

Prefer design token CSS variables over hardcoded primitive values.

Default severity Presets Automatic fix Options
warning None No Rule options

Applies to: Musea .art.vue art, variant, and style blocks.

Requires an .art.vue file and the token inventory shown below. It does not infer a token from an arbitrary color.

Bad

The art example uses the literal blue color instead of the configured primary design token.

Button.art.vue

<art title="Button" component="Button">
<variant name="Primary"><Button /></variant>
</art>
<style scoped>
.button {
  color: #3b82f6;
}
</style>

Good

The style refers to --color-primary, the token configured for this example.

Button.art.vue

<art title="Button" component="Button">
<variant name="Primary"><Button /></variant>
</art>
<style scoped>
.button {
  color: var(--color-primary);
}
</style>

Configuration (Vite+)

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

export default defineConfig({}).withVue({
  linter: {
    "preset": "incremental",
    "rules": {
      "musea/prefer-design-tokens": "warn"
    },
    "ruleOptions": {
      "musea/prefer-design-tokens": {
        "tokens": [
          {
            "path": "color.primary",
            "value": "#3b82f6",
            "tier": "semantic"
          }
        ]
      }
    }
  },
});

Then run vp run lint.