@almacareer/stylelint-config
v9.1.3
Published
Alma Career's config for Stylelint
Readme
@almacareer/stylelint-config
Alma Career’s config for Stylelint
Usage
# Yarn:
yarn add --dev @almacareer/stylelint-config stylelint-prettier
# npm:
npm install --save-dev @almacareer/stylelint-config stylelint-prettierWe assume you are using Prettier. That’s why we also recommend adding
stylelint-prettierabove.
Configuration extends community maintained config stylelint-config-standard-scss.
This config:
- Extends the
stylelint-config-recommendedshared config and configures its rules for SCSS; - extends the
stylelint-config-recommended-scssshared config and configures its rules for SCSS; - extends the
stylelint-config-standardshared config and configures its rules.
Configuration
@almacareer/stylelint-config
Use this ruleset to configure Stylelint to work with your code.
Recommended Stylelint Configuration
// .stylelintrc.mjs
export default {
extends: ['@almacareer/stylelint-config', 'stylelint-prettier/recommended'],
};{
"extends": ["@almacareer/stylelint-config", "stylelint-prettier/recommended"]
}{
"stylelint": {
"extends": ["@almacareer/stylelint-config", "stylelint-prettier/recommended"]
}
}Checking Properties Order
To further extend control over coding style of your stylesheets, we are also checking for properties order.
The order config enforces a consistent order of content in your declaration blocks:
- Sass variables,
- CSS custom properties,
- Sass
@extend, - single-line Sass
@include, - declarations,
- nested rules,
For better flexibility, block at-rules (like @media, @supports, and also Sass @if, @each, etc.) can be placed
anywhere in the declaration block.
Besides, properties in the declarations must be ordered by following categories:
allproperties,content,- position,
appearance,- box model,
- typography,
- decorations,
- effects and transforms,
- interactions,
- transitions and animations.
👉 To see the order of individual properties this config prescribes, please read
the order config itself.
Stylistic Rules
Stylistic rules (like indentation etc.) were dropped
in Stylelint v16. To enforce them, you can use
stylelint-prettier:
// `.stylelintrc`
{
"plugins": ["stylelint-prettier"],
"rules": {
"prettier/prettier": true
}
}FAQ
If using Prettier, you can configure the indentation in your Prettier config:
{
"tabWidth": 2
}Or in your [.editorconfig][editorconfig]:
[*]
indent_size = 2👉 See Prettier documentation for more options.
