• Stars
    star
    1,370
  • Rank 34,321 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The standard shareable config for Stylelint

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.

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%);
  }

  /* Flush nested single line comment */
  a::after {
    display: block;
    content: "β†’";
    background-image: url("x.svg");
  }
}

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

  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

More Repositories

1

stylelint

A mighty CSS linter that helps you avoid errors and enforce conventions.
JavaScript
10,971
star
2

awesome-stylelint

A list of awesome Stylelint plugins, configs, etc.
497
star
3

stylelint-config-recommended

The recommended shareable config for Stylelint
JavaScript
377
star
4

vscode-stylelint

The official Visual Studio Code extension for Stylelint
TypeScript
310
star
5

eslint-config-stylelint

Stylelint org's shareable config for eslint
JavaScript
59
star
6

stylelint.io

The source of the Stylelint website
JavaScript
28
star
7

stylelint-demo

The online demo on the Stylelint website
TypeScript
14
star
8

jest-preset-stylelint

Common configuration options for Jest in Stylelint environments.
JavaScript
14
star
9

stylelint.github.io

Generated static website (do not push to here)
HTML
6
star
10

create-stylelint

The npm init script for Stylelint
JavaScript
6
star
11

stylelint-rule-tester

An easy way to test stylelint rules.
JavaScript
4
star
12

prettier-config

Stylelint org's shareable config for prettier
JavaScript
4
star
13

stylelint-test-rule-tape

A stylelint rule tester using tape
JavaScript
3
star
14

css-parser

Universal CSS parser
3
star
15

npm-package-json-lint-config

Stylelint org's config for npm-package-json-lint.
JavaScript
3
star
16

remark-preset

Stylelint org's shareable preset for remark
JavaScript
3
star
17

.github

Stylelint org-wide GitHub settings
2
star
18

stylelint-test-rule-node

A Stylelint rule tester using Node.js built-in test runner
JavaScript
2
star
19

changelog-to-github-release-action

GitHub Action to convert CHANGELOG file to GitHub Release
JavaScript
1
star
20

vscode-stylelint-test

A VS Code Test Repo
JavaScript
1
star