bemlinter.js
A cli tool to lint bem component isolation in SCSS files
The main rules are:
-
A SCSS component should only contain its own classes
-
A SCSS file, even if it is not a component, should not style a class of another component
Quick start
npm i bemlinter.js --save
You can set your package.json
to use bemlinter:
{
"scripts": {
"lint": "bemlinter the/path/to/your/*.scss"
}
}
Configuration file
If you need more configuration you can use a configuration file:
{
"scripts": {
"lint": "bemlinter --config .bemlinter"
}
}
The configuration file is a json file:
sources
To define the paths of your source files
{
"sources": [
"a/path/to/your/scss/*.scss",
"a/path/to/a/specific/scss/main.scss
]
}
excludePath (option)
To define the paths of some exclude source files
default: []
{
"excludePath": [
"an/exclude/path/of/scss/*.scss"
]
}
excludeComponent (option)
To define the names of some component that are not isolated yet, so the linter will be kind ;)
default: []
{
"excludeComponent": [
"messed-up-component",
"disorder-file",
"old-component"
]
}
checkLowerCase (option)
To disable lower case check
default: true
{
"checkLowerCase": false
}
prefix (option)
To set the authorized prefix
default: ['']
{
"prefix": ["c-"]
}
How to Contribute
- Star the project!
- Report a bug that you have found.
- Tweet or blog about sass-test.sh and Let me know about it.
- Pull requests are also highly appreciated.
bemlinter.js is under MIT License.
It was created & is maintained by Thomas ZILLIOX.