@icelandair/stylelint-config
This package provides Icelandair's stylelint as an extensible shared config extending stylelint-config-recommended.
Additionally it provides an optional csscomb config for automatic css/scss formatting.
Installation
Assuming you already have a valid package.json
:
yarn add -D @icelandair/stylelint-config stylelint
or
npm install --save-dev @icelandair/stylelint-config stylelint
Usage
@icelandair/stylelint-config
If you are writing a React application or component your .stylelintrc will look like this:
{
"extends": "@icelandair/stylelint-config"
}
Is is possible to disable or activate additional rules.
Example:
{
"extends": "@icelandair/stylelint-config",
"rules": {
"max-nesting-depth": 4,
}
}
Full list of rules can be found in stylelints user guide.
To exlude files or folders, create a .stylelintignore file next to the stylelintrc. Documentation in the stylelint user guide
Install stylelint extension to atom, vsCode, sublime to get warnings when editing files.
Add a script in your package.json, example:
"lint:styles": "stylelint 'src/**/*.scss' --fix"
@icelandair/stylelint-config/csscomb.json
To utilise the csscomb config for automatic code formatting you will need to add a .csscomb file to the root of your project.
{
"extends": "node_modules/@icelandair/stylelint-config/csscomb.json"
}
Additionally you need to install the csscomb plugin to your editor and activate the format on save
option.