Anchor Design System

Quick Start

Getting Started with our Stylelint Plugin

Introduction

@tryg/stylelint-plugin is a collection of custom linting rules for Stylelint, designed to help you write consistent and maintainable CSS code.

What's in the plugin?

Our plugin includes three custom rules:

@tryg/no-deprecated-vars

Disallows the use of deprecated CSS tokens (variables) in your CSS code.

@tryg/no-hardcoded-declaration-values

Disallows the use of hardcoded values for certain CSS properties, encouraging the use of CSS variables instead.

@tryg/no-invalid-variable-assignment

Disallows the assignment of CSS variables to invalid properties in your CSS code.

Getting Started

To get started with our plugin, follow these steps:

  1. Install the plugin using npm or yarn:
npm install @tryg/stylelint-plugin --save-dev
  1. Add the plugin to your Stylelint configuration file (.stylelintrc.json):
{
  "plugins": ["@tryg/stylelint-plugin"],
  "rules": {
    "@tryg/no-deprecated-vars": true,
    "@tryg/no-hardcoded-declaration-values": true,
    "@tryg/no-invalid-variable-assignment": true
  }
}
  1. Run Stylelint on your CSS code to see the plugin in action:
npx stylelint your-css-file.css

Learn More

For more information on each rule, check out the following pages:

FAQ

Some common questions you may encounter.

On this page