Strict shareable Stylelint configuration with reasonable defaults.
✔️ 200+ configured rules of Stylelint and its plugins;
✔️ 70+ extra rules for SCSS;
✔️ Consistent order of properties and rules according to BEM methodology.
yarn add stylelint @morev/stylelint-config --dev
npm install -D stylelint @morev/stylelint-config
pnpm add -d stylelint @morev/stylelint-config
Create a Stylelint configuration file
(.stylelintrc.js
for the following instruction) in the package root with the following content:
Note: the following instruction assumes that the package is written in ESM.
For projects written in CommonJS (that doesn't have
"type": "module"
within itspackage.json
) you need to specify.cjs
extension for configuration file and usemodule.exports
instead ofexport default
.Alternatively you can use a configuration file defined in YAML or JSON format, but it's less extensible.
/** @type {import('stylelint').Config} */
export default {
extends: [
'@morev/stylelint-config',
],
rules: {},
}
/** @type {import('stylelint').Config} */
export default {
extends: [
'@morev/stylelint-config/css',
],
rules: {},
}
/** @type {import('stylelint').Config} */
export default {
overrides: [
{ files: ['*.css'], extends: ['@morev/stylelint-config/css'] }
{ files: ['*.scss'], extends: ['@morev/stylelint-config/scss'] }
]
}