stylelint-config-standard

Standard shareable config for Stylelint

stylelint-config-standard downloads stylelint-config-standard version stylelint-config-standard license

stylelint-config-standard类似的npm包:

npm下载趋势

3 年
🌟 在 stylelint-config-standard 的 README.md 中显示实时使用量图表,只需复制下面的代码。
## Usage Trend
[![Usage Trend of stylelint-config-standard](https://npm-compare.com/img/npm-trend/THREE_YEARS/stylelint-config-standard.png)](https://npm-compare.com/stylelint-config-standard#timeRange=THREE_YEARS)

Cumulative GitHub Star Trend

🌟 在 stylelint-config-standard 的 README.md 中显示 GitHub stars 趋势图表,只需复制下面的代码。
## GitHub Stars Trend
[![GitHub Stars Trend of stylelint-config-standard](https://npm-compare.com/img/github-trend/stylelint-config-standard.png)](https://npm-compare.com/stylelint-config-standard)

统计详情

npm包名称
下载量
Stars
大小
Issues
发布时间
License
stylelint-config-standard5,105,7271,4189.22 kB32 个月前MIT

stylelint-config-standard的README

stylelint-config-standard

NPM version Build Status

The standard shareable config for Stylelint.

It extends stylelint-config-recommended and turns on additional rules to enforce modern conventions found in the CSS specifications and within Baseline Widely Available.

To see the rules that this config uses, please read the config itself.

Example

@import url("foo.css");
@import url("bar.css");

@custom-media --foo (min-width: 30em);

/**
 * Multi-line comment
 */

:root {
  --brand-red: hsl(5deg 10% 40%);
}

/* Single-line comment */

.class-foo:not(a, div) {
  margin: 0;
  top: calc(100% - 2rem);
}

/* Flush single line comment */
@media (width >= 60em) {
  #id-bar {
    /* Flush to parent comment */
    --offset: 0px;

    color: #fff;
    font-family: Helvetica, "Arial Black", sans-serif;
    left: calc(var(--offset) + 50%);
  }

  @layer layer-foo.layer-bar {
    a::after {
      display: block;
      content: "→";
      background-image: url("x.svg");
    }
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  /* Flush nested single line comment */
  to {
    opacity: 1;
  }
}

Note: the config is tested against this example, as such the example contains plenty of CSS syntax and features.

Installation

npm install stylelint-config-standard --save-dev

Usage

Set your Stylelint config to:

{
  "extends": "stylelint-config-standard"
}

Extending the config

Add a "rules" key to your config, then add your overrides and additions there.

You can turn off rules by setting its value to null. For example:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "selector-class-pattern": null
  }
}

Or lower the severity of a rule to a warning using the severity secondary option. For example:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "property-no-vendor-prefix": [
      true,
      {
        "severity": "warning"
      }
    ]
  }
}

Or to add a rule, For example, the unit-allowed-list one:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "unit-allowed-list": ["em", "rem", "s"]
  }
}

We recommend adding more of Stylelint's rules to your config as these rules need to be configured to suit your specific needs.

Changelog

License