Dialtone Stylelint plugin

Check stylesheets for deprecated Dialtone tokens and CSS patterns.

@dialpad/stylelint-plugin-dialtone checks stylesheets for deprecated Dialtone tokens and CSS patterns that work against the design system.

The plugin has one opt-in preset, recommended, for deprecated Dialtone tokens. Every other rule is enabled explicitly, so the configuration reflects what your project intends to enforce.

Installation

Install the plugin alongside Stylelint:

npm install --save-dev stylelint @dialpad/stylelint-plugin-dialtone

Configuration

Add the plugin to stylelint.config.mjs, then configure its rules:

export default {
  plugins: ["@dialpad/stylelint-plugin-dialtone"],
  rules: {
    "@dialpad/stylelint-plugin-dialtone/no-deprecated-size-tokens": [
      true,
      { includeSpaceTokens: false },
    ],
    "@dialpad/stylelint-plugin-dialtone/no-deprecated-space-tokens": true,
    "@dialpad/stylelint-plugin-dialtone/no-deprecated-success-tokens": true,
    "@dialpad/stylelint-plugin-dialtone/no-base-color-tokens": true,
  },
};

To report every deprecated size, space and success token with one warning per occurrence, extend the preset:

export default {
  extends: ["@dialpad/stylelint-plugin-dialtone/recommended"],
};

It enables no-deprecated-size-tokens with includeSpaceTokens: false, no-deprecated-space-tokens and no-deprecated-success-tokens, each at warning. Each warning names the replacement for the declaration's property, or says there is none. Adding a rule to the preset, or raising its severity, only happens in a major release.

Use null to turn off a rule inherited from a shared configuration.

Rules

Rule What it checks Autofix
no-base-color-tokens Detects raw base-color tokens that should use a semantic color token. No
no-deprecated-size-tokens Detects deprecated numeric size tokens and names the replacement for the declaration's property. No
no-deprecated-space-tokens Detects legacy space tokens and names the replacement for the declaration's property. No
no-deprecated-success-tokens Detects success color tokens that have been renamed to positive. No
no-mixins Detects Less mixins. No
recommend-font-style-tokens Detects separate font declarations that should use a composed font token. No
use-dialtone-tokens Detects pixel and rem values that should use Dialtone tokens. No

no-deprecated-size-tokens reports numeric size tokens and names the replacement for the declaration's property: spacing, layout, border or radius. By default it also reports --dt-space-* tokens, so a configuration that enables only that rule keeps flagging them. When you also enable no-deprecated-space-tokens, set includeSpaceTokens: false so each space token is reported once. no-deprecated-space-tokens names the same-value --dt-spacing-* token for spacing properties, and says to review manually where there is none. A fixed migration helper for these tokens is pending, so replace them by hand for now.

Logical properties

The package also includes stylelint-use-logical. Its csstools/use-logical rule reports physical properties and values that have logical equivalents.

Enable it from the same Stylelint configuration:

export default {
  plugins: ["@dialpad/stylelint-plugin-dialtone"],
  rules: {
    "csstools/use-logical": true,
  },
};

It is an upstream rule bundled by the package, not a Dialtone-specific rule. Refer to the upstream documentation for its options and reported patterns.

Run Stylelint

Run Stylelint against the stylesheet types used by your project:

npx stylelint "**/*.{css,less,vue}"

Projects that lint Less or Vue style blocks may need a Stylelint-compatible custom syntax. Keep that setup in the consuming project's Stylelint configuration.

Dialtone Stylelint plugin documentation last updated Wednesday, December 2, 2026