npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

stylelint-config-css-modules

1.4.0 • Public • Published

stylelint-config-css-modules

npm version Build Status

CSS modules shareable config for stylelint.

Tweaks stylelint rules to accept css modules specific syntax.
This is useful as an override of pre-defined rules, for instance the stylelint-config-standard.

Installation

npm install stylelint-config-css-modules --save-dev

or

yarn add stylelint-config-css-modules --dev

Usage

{
  "extends": [
    "stylelint-config-standard",
    "stylelint-config-css-modules"
  ],
  "rules": {
    [...]
  }
}

Examples

@value colors: './colors.css';
@value primary, secondary from colors;
 
.base {
  content: 'base';
  color: primary;
}
 
.composed {
  composes: base;
}
 
.composedWith {
  compose-with: base;
}
 
.flexible {
  composes: flex from './utils.css';
  flex-direction: column;
}
 
:global(.js) .progressive {
  display: block;
}

Dealing with :export variables

A couple of available solutions, pick your poison

1. Inline comments

:export {
  /* stylelint-disable property-no-unknown */
  black: #000;
  white: #111;
  /* stylelint-enable */
}

2. Prefixed names

:export {
  $black: #000;
  $white: #111;
}

3. Config whitelist

{
  "rules": {
    "property-no-unknown": [
      true,
      {
        "ignoreProperties": ["black", "white"]
      }
    ]
  }
}

4. Custom prefix

:export {
  foo-black: #000;
  foo-white: #111;
}
{
  "rules": {
    "property-no-unknown": [
      true,
      {
        "ignoreProperties": ["/^foo/"]
      }
    ]
  }
}

Credits

Licence

stylelint-config-css-modules is unlicensed.

install

npm i stylelint-config-css-modules

Downloadsweekly downloads

31,294

version

1.4.0

license

Unlicense

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability