44[ ![ Node version] ( https://img.shields.io/node/v/@almacareer/stylelint-config.svg?style=flat&logo=nodedotjs )] ( http://nodejs.org/download/ )
55[ ![ Stylelint version] ( https://img.shields.io/npm/dependency-version/@almacareer/stylelint-config/peer/stylelint?logo=stylelint )] ( https://github.com/stylelint/stylelint )
66
7- > LMC ’s config for Stylelint
7+ > Alma Career ’s config for Stylelint
88
99## Usage
1010
1111``` bash
1212# Yarn:
13- yarn add --dev @almacareer/stylelint-config stylelint-config- prettier
13+ yarn add --dev @almacareer/stylelint-config stylelint-prettier
1414
1515# npm:
16- npm install --save-dev @almacareer/stylelint-config stylelint-config- prettier
16+ npm install --save-dev @almacareer/stylelint-config stylelint-prettier
1717```
1818
1919> We assume you are using Prettier. That’s why we also recommend adding
20- > ` stylelint-config- prettier ` above.
20+ > ` stylelint-prettier ` above.
2121
2222Configuration extends community maintained config [ stylelint-config-standard-scss] ( https://github.com/stylelint-scss/stylelint-config-standard-scss ) .
2323
@@ -39,7 +39,7 @@ Use this ruleset to configure Stylelint to work with your code.
3939// .stylelintrc.mjs
4040
4141export default {
42- extends: [' @almacareer/stylelint-config' , ' stylelint-config- prettier' ],
42+ extends: [' @almacareer/stylelint-config' , ' stylelint-prettier/recommended ' ],
4343};
4444```
4545
@@ -48,7 +48,7 @@ export default {
4848
4949``` json
5050{
51- "extends" : [" @almacareer/stylelint-config" , " stylelint-config- prettier" ]
51+ "extends" : [" @almacareer/stylelint-config" , " stylelint-prettier/recommended " ]
5252}
5353```
5454
@@ -60,11 +60,87 @@ export default {
6060``` json
6161{
6262 "stylelint" : {
63- "extends" : [" @almacareer/stylelint-config" , " stylelint-config- prettier" ]
63+ "extends" : [" @almacareer/stylelint-config" , " stylelint-prettier/recommended " ]
6464 }
6565}
6666```
6767
6868</details >
6969
70- ---
70+ ## Checking Properties Order
71+
72+ To further extend control over coding style of your stylesheets, we are also
73+ checking for properties order.
74+
75+ The ` order ` config enforces a consistent order of content in your declaration blocks:
76+
77+ 1 . Sass variables,
78+ 2 . CSS custom properties,
79+ 3 . Sass ` @extend ` ,
80+ 4 . single-line Sass ` @include ` ,
81+ 5 . declarations,
82+ 6 . nested rules,
83+
84+ For better flexibility, block at-rules (like ` @media ` , ` @supports ` , and also Sass ` @if ` , ` @each ` , etc.) can be placed
85+ anywhere in the declaration block.
86+
87+ Besides, properties in the declarations must be ordered by following categories:
88+
89+ 1 . ` all ` properties,
90+ 2 . ` content ` ,
91+ 3 . position,
92+ 4 . ` appearance ` ,
93+ 5 . box model,
94+ 6 . typography,
95+ 7 . decorations,
96+ 8 . effects and transforms,
97+ 9 . interactions,
98+ 10 . transitions and animations.
99+
100+ 👉 To see the order of individual properties this config prescribes, please read
101+ the [ ` order ` config itself] ( ./rules/order.js ) .
102+
103+ ## Stylistic Rules
104+
105+ Stylistic rules (like indentation etc.) [ were dropped] [ stylelint-v16-stylistic-rules ]
106+ in Stylelint v16. To enforce them, you can use
107+ [ ` stylelint-prettier ` ] [ stylelint-prettier ] :
108+
109+ ``` json
110+ // `.stylelintrc`
111+ {
112+ "plugins" : [" stylelint-prettier" ],
113+ "rules" : {
114+ "prettier/prettier" : true
115+ }
116+ }
117+ ```
118+
119+ ## FAQ
120+
121+ <details >
122+ <summary >How do I change the indentation?</summary >
123+ ### With Prettier
124+
125+ If using Prettier, you can configure the indentation in your Prettier config:
126+
127+ ``` json
128+ {
129+ "tabWidth" : 2
130+ }
131+ ```
132+
133+ Or in your [ ` .editorconfig ` ] [ editorconfig ] :
134+
135+ ``` ini
136+ [*]
137+ indent_size = 2
138+ ```
139+
140+ 👉 See [ Prettier] [ prettier ] documentation for more options.
141+
142+ </details >
143+
144+ [ prettier ] : https://prettier.io
145+ [ stylelint-v16-stylistic-rules ] : https://stylelint.io/migration-guide/to-16/#removed-deprecated-stylistic-rules
146+ [ stylelint-prettier ] : https://github.com/prettier/stylelint-prettier
0 commit comments