<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-5HGSQD2L" height="0" width="0" style="display:none;visibility:hidden" title="GTM"></iframe>

Stylelint plugin

SWAN's Stylelint package is a custom linting plugin built to enforce the Vista Design System's evolving design language across CSS and SCSS files. It helps teams maintain consistency and reduce variations by flagging deviations from SWAN's design principles.

Getting started

Prerequisites

You will need to have Stylelint setup done for your project. Refer to Getting Started with StyleLint if you don't have a setup.

Peer dependencies

This plugin requires the following peer dependencies to be installed in your project:

Environment support

We recommend a minimum Node.js version of 18 for a predictable, stable experience. Versions below it may/may not work.

Installation

Usage

This plugin provides a recommended Stylelint configuration preloaded with SWAN-specific rules. To enable it in your project, simply extend it in your Stylelint config:

Rules

Rule IDDescriptionDefault SeverityDocs with examplesSuggestion available
swan/no-internal-tokensDisallows usage of internal SWAN tokens like swan-internal-* or swan-comp-*.errorREADMENo
swan/no-deprecated-tokensFlags usage of deprecated tokens.errorREADMEPartially
swan/no-raw-colorsFlags usage of raw color values like #fff, rgb(), rgba(), hsl(), hsla().errorREADMENo
swan/no-token-overridesDisallows re-declaring any SWAN design tokens.errorREADMENo
swan/no-class-overridesDisallows overriding SWAN classes.errorREADMENo

Overriding a rule

You can override individual rule severities even when using the recommended config.

Related