Stylelint config that sorts related properties together thinking outside and outstanding first. Of course that's highly opinionated.
Properties are grouped as follows:
- Positioning & layout
- Box Model
- Visual (including borders)
- Typography
- Animation
- Misc
.declaration-order {
/* Positioning */
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 10;
/* Layout */
display: block;
flex-direction: column;
/* Box Model */
width: 100px;
height: 100px;
margin: 10px;
padding: 10px;
/* Visual */
color: #888;
background-color: #eee;
border: 1px solid #888;
border-radius: 4px;
opacity: 1;
/* Typography */
font: normal 16px Helvetica, sans-serif;
line-height: 1.3;
text-align: center;
/* Animation */
transition: all 1s;
/* Misc */
user-select: none;
}
- Add Stylelint and this package to your project:
npm install --save-dev stylelint stylelint-config-outside-in-order
- Add this package to the end of the extends array inside your Stylelint configuration:
{
"extends": [
// "stylelint-config-standard",
"stylelint-config-outside-in-order"
]
}
inspired by stylelint-config-rational-order and several discussions around the web & with colleagues