linting: Start enforcing a basic CSS class naming rule (with lots of opt-outs)
authorJames D. Forrester <jforrester@wikimedia.org>
Fri, 12 Apr 2019 17:12:42 +0000 (10:12 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Fri, 12 Apr 2019 17:18:45 +0000 (10:18 -0700)
Wow, so many opt-outs, and a lot of probably-not-going-to-change ones.

Actually wanted pattern:
* "^mw-…"

Content-related classes we're probably not going to scrap:
* "^wikitable$"

Hard-to-change classes used in lots of skins:
* "^toc$"
* "^toctoggle$"
* "^tochidden$"

Necessary for over-rides/specificity battles:
* "^oo-ui-…"

Probably worth considering changing soon:
* "^client-js$"
* "^client-nojs$"

Some of the exemptions have been applied to deprecated styles (where they're being
renamed); some are for code in entirely deprecated areas themselves; some have the
"wrong" name but sit alongside classes with an appropriate one. And some are, very
clearly, in the wrong repo. Such sigh.

Change-Id: I9b8423d53b6750b5ca79d2f69e111f75c93c5bdc

56 files changed:
.stylelintrc.json
mw-config/config-cc.css
mw-config/config.css
resources/src/jquery.tablesorter.styles/jquery.tablesorter.styles.less
resources/src/jquery.tipsy/jquery.tipsy.css
resources/src/jquery/jquery.confirmable.css
resources/src/jquery/jquery.suggestions.css
resources/src/mediawiki.action/mediawiki.action.edit.collapsibleFooter.css
resources/src/mediawiki.action/mediawiki.action.edit.styles.less
resources/src/mediawiki.action/mediawiki.action.history.css
resources/src/mediawiki.action/mediawiki.action.history.styles.less
resources/src/mediawiki.action/mediawiki.action.view.categoryPage.less
resources/src/mediawiki.action/mediawiki.action.view.filepage.css
resources/src/mediawiki.action/mediawiki.action.view.metadata.css
resources/src/mediawiki.action/mediawiki.action.view.postEdit.less
resources/src/mediawiki.action/mediawiki.action.view.postEdit.monobook.css
resources/src/mediawiki.action/mediawiki.action.view.redirectPage.css
resources/src/mediawiki.apihelp.css
resources/src/mediawiki.apipretty.css
resources/src/mediawiki.content.json.less
resources/src/mediawiki.debug/debug.less
resources/src/mediawiki.diff.styles/diff.css
resources/src/mediawiki.diff.styles/print.css
resources/src/mediawiki.feedlink/feedlink.css
resources/src/mediawiki.filewarning/filewarning.less
resources/src/mediawiki.hlist/default.css
resources/src/mediawiki.hlist/hlist.less
resources/src/mediawiki.htmlform.ooui.styles.less
resources/src/mediawiki.interface.helpers.styles.less
resources/src/mediawiki.legacy/commonPrint.css
resources/src/mediawiki.legacy/oldshared.css
resources/src/mediawiki.legacy/shared.css
resources/src/mediawiki.page.gallery.styles/gallery.css
resources/src/mediawiki.page.gallery.styles/print.css
resources/src/mediawiki.pager.tablePager/TablePager.less
resources/src/mediawiki.rcfilters/styles/mw.rcfilters.less
resources/src/mediawiki.searchSuggest/searchSuggest.css
resources/src/mediawiki.skinning/content.css
resources/src/mediawiki.skinning/content.externallinks.less
resources/src/mediawiki.skinning/content.parsoid.less
resources/src/mediawiki.skinning/elements.css
resources/src/mediawiki.skinning/interface.css
resources/src/mediawiki.special.apisandbox/apisandbox.css
resources/src/mediawiki.special.changeslist.enhanced.less
resources/src/mediawiki.special.search.interwikiwidget.styles.less
resources/src/mediawiki.special.search.styles.css
resources/src/mediawiki.special.userlogin.common.styles/userlogin.css
resources/src/mediawiki.special.userlogin.signup.styles/signup.css
resources/src/mediawiki.special/movePage.css
resources/src/mediawiki.special/pagesWithProp.css
resources/src/mediawiki.special/special.less
resources/src/mediawiki.toc.styles/common.css
resources/src/mediawiki.toc.styles/print.css
resources/src/mediawiki.toc.styles/screen.less
resources/src/mediawiki.ui/components/buttons.less
resources/src/mediawiki.ui/components/forms.less

index 60c8f36..43f499b 100644 (file)
@@ -1,8 +1,8 @@
 {
        "extends": "stylelint-config-wikimedia",
        "rules": {
+               "selector-class-pattern": "^((mw|oo-ui)-|(wikitable|(toc(|toggle|hidden))|client-(no)?js)$)",
                "no-descending-specificity": null,
-
                "selector-max-id": null
        }
 }
index 511cd03..81cb92d 100644 (file)
@@ -2,6 +2,8 @@
  * Copy of CC standard stylesheet, plus tweaks for iframe usage
  */
 
+/* stylelint-disable selector-class-pattern */
+
 body {
        margin: 0;
        background: #eee;
index 1b2574d..8b3b39e 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 .env-check {
        font-size: 90%;
        margin: 1em 0 1em 2.5em;
index c941da0..7ff7c11 100644 (file)
@@ -1,5 +1,7 @@
 @import 'mediawiki.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 /* Table Sorting */
 
 .client-js .sortable:not( .jquery-tablesorter ) > thead > :last-of-type > th:not( .unsortable ),
index ea60702..c239a8f 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 .tipsy {
        padding: 5px;
        position: absolute;
index 78c4c04..ac68b7a 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 .jquery-confirmable-button {
        /* Automatically flipped */
        margin-left: 1ex;
index 825c7ca..7c6d032 100644 (file)
@@ -1,5 +1,7 @@
 /* suggestions plugin */
 
+/* stylelint-disable selector-class-pattern */
+
 .suggestions {
        overflow: hidden;
        position: absolute;
index b5a9665..b8c3a44 100644 (file)
@@ -12,6 +12,7 @@
 
 /* Show/hide animation is incorrect if the table has a margin set. Extra
  * ".wikitable" is needed in the selector for CSS specificity. */
+/* stylelint-disable-next-line selector-class-pattern */
 .wikitable.preview-limit-report {
        margin: 0;
 }
index 1367426..fc806c6 100644 (file)
@@ -2,6 +2,8 @@
  * Styles for elements of the editing form.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /*
  * Add a bit of margin space between the preview and the toolbar.
  * This replaces the ugly <p><br /></p> we used to insert into the page source
index 520917a..5425990 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 /* Styles for the JavaScript enhancements of the history page */
 
 #pagehistory li.before input[ name='oldid' ],
index af91818..1265637 100644 (file)
@@ -2,6 +2,8 @@
  * Basic styles for the edit revision history page 'HistoryAction.php'
  */
 
+/* stylelint-disable selector-class-pattern */
+
 // Trigger only when collapsible & JS is available via `.mw-collapsed`.
 #mw-history-search.mw-collapsed .oo-ui-fieldsetLayout-header .oo-ui-labelElement-label {
        margin-bottom: 0;
index abdee12..274b3d3 100644 (file)
@@ -16,6 +16,7 @@
        }
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .redirect-in-category {
        font-style: italic;
 }
index b643d76..b8d4e70 100644 (file)
@@ -2,6 +2,8 @@
  * File description page
  */
 
+/* stylelint-disable selector-class-pattern */
+
 .mw-filepage-resolutioninfo {
        font-size: smaller;
 }
index f21b111..dad3238 100644 (file)
@@ -13,6 +13,7 @@
 }
 
 @media print {
+       /* stylelint-disable-next-line selector-class-pattern */
        .mw_metadata .mw-metadata-show-hide-extended {
                display: none;
        }
index 46976d4..c40b1c3 100644 (file)
@@ -1,5 +1,7 @@
 @import 'mediawiki.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 .postedit-container {
        margin: 0 auto;
        position: fixed;
index dccbacc..b5eaf8e 100644 (file)
@@ -2,6 +2,8 @@
  * Display neat icons on redirect pages.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* Hide, but keep accessible for screen-readers. */
 .redirectMsg p {
        overflow: hidden;
index 7528fdb..d1f32ab 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 .apihelp-header {
        clear: both;
        margin-bottom: 0.1em;
index 99e4569..3e921f4 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 .mw-special-ApiHelp h1.firstHeading {
        display: none;
 }
index e084ab8..ca950d5 100644 (file)
@@ -18,6 +18,7 @@
        padding: 0.5em 1em;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .mw-json .value,
 .mw-json-single-value {
        background-color: #dcfae3;
index a56e459..272e7e0 100644 (file)
                        border-bottom: 1px solid #eee;
                        word-wrap: break-word;
 
+                       /* stylelint-disable-next-line selector-class-pattern */
                        &.nr {
                                text-align: right;
                        }
 
+                       /* stylelint-disable-next-line selector-class-pattern */
                        span.stats {
                                color: #727272;
                        }
@@ -78,6 +80,7 @@
                cursor: pointer;
        }
 
+       /* stylelint-disable-next-line selector-class-pattern */
        &.current {
                background-color: #dedede;
        }
index 2053843..6382ac8 100644 (file)
@@ -2,6 +2,8 @@
  * Diff rendering
  */
 
+/* stylelint-disable selector-class-pattern */
+
 .diff {
        border: 0;
        border-spacing: 4px;
index 76b5c9b..159e7ae 100644 (file)
@@ -1,3 +1,4 @@
+/* stylelint-disable selector-class-pattern */
 /*!
  * Diff rendering
  */
index 37808d5..13d0ba1 100644 (file)
@@ -1,5 +1,6 @@
 /* Styles for links to RSS/Atom feeds in sidebar */
 
+/* stylelint-disable-next-line selector-class-pattern */
 a.feedlink {
        /* SVG support using a transparent gradient to guarantee cross-browser
         * compatibility (browsers able to understand gradient syntax support also SVG).
index bf9634f..a608437 100644 (file)
@@ -1,5 +1,7 @@
 @import 'mediawiki.ui/variables';
 
+/* stylelint-disable selector-class-pattern */
+
 // Increase the area of the button, so that the user can move the mouse cursor
 // to the popup without the popup disappearing. (T157544)
 .mediawiki-filewarning-anchor {
index e25a92f..d9612a8 100644 (file)
@@ -2,6 +2,9 @@
  * Stylesheet for mediawiki.hlist module
  * @author [[User:Edokter]]
  */
+
+/* stylelint-disable selector-class-pattern */
+
 /* Generate interpuncts */
 .hlist dt:after {
        content: ':';
index d7071e4..5bc6a68 100644 (file)
@@ -1,3 +1,4 @@
+/* stylelint-disable-next-line selector-class-pattern */
 .hlist {
        dl,
        ol,
index ecf728b..f356fa2 100644 (file)
@@ -1,5 +1,7 @@
 @import 'mediawiki.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 // OOUIHTMLForm styles
 @ooui-font-size-browser: 16; // assumed browser default of `16px`
 @ooui-font-size-base: 0.875em; // equals `14px` at browser default of `16px`
index cfabab6..a0e9f15 100644 (file)
@@ -8,6 +8,7 @@
        content: '. .';
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .comment--without-parentheses,
 .mw-changeslist-links,
 .mw-diff-bytes,
index c21b254..e58e677 100644 (file)
@@ -6,6 +6,8 @@
  * Copyright Alexander Limi
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /**
  * Hide all the elements irrelevant for printing
  * Skins however can and should override.
index caaebad..92c0207 100644 (file)
@@ -4,6 +4,8 @@
  * CologneBlue, the old pre-Monobook skins
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* For clarity, explicitly state some recommendations from
  * https://www.w3.org/TR/CSS21/sample.html to make sure the editsection links scale right
  */
index a63c5c6..baf2c56 100644 (file)
@@ -9,6 +9,8 @@
  * blocking CSS common to all pages.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* GENERAL CLASSES FOR DIRECTIONALITY SUPPORT */
 
 /**
index 6a331b6..b7a424f 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 /* Galleries */
 /* These display attributes look nonsensical, but are needed to support IE and FF2 */
 /* Don't forget to update gallery.print.css */
index f7a3f0d..2b596ab 100644 (file)
@@ -1,3 +1,4 @@
+/* stylelint-disable selector-class-pattern */
 li.gallerybox {
        vertical-align: top;
        display: inline-block;
index 1cccb88..4c82192 100644 (file)
@@ -3,6 +3,8 @@
  * in MediaWiki (used e.g. on Special:ListFiles).
  */
 
+/* stylelint-disable selector-class-pattern */
+
 @import 'mediawiki.mixins';
 
 // TablePager uses `.mw-datatable` and is loaded in the right order by RL
index 689f322..bc558a5 100644 (file)
@@ -2,6 +2,8 @@
 @import 'mediawiki.ui/variables';
 @import 'mw.rcfilters.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 @rcfilters-spinner-size: 12px;
 @rcfilters-head-min-height: 210px;
 @rcfilters-head-margin-bottom: 20px;
index 8d56906..3907329 100644 (file)
@@ -1,3 +1,5 @@
+/* stylelint-disable selector-class-pattern */
+
 /* Make sure the links are not underlined or colored, ever. */
 /* There is already a :focus / :hover indication on the <div>. */
 .suggestions a.mw-searchSuggest-link,
index 3104a69..054bc27 100644 (file)
@@ -5,6 +5,8 @@
  * (ie: the CSS classing built into the system), like the TOC.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* Table of Contents */
 .toc,
 .mw-warning,
index c6390c0..b01c518 100644 (file)
@@ -2,6 +2,8 @@
  * Icons and colors for external links.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 @import 'mediawiki.mixins';
 
 .mw-parser-output a.external,
index 8b2657d..51018f7 100644 (file)
@@ -2,6 +2,8 @@
  * Style Parsoid HTML+RDFa output consistent with wikitext from PHP parser.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /*
  * Auto-numbered external links
  * Parsoid renders those as link without content, and lets CSS do the
index a33595c..fed8235 100644 (file)
@@ -6,6 +6,8 @@
  * This style sheet is used by the Monobook and Vector skins.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* Links */
 a {
        text-decoration: none;
index e9a2b08..c559048 100644 (file)
@@ -6,6 +6,8 @@
  * they are outputted by the actual MonoBook/Vector code by convention.
  */
 
+/* stylelint-disable selector-class-pattern */
+
 /* Categories */
 .catlinks {
        border: 1px solid #a2a9b1;
index d7415c9..c071199 100644 (file)
        min-width: 6em;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .apihelp-deprecated {
        font-weight: bold;
        color: #d33;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .apihelp-deprecated-value .oo-ui-labelElement-label {
        text-decoration: line-through;
 }
index d7923f4..f0b6913 100644 (file)
@@ -28,6 +28,7 @@ td.mw-enhanced-rc {
 }
 
 /* Show/hide arrows in enhanced changeslist */
+/* stylelint-disable-next-line selector-class-pattern */
 .mw-enhanced-rc .collapsible-expander {
        float: none;
 }
@@ -53,6 +54,7 @@ td.mw-enhanced-rc {
        font-weight: bold;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 span.changedby {
        font-size: 95%;
 }
index 81c8dc9..5f99f82 100644 (file)
@@ -4,6 +4,8 @@
 @import 'mediawiki.ui/variables.less';
 @import 'mediawiki.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 .mw-searchresults-has-iw {
        .iw-headline {
                font-weight: bold;
index 0f27420..dcb51fa 100644 (file)
@@ -1,5 +1,7 @@
 /* Special:Search */
 
+/* stylelint-disable selector-class-pattern */
+
 /*
  * Fixes sister projects box moving down the extract
  * of the first result (T18886).
index 2366249..9f27150 100644 (file)
@@ -39,6 +39,8 @@ section.mw-form-header {
        margin-top: 6px;
 }
 
+/* FIXME: These should be namespaced to mw-ext-confirmedit-fancycaptcha-, and really shouldn't be in core at all */
+/* stylelint-disable-next-line selector-class-pattern */
 .fancycaptcha-captcha-container {
        background-color: #f8f9fa;
        margin-bottom: 15px;
@@ -54,6 +56,7 @@ section.mw-form-header {
 }
 
 /* Put a border around the fancycaptcha-image-container. */
+/* stylelint-disable-next-line selector-class-pattern */
 .fancycaptcha-captcha-and-reload {
        border: 1px solid #c8ccd1;
        border-radius: 2px 2px 0 0;
@@ -63,6 +66,7 @@ section.mw-form-header {
        background-color: #fff;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .fancycaptcha-captcha-container .mw-ui-input {
        margin-top: -1px;
        border-color: #c8ccd1;
@@ -70,6 +74,7 @@ section.mw-form-header {
 }
 
 /* Make the fancycaptcha-image-container full-width within its parent. */
+/* stylelint-disable-next-line selector-class-pattern */
 .fancycaptcha-image-container {
        width: 100%;
 }
index 3cfa5a8..d8b773c 100644 (file)
        margin-bottom: 30px;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .mw-number-text.icon-edits {
        /* @embed */
        background: url( images/icon-edits.png ) no-repeat left center;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .mw-number-text.icon-pages {
        /* @embed */
        background: url( images/icon-pages.png ) no-repeat left center;
 }
 
+/* stylelint-disable-next-line selector-class-pattern */
 .mw-number-text.icon-contributors {
        /* @embed */
        background: url( images/icon-contributors.png ) no-repeat left center;
index 9428fed..25113ea 100644 (file)
@@ -2,6 +2,7 @@
  * Styles for Special:MovePage
  */
 
+/* stylelint-disable-next-line selector-class-pattern */
 .movepage-wrapper {
        width: 50em;
 }
index 7240bd4..b0cc932 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 /* Distinguish actual data from information about it being hidden visually. */
+/* stylelint-disable-next-line selector-class-pattern */
 .prop-value-hidden {
        font-style: italic;
 }
index 3798f1e..3f76cf0 100644 (file)
@@ -3,6 +3,8 @@
  */
 @import 'mediawiki.mixins';
 
+/* stylelint-disable selector-class-pattern */
+
 /* Special:AllMessages */
 /* Visually hide repeating text, but leave in for better form navigation on screen readers */
 .mw-special-Allmessages .mw-htmlform-ooui .oo-ui-fieldsetLayout:first-child .oo-ui-fieldsetLayout-header {
index 31a8826..d89cc2a 100644 (file)
@@ -1,6 +1,7 @@
 /* This style is loaded on all media. */
 
 /* Hide the content of the TOC when the checkbox is checked. */
+/* stylelint-disable-next-line selector-class-pattern */
 .toctogglecheckbox:checked ~ ul {
        display: none;
 }
index e905dbe..2081d35 100644 (file)
@@ -1,4 +1,5 @@
 /* Hide the complete TOC on print when the TOC is hidden. */
+/* stylelint-disable-next-line selector-class-pattern */
 .toctogglecheckbox:checked + .toctitle {
        display: none;
 }
index ff41b5e..7d7727c 100644 (file)
@@ -1,5 +1,7 @@
 /* This style adds a toggle button with internationalized message for the TOC. */
 
+/* stylelint-disable selector-class-pattern */
+
 /* When the browser supports :checked then overwrite the style="display:none" and make the */
 /* checkbox invisible on another way to allow to focus the checkbox with keyboard. */
 :not( :checked ) > .toctogglecheckbox {
index 3490ebc..a85ecd7 100644 (file)
@@ -1,6 +1,8 @@
 @import 'mediawiki.mixins';
 @import 'mediawiki.ui/variables';
 
+/* stylelint-disable selector-class-pattern */
+
 // Buttons
 // Helper mixins
 // Primary buttons mixin
index 5fa8e5a..d08fff5 100644 (file)
@@ -3,6 +3,8 @@
 @import 'mediawiki.mixins';
 @import 'mediawiki.ui/variables';
 
+/* stylelint-disable selector-class-pattern */
+
 // --------------------------------------------------------------------------
 // Layouts
 // --------------------------------------------------------------------------