stylelint-config-valantic
v10.1.1
Published
Default valantic configuration for stylelint.
Downloads
1,906
Readme

valantic stylelint configuration
Default valantic configuration for stylelint.
Report an Issue · Request a Feature
About this project
To ensure a high an consistent code quality for SCSS/CSS we use stylelint.
Quickstart
npm install stylelint-config-valantic stylelint --save-devIn the root of your project add a .stylelintrc.js file and add the following content to enable the valantic config for
your project.
module.exports = {
"extends": "stylelint-config-valantic",
"rules": {
// Project related rules
}
}
Version
Our config is currently optimized for Stylelint 13.0.0 To check for updates, see https://github.com/stylelint/stylelint/releases
Note that Stylelint is not backwards compatible and linting will fail if the configuration contains settings, which are not known to the current version!
Create --fix config
It is recommended to have a separate --fix config, that uses some additional rules (e.g. for property order) to hide
non-blocking issues from the user but auto apply them on git hooks.
- Create an additional
.stylelintrc.fix.jsfile
module.exports = {
extends: [
'stylelint-config-valantic/fix',
'./.stylelintrc.js'
],
};NOTE: using --config in the fix command will disable the auto-merging of nested stylelint configurations. It
therefore is recommended to move folder specific conigurations to the overrides section of the base configuration.
module.exports = {
overrides: [
{
files: ['src/styleguide/routes/**/*.*'],
rules: {
'selector-class-pattern': null,
}
}
]
};- Add a
package.jsonscript, if you want to test manually.
{
"stylelint": "stylelint --cache 'src/**/*.?(vue|scss)'",
"stylelint:fix": "npm run stylelint -- --cache=false --config .stylelintrc.fix.js --fix"
}- Assign the
--fixconfig forlint-staged.
{
"lint-staged": {
"*.{css,vue,scss}": [
"stylelint --config .stylelintrc.fix.js --fix"
]
}
}Use
Now you're ready to enable Stylelint in your editor or use it on the command line!
PhpStorm
Go to PhpStorm > Preferences and search for Stylelint or navigate to
Languages & Frameworks > Stylesheets > Stylelint and enable it.
Console
You can also lint your code from the console. To do this, add a script to your package.json.
"scripts": {
"stylelint": "stylelint 'app/**/*.scss' --config .stylelintrc; exit 0"
}Now you can execute the linter with the following command.
$ npm run stylelintKnow issues
Undefined rule
In case you get errors like "Undefined rule ..." you may have a version conflict between Stylelint and this configuration. Make sure you're using the above mentioned Stylelint version.
Contributing
How to contribute and how releases are made is described in CONTRIBUTING.md.
from valantic - with love
Built and maintained by valantic — we're hiring, check out our open positions.
License
Copyright (c) 2017-present, valantic CEC Schweiz AG
