GithubHelp home page GithubHelp logo

ahelmel / stylelint-config-rational-order Goto Github PK

View Code? Open in Web Editor NEW

This project forked from constverum/stylelint-config-rational-order

0.0 1.0 0.0 173 KB

Stylelint config that sorts related property declarations by grouping together in the rational order

License: Apache License 2.0

JavaScript 100.00%

stylelint-config-rational-order's Introduction

stylelint-config-rational-order

NPM version Build status License

Stylelint config that sorts related property declarations by grouping together following the order:

  1. Positioning
  2. Box Model
  3. Typography
  4. Visual
  5. Animation
  6. Misc
.declaration-order {
  /* Positioning */
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;

  /* Box Model */
  display: block;
  float: right;
  width: 100px;
  height: 100px;
  margin: 10px;
  padding: 10px;

  /* Typography */
  color: #888;
  font: normal 16px Helvetica, sans-serif;
  line-height: 1.3;
  text-align: center;

  /* Visual */
  background-color: #eee;
  border: 1px solid #888;
  border-radius: 4px;
  opacity: 1;

  /* Animation */
  transition: all 1s;

  /* Misc */
  user-select: none;
}

Usage

  1. Add stylelint and this package to your project:
npm install --save-dev stylelint stylelint-config-rational-order
# or, if you prefer yarn over npm:
yarn add --dev stylelint stylelint-config-rational-order
  1. Add this package to the end of your extends array inside Stylelint configuration (.stylelintrc for example):
{
  "extends": [
    // "stylelint-config-standard",
    "stylelint-config-rational-order"
  ]
}

This shareable config contains the following:

{
  "plugins": [
    "stylelint-config-rational-order/plugin"
  ],
  "rules": {
    "plugin/rational-order": [true, {
      "border-in-box-model": false,
      "empty-line-between-groups": false,
    }]
  }
}

Since it adds stylelint-config-rational-order to plugins, you don't have to do this yourself when extending this config.

Optional options / rules

border-in-box-model

Defines to which group the border property belongs to.

If true border property belongs to the box model section. The default value is false (border property belongs to the visual section).

empty-line-between-groups

If true adds an empty line between groups. The default value is false.

FAQ

Why should I use the rational order and group and sort CSS properties by type instead of alphabetical order?

The pros and cons of both ways in detail:

Credits

stylelint-config-rational-order's People

Contributors

constverum avatar mor10 avatar

Watchers

Arthur Helmel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.