Skip to content

archoleat/stylelint-config-extended-scss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stylelint Config Extended SCSS

NPM Version NPM Downloads ESM Provenance CodeQL Specs Commitlint Editorconfig Prettier ESLint Remark

Table of Contents

Installation

bun i -D @archoleat/stylelint-config-extended-scss

Usage

Tip

We recommend setting stylelint-define-config for property suggestions.

# bun
bun i -D stylelint-define-config
// stylelint.config.js or stylelint.config.ts
import { defineConfig } from 'stylelint-define-config';

export default defineConfig({
  extends: '@archoleat/stylelint-config-extended-scss',
});

Extending the Config

// stylelint.config.js or stylelint.config.ts
import { defineConfig } from 'stylelint-define-config';

export default defineConfig({
  extends: '@archoleat/stylelint-config-extended-scss',
  rules: {
    'selector-max-compound-selectors': 4,
    'value-no-vendor-prefix': false,
  },
});

Add the Space Between Logical Groups

If you want to add spaces between logical groups, add this rule to your Stylelint config:

// stylelint.config.js
import { defineConfig } from 'stylelint-define-config';

export default defineConfig({
  extends: '@archoleat/stylelint-config-extended-scss',
  rules: {
    'declaration-empty-line-before': null,
  },
});

Before

.popup {
  pointer-events: none;
  opacity: 0;
  position: fixed;
  inset: 0;
}

After

.popup {
  pointer-events: none;

  opacity: 0;

  position: fixed;
  inset: 0;
}

This Config

Extends

Plugins

  • stylelint-declaration-block-no-ignored-properties: Disallow property values that are ignored due to another property value in the same rule.

  • stylelint-gamut: Throw warning if color goes out of sRGB color space and is not wrapped in @media (color-gamut: p3) {} or @media (color-gamut: rec2020) {}

  • stylelint-group-selectors: Identify the selectors, which can be grouped, as they have same set of properties and values.

  • stylelint-high-performance-animation: Enhances your animations.

  • stylelint-order: Sorts over 400 properties for enhanced clarity and maintainability.

    Properties are logically grouped and separated by a space.

  • stylelint-plugin-defensive-css: Enforcing defensive CSS best practices.

  • stylelint-plugin-logical-css: Replace properties with logical alternatives.

  • stylelint-rem-over-px: Enforce the usage of rem units over px units.

    Declaring the rule with default values is equivalent to:

      // Declaring the rule with default values is equivalent to:
      "rem-over-px/rem-over-px": [
        true,
        {
          "ignore": "1px",
          "ignoreFunctions": ["url"],
          "ignoreAtRules": ["media"],
          "fontSize": 16
        }
      ],
  • stylelint-no-unsupported-browser-features: Disallow features that aren't supported by your target browser audience.

    For this plugin, browserslist is already configured with the following options: > 1.5% Firefox ESR last 2 versions not dead

    If you want to use your own config, then create a browserslist file in your project's root.

Rules

This is a list of the lints turned on in this configuration, and what they do.

CSS

At-rule
Case
Color
Declaration
Descending
Function
Max & Min
Notation
Pattern
  • selector-class-pattern: BEM naming convention likely enforced, encouraging modularity, maintainability, and clarity in class naming.
Selector
Unknown

SCSS

SCSS At-rule
Comment
SCSS Declaration
Dollar Variable
SCSS Function
  • scss/function-color-relative: Encourages the use of the scale-color() feature instead of deprecated features:
    • darken()
    • desaturate()
    • fade-in()
    • fade-out()
    • lighten()
    • opacify()
    • saturate()
    • transparentize()
Import
Maps
Media
SCSS Selector
SCSS Unknown

Contributing

Please read CONTRIBUTING to start contributing.

License

This project is licensed under the MIT license.