Skip to content

benhigham/stylelint-config

Repository files navigation

@benhigham/stylelint-config

npm version npm downloads License

My personal Stylelint configuration for maintaining consistent, high-quality CSS/SCSS code.

Features

This configuration:

  • Extends stylelint-config-standard-scss for SCSS support and best practices
  • Uses stylelint-config-recess-order for consistent property ordering
  • Enforces strict value usage for colors, font-sizes, and z-indices
  • Prevents performance issues with animations
  • Requires proper use of custom media queries and nesting
  • Enforces BEM naming conventions with SUIT CSS methodology
  • Ensures browser compatibility with Baseline requirements
  • Detects and prevents indistinguishable colors and out-of-gamut colors
  • Provides special handling for CSS modules

Installation

# npm
npm install --save-dev @benhigham/stylelint-config

# yarn
yarn add --dev @benhigham/stylelint-config

# pnpm
pnpm add --save-dev @benhigham/stylelint-config

Usage

Create a stylelint.config.js file in your project root and extend this configuration:

/** @type {import('stylelint').Config} */
export default {
  extends: ['@benhigham/stylelint-config'],
};

Configuration Details

Extended Configs

Plugins

This configuration includes several plugins:

Key Rules

  • Browser Compatibility: Enforces only widely supported CSS features
  • SCSS Best Practices: Limits nesting depth, enforces consistent naming patterns
  • BEM Pattern: Uses SUIT CSS methodology for class naming
  • CSS Modules: Special handling for .module.scss files with relaxed naming rules

License

This project is licensed under the MIT License.

Sponsor this project

 

Contributors 3

  •  
  •  
  •