stylelint-config-wikimedia
v0.20.1
Published
Wikimedia shareable config for Stylelint
Readme
stylelint-config-wikimedia
Wikimedia CSS Coding Standards shareable config for stylelint
Configuration rules to ensure your CSS is compliant with the Wikimedia CSS Coding Standards.
Installation
$ npm install -D stylelint-config-wikimediaUsage
Set your stylelint config file, .stylelintrc.json, to:
{
"extends": "stylelint-config-wikimedia"
}If you would also like to enable rules to disallow CSS which is unsupported by modern browsers Grade A or basic supported browsers Grade C browsers, you can use the following configurations instead:
{
"extends": "stylelint-config-wikimedia/support-modern"
}{
"extends": "stylelint-config-wikimedia/support-basic"
}If you are using in a MediaWiki environment, you can add the following config:
{
"extends": [
"stylelint-config-wikimedia",
"stylelint-config-wikimedia/mediawiki"
]
}If you need to combine this with browser support rules:
{
"extends": [
"stylelint-config-wikimedia/support-modern",
"stylelint-config-wikimedia/mediawiki"
]
}Extend or override the configuration
Add a "rules" object to your config file, and add your overrides or additional rules there, for example:
{
"extends": "stylelint-config-wikimedia/support-basic",
"rules": {
"@stylistic/max-empty-lines": null
}
}Class name prefixes
The mediawiki config requires class selectors to start with a known prefix (e.g. ext-, mw-, oo-ui-, cdx-), using the wikimedia/selector-class-prefix rule. To allow extra prefixes on top of these, use the additionalPrefixes option. To disallow one of the core prefixes, use the removePrefixes option. For example, an extension can remove the generic ext prefix and add its own ext-<extensionName> prefix. To allow class names which don't follow the prefix convention, use the additionalPatterns option, which takes a list of regular expressions:
{
"extends": [
"stylelint-config-wikimedia",
"stylelint-config-wikimedia/mediawiki"
],
"rules": {
"wikimedia/selector-class-prefix": [ true, {
"removePrefixes": [ "ext" ],
"additionalPrefixes": [ "ve", "ext-myextension" ],
"additionalPatterns": [ "^client-(no)js$" ]
} ]
}
}Changelog
You can read the changelog for release versions.
License
This is available under the MIT License.
