Skip to content

Commit 2c31a36

Browse files
committed
styles: format and lint CSS files using Stylelint
Use stylelint with stylelint-config-wikimedia, specifically the support-modern preset which targets grade A browsers. This is in preparation for #2300 which will introduce some involved CSS. Rule customisations used: * @stylistic/*-space-inside: "never", per repo code style of not putting spaces in parens * selector-attribute-quotes: "never". * selector-max-id: 1. MediaWiki uses 0 which disallows ids in selectors completely! That would lead to a lot of errors for us. * declaration-no-important: null. Disabled temporarily. Ideally, we should remove this. All CSS changes are no-op (mostly done via auto-fixes,) mainly: * Changed hex codes to use lowercase letters instead of uppercase * Consistently used tabs * Consistently put opening brace on same line as the selector * Combined the two blocks for .morebits-ui-tooltip in morebits.css * prefers-color-scheme: dark isn't supported in Safari 11 which still happens to be Grade A, so used a per-line stylelint-disable. In practise, Safari 11 isn't much used, and per CSS spec unsupported rules and media queries are just ignored - they don't cause the stylesheet to fail. * stylelint-config-wikimedia disallows px unit in font-size and line-height for accessibility reasons, which is probably something we should also fix. Temporarily disabled inline as fixes won't be no-op. * stylelint-config-wikimedia disallows `border: none`. Replaced it with `border: 0` which has the same effect.
1 parent 46bfd7a commit 2c31a36

File tree

5 files changed

+2551
-342
lines changed

5 files changed

+2551
-342
lines changed

.stylelintrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"extends": [
3+
"stylelint-config-wikimedia/support-modern"
4+
],
5+
"rules": {
6+
"@stylistic/function-parentheses-space-inside": "never",
7+
"@stylistic/media-feature-parentheses-space-inside": "never",
8+
"@stylistic/selector-attribute-brackets-space-inside": "never",
9+
"@stylistic/selector-pseudo-class-parentheses-space-inside": "never",
10+
"selector-attribute-quotes": "never",
11+
"selector-max-id": 1,
12+
"declaration-no-important": null
13+
}
14+
}

0 commit comments

Comments
 (0)