npm.io
1.11.11 • Published 2 weeks ago

@archoleat/stylelint-config-extended-scss

Licence
MIT
Version
1.11.11
Deps
13
Size
36 kB
Vulns
0
Weekly
0

Stylelint Config Extended SCSS

NPM Version NPM Downloads Specs Commitlint Editorconfig Prettier ESLint Remark

Table of Contents

Extended shareable config for Stylelint with property sorting.

Installation

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

Requires Stylelint 17.14.0 or later within version 17. Stylelint 15 and 16 are not supported by the current dependencies.

Runtime

This is an ES module loaded by Stylelint in Node.js. Follow the Node.js requirements of the installed Stylelint and plugins. Bun is used for repository tooling, not required to load the published configuration.

Usage

Add the following code to the stylelint.config.ts or stylelint.config.js file:

import { defineConfig } from 'stylelint-define-config';

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

Policy and Overrides

This is an opinionated team policy. BEM class names, logical properties, rem units, nesting limits, and the !important restriction are defaults, not universal requirements for every project. Keep the rules that match your codebase and override individual rules in the consuming configuration:

export default {
  extends: '@archoleat/stylelint-config-extended-scss',
  rules: {
    'declaration-no-important': null,
    'selector-class-pattern': null,
    'rem-over-px/rem-over-px': null,
  },
};

Prefer a local, explained disable comment for a one-off exception. A project that uses CSS Modules or utility classes may need a different naming rule.

The configuration loads Prettier and several plugins. This adds installation and lint time compared with the base SCSS config; rule checks are not a measurement of the application's runtime performance. Measure cold and warm Stylelint runs on representative files before adopting it as a required team check. Compare against stylelint-config-standard-scss on the same files and environment; timings are specific to that workload.

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: Flags animation properties that may cause layout or paint work.

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

    Properties are logically grouped and separated by a space. A space between groups will only appear if the group has 3 or more properties.

  • 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:

      "rem-over-px/rem-over-px": [
        true,
        {
          "ignore": "1px",
          "ignoreFunctions": ["url"],
          "ignoreAtRules": ["media"],
          "fontSize": 16
        }
      ],
Rules

This is a list of the lints turned on in this configuration.

CSS
At-rule
Case
Color
Declaration
Descending
Function
Max & Min
Notation
Pattern
Selector
Unknown
SCSS
SCSS At-rule
Comment
SCSS Declaration
Dollar Variable
SCSS Function
Import
Maps
Media
SCSS Selector
SCSS Unknown

Contributing

Please read CONTRIBUTING to start contributing.

License

This project is licensed under the MIT license.

Keywords