All Projects â†’ stylelint â†’ Stylelint Config Standard

stylelint / Stylelint Config Standard

Licence: mit
The standard shareable config for stylelint

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Stylelint Config Standard

Stylelint Config Rational Order
Stylelint config that sorts related property declarations by grouping together in the rational order đŸšĻ
Stars: ✭ 313 (-71.75%)
Mutual labels:  stylelint
Wemake Vue Template
Bleeding edge vue template focused on code quality and developer happiness.
Stars: ✭ 645 (-41.79%)
Mutual labels:  stylelint
Stylelint No Browser Hacks
Stylelint plugin for stylehacks linting
Stars: ✭ 12 (-98.92%)
Mutual labels:  stylelint
Stylelint A11y
Plugin for stylelint with a11y rules
Stars: ✭ 384 (-65.34%)
Mutual labels:  stylelint
Stylelint Order
A plugin pack of order related linting rules for stylelint.
Stars: ✭ 607 (-45.22%)
Mutual labels:  stylelint
Stylefmt Loader
Webpack-loader. Fixes stylelint issues automatically while bundling with Webpack.
Stars: ✭ 24 (-97.83%)
Mutual labels:  stylelint
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (-76.53%)
Mutual labels:  stylelint
Stylelint Module
Stylelint module for Nuxt.js
Stars: ✭ 32 (-97.11%)
Mutual labels:  stylelint
Stylelint Processor Styled Components
Lint your styled components with stylelint!
Stars: ✭ 639 (-42.33%)
Mutual labels:  stylelint
React Mobx React Router Boilerplate
A simple boilerplate based on create-react-app and add mobx, react-router, linter, prettier and so on. 一ä¸ĒįŽ€å•įš„ react č„šæ‰‹æžļ䞝čĩ–äēŽ create-react-app 新åĸžäē† mobx react-router,linter,prettier į­‰ã€‚
Stars: ✭ 12 (-98.92%)
Mutual labels:  stylelint
React 2048 Game
🎮 A fancy 2048 game build with react, redux best practices.
Stars: ✭ 401 (-63.81%)
Mutual labels:  stylelint
Magento2 Frontools
Set of front-end tools for Magento 2 based on Gulp.js
Stars: ✭ 416 (-62.45%)
Mutual labels:  stylelint
Jest Styled Components Stylelint
Run stylelint on your styled-components styles at runtime.
Stars: ✭ 25 (-97.74%)
Mutual labels:  stylelint
Stylelint Config Sass Guidelines
⚙ A stylelint config inspired by https://sass-guidelin.es/
Stars: ✭ 349 (-68.5%)
Mutual labels:  stylelint
Mvfsillva
My personal website
Stars: ✭ 13 (-98.83%)
Mutual labels:  stylelint
Web Configs
Common configurations for building web apps at Shopify
Stars: ✭ 302 (-72.74%)
Mutual labels:  stylelint
Stylelint Scss
A collection of SCSS specific linting rules for stylelint
Stars: ✭ 655 (-40.88%)
Mutual labels:  stylelint
Generator Dhboilerplate
Boilerplate made by David Hellmann
Stars: ✭ 54 (-95.13%)
Mutual labels:  stylelint
React Ssr Starter
All have been introduced React environment
Stars: ✭ 20 (-98.19%)
Mutual labels:  stylelint
Stylelint.io
The source of the stylelint website
Stars: ✭ 26 (-97.65%)
Mutual labels:  stylelint

stylelint-config-standard

NPM version Build Status

The standard shareable config for stylelint.

Extends stylelint-config-recommended.

Turns on additional rules to enforce the common stylistic conventions found within a handful of CSS styleguides, including: The Idiomatic CSS Principles, Google's CSS Style Guide, Airbnb's Styleguide, and @mdo's Code Guide.

It favours flexibility over strictness for things like multi-line lists and single-line rulesets, and tries to avoid potentially divisive rules.

Use it as is or as a foundation for your own config.

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

Example

@import url(x.css);
@import url(y.css);

/**
 * Multi-line comment
 */

.selector-1,
.selector-2,
.selector-3[type="text"] {
  background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
  box-sizing: border-box;
  display: block;
  color: #333;
}

.selector-a,
.selector-b:not(:first-child) {
  padding: 10px !important;
  top: calc(calc(1em * 2) / 3);
}

.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }

/* Single-line comment */

@media (min-width >= 60em) {
  .selector {
    /* Flush to parent comment */
    transform: translate(1, 1) scale(3);
  }
}

@media (orientation: portrait), projection and (color) {
  .selector-i + .selector-ii {
    background: color(rgb(0, 0, 0) lightness(50%));
    font-family: helvetica, "arial black", sans-serif;
  }
}

/* Flush single line comment */
@media
  screen and (min-resolution: 192dpi),
  screen and (min-resolution: 2dppx) {
  .selector {
    background-image:
      repeating-linear-gradient(
        -45deg,
        transparent,
        #fff 25px,
        rgba(255, 255, 255, 1) 50px
      );
    margin: 10px;
    margin-bottom: 5px;
    box-shadow:
      0 1px 1px #000,
      0 1px 0 #fff,
      2px 2px 1px 1px #ccc inset;
    height: 10rem;
  }

  /* Flush nested single line comment */
  .selector::after {
    content: '→';
    background-image: url(x.svg);
  }
}

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

Installation

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

Usage

If you've installed stylelint-config-standard locally within your project, just set your stylelint config to:

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

If you've globally installed stylelint-config-standard using the -g flag, then you'll need to use the absolute path to stylelint-config-standard in your config e.g.

{
  "extends": "/absolute/path/to/stylelint-config-standard"
}

Since stylelint 9.7.0, you can simply use the globally installed configuration name instead of the absolute path:

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

Extending the config

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

For example, to change the at-rule-no-unknown rule to use its ignoreAtRules option, change the indentation to tabs, turn off the number-leading-zero rule,and add the unit-allowed-list rule:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "at-rule-no-unknown": [
      true,
      {
        "ignoreAtRules": ["extends", "ignores"]
      }
    ],
    "indentation": "tab",
    "number-leading-zero": null,
    "unit-allowed-list": ["em", "rem", "s"]
  }
}

Suggested additions

stylelint-config-standard is a great foundation for your own config. You can extend it to create a tailored and much stricter config:

Using the config with SugarSS syntax

The config is broadly compatible with SugarSS syntax. You will need to turn off the rules that check braces and semicolons, as so:

{
  "extends": "stylelint-config-standard",
  "rules": {
    "block-closing-brace-empty-line-before": null,
    "block-closing-brace-newline-after": null,
    "block-closing-brace-newline-before": null,
    "block-closing-brace-space-before": null,
    "block-opening-brace-newline-after": null,
    "block-opening-brace-space-after": null,
    "block-opening-brace-space-before": null,
    "declaration-block-semicolon-newline-after": null,
    "declaration-block-semicolon-space-after": null,
    "declaration-block-semicolon-space-before": null,
    "declaration-block-trailing-semicolon": null
  }
}

Changelog

License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].