Enable stylelint 'selector-max-id' rule and disable only on occurrence

Enabling 'selector-max-id' rule, and changing in rare exceptions like
`#bodyContent` to `.mw-body > .content` where there's only one less
specific option.

Bug: T239183
Change-Id: I9d929eaae09475b2e20d96cb19081aba3aec5877
This commit is contained in:
Volker E 2019-11-25 21:02:40 -08:00
parent 3bd0a4cfaf
commit 52f37a5f2a
22 changed files with 63 additions and 37 deletions

View file

@ -4,7 +4,6 @@
"declaration-no-important": null,
"property-blacklist": "transition",
"selector-list-comma-newline-after": null,
"selector-max-id": null,
"value-keyword-case": null
}
}

View file

@ -25,14 +25,14 @@
display: none !important;
}
#mw-mf-viewport {
#mw-mf-viewport { // stylelint-disable-line selector-max-id
position: relative;
height: 100%;
}
// We need to ensure the content has the chrome background - otherwise it will
// overlap the menu during the main menu reveal/hide animation
#mw-mf-page-center {
#mw-mf-page-center { // stylelint-disable-line selector-max-id
width: 100%;
min-height: 100%;
position: relative;

View file

@ -22,7 +22,7 @@
opacity: 0.25;
}
#page-actions {
#page-actions { // stylelint-disable-line selector-max-id
position: relative;
}
@ -92,11 +92,11 @@
// On small devices that don't support Javascript, hide the page actions bar
@media all and ( max-width: @width-breakpoint-mobile - 1 ) {
.client-nojs {
#page-actions {
#page-actions { // stylelint-disable-line selector-max-id
display: none;
}
#section_0 {
#section_0 { // stylelint-disable-line selector-max-id
border: 0;
}
}

View file

@ -4,7 +4,9 @@
@dividerHeight: 2px;
@dividerSpacing: 28px;
.hatnote {
// stylelint-disable-next-line selector-max-id
.hatnote,
.pre-content #page-actions {
display: none;
}
@ -26,13 +28,10 @@
.tagline {
font-size: 36px;
}
#page-actions {
display: none;
}
}
#bodyContent {
// Prefer class & direct child selector `.mw-body > .content` over `#bodyContent`.
.mw-body > .content {
padding-top: 55px;
position: relative;
@ -61,8 +60,9 @@
}
}
// Prefer class & direct child selector `.mw-body > .content` over `#bodyContent`.
.thumb:after,
#bodyContent:before {
.mw-body > .content:before {
position: absolute;
left: 0;
content: '';
@ -79,6 +79,7 @@
font-size: 28px;
}
// stylelint-disable selector-max-id
#mw-content-text {
font-size: 36px;
@ -121,3 +122,4 @@
font-size: 30px;
}
}
// stylelint-enable selector-max-id

View file

@ -7,6 +7,7 @@
font-size: 30px;
}
// stylelint-disable selector-max-id
#mw-mf-page-center > footer {
border-top: solid 4px #000;
padding-top: 23px;
@ -54,3 +55,4 @@
}
}
}
// stylelint-enable selector-max-id

View file

@ -31,6 +31,7 @@ main {
}
// FIXME: should we use .mw-body here instead?
// stylelint-disable selector-max-id
#content {
// avoid margin collapsing (see T147956)
border-top: 1px solid transparent;
@ -41,6 +42,7 @@ main {
#content {
background-color: @skinContentBgColor;
}
// stylelint-enable selector-max-id
.header-container {
border-bottom: 1px solid @colorGray12;
@ -53,6 +55,7 @@ main {
}
}
// stylelint-disable-next-line selector-max-id
.navigation-drawer--loading,
// if footer has last modified line hide it (T173545)
#footer-info-lastmod {
@ -132,7 +135,7 @@ main {
}
}
#searchInput {
#searchInput { // stylelint-disable-line selector-max-id
cursor: text;
}
@ -236,6 +239,7 @@ input.search {
}
}
// stylelint-disable selector-max-id
#page-secondary-actions {
// Clears floating on table of contents on stub pages.
clear: both;
@ -279,6 +283,7 @@ input.search {
.post-content {
margin: 0 @contentMargin;
}
// stylelint-enable selector-max-id
// T217197
.minerva__subtitle {

View file

@ -24,6 +24,7 @@ FIXME: Review all of these hacks to see if they still apply.
display: none;
}
// stylelint-disable selector-max-id
/* Hide cleanup templates by default to non-javascript users as these stop them from reading the article itself
* Edit page notices */
.action-edit .fmbox,
@ -35,6 +36,7 @@ FIXME: Review all of these hacks to see if they still apply.
// It's important as some of these are tables which become display: table on larger screens
display: none !important;
}
// stylelint-enable selector-max-id
table {
// A lot of templates introduce floating and horizontal margins inline styles
@ -107,7 +109,7 @@ FIXME: Review all of these hacks to see if they still apply.
}
// FIXME: Remove when filetoc is stripped from file pages a la table of contents (toc)
#filetoc {
#filetoc { // stylelint-disable-line selector-max-id
display: none;
}

View file

@ -6,10 +6,8 @@ A file for css that optimises the Minerva skin on larger devices.
@import '../../../minerva.less/minerva.mixins.less';
@media screen and ( min-width: @width-breakpoint-tablet ) {
.client-js {
#searchIcon {
display: none;
}
.client-js #searchIcon { // stylelint-disable-line selector-max-id
display: none;
}
.header {
@ -27,6 +25,7 @@ A file for css that optimises the Minerva skin on larger devices.
}
}
// stylelint-disable selector-max-id
// FIXME: Have a class that identifies all of these selectors
.pre-content,
/* Form only pages e.g. Special:MobileOptions */
@ -36,6 +35,7 @@ A file for css that optimises the Minerva skin on larger devices.
max-width: @contentMaxWidthTablet;
margin: 0 @contentPaddingTablet;
}
// stylelint-enable selector-max-id
.content {
// Classes added by thumbnails
@ -88,6 +88,7 @@ A file for css that optimises the Minerva skin on larger devices.
}
@media screen and ( min-width: @width-breakpoint-desktop ) {
// stylelint-disable-next-line selector-max-id
.banner-container,
/* FIXME: Generic header class needed me-thinks! */
.header,

View file

@ -3,7 +3,7 @@
@import '../../minerva.less/minerva.variables.less';
@import '../../minerva.less/minerva.mixins.less';
/* stylelint-disable no-descending-specificity */
// stylelint-disable no-descending-specificity, selector-max-id
// .menu
#mw-mf-page-left {

View file

@ -2,9 +2,10 @@
// todo: use .menu (or make a new BEM class). At time of writing, this would require additional
// changes to have sufficient specificity.
// stylelint-disable selector-max-id
#mw-mf-page-left {
ul {
// This is, like, the area for the disclaimare.
// This is, like, the area for the disclaimer.
&.hlist {
li {
background-color: transparent;
@ -30,3 +31,4 @@
}
}
}
// stylelint-enable selector-max-id

View file

@ -1,6 +1,6 @@
@import '../../minerva.less/minerva.variables.less';
/* stylelint-disable no-descending-specificity */
// stylelint-disable no-descending-specificity, selector-max-id
@menuLinkLineHeight: 24px;
@ -74,3 +74,4 @@
}
}
}
// stylelint-enable no-descending-specificity, selector-max-id

View file

@ -1,6 +1,7 @@
@import '../../minerva.less/minerva.variables.less';
@import '../../minerva.less/minerva.mixins.less';
// stylelint-disable selector-max-id
.page-Main_Page {
#section_0 {
border: 0;
@ -18,9 +19,8 @@
}
}
#page-secondary-actions {
a {
margin-top: 1em;
}
#page-secondary-actions a {
margin-top: 1em;
}
}
// stylelint-enable selector-max-id

View file

@ -39,6 +39,7 @@
// Only run on talk pages
.client-js .skin-minerva--talk-simplified {
// stylelint-disable-next-line selector-max-id
.toc,
#mf-section-0,
.section-heading + div {

View file

@ -1,6 +1,7 @@
@import '../../minerva.less/minerva.variables.less';
@import '../../minerva.less/minerva.mixins.less';
// stylelint-disable selector-max-id
/* fancycaptcha reload button */
.confirmedit-captcha-reload,
#mf-captcha-reload-container {
@ -13,6 +14,7 @@
color: @colorProgressive;
}
}
// stylelint-enable selector-max-id
.mw-createacct-captcha-assisted {
display: block;
@ -38,6 +40,7 @@
margin: 0;
}
// stylelint-disable selector-max-id
input:not( [ type='submit' ] ),
img,
#wpCaptchaWord {
@ -48,6 +51,7 @@
border-top: 0;
}
}
// stylelint-enable selector-max-id
// CAPTCHA's are well known by internet users, save the space of the explanation
> p,

View file

@ -10,7 +10,7 @@
display: none;
}
> #wpTextbox1 {
> #wpTextbox1 { // stylelint-disable-line selector-max-id
border: 1px solid @colorGray12;
max-height: 70vh;
}
@ -18,6 +18,7 @@
.action-submit,
.action-edit {
// stylelint-disable selector-max-id
#page-secondary-actions,
#page-actions {
display: none;
@ -76,4 +77,5 @@
text-align: left;
}
}
// stylelint-enable selector-max-id
}

View file

@ -4,7 +4,7 @@
@import 'mediawiki.ui/mixins.buttons.less';
.action-history {
#mw-content-text > form {
#mw-content-text > form { // stylelint-disable-line selector-max-id
margin: 0;
}
@ -14,7 +14,7 @@
// form element wrapping history page content. Overrides #mw-content-text > form
// for tablet widths.
#mw-history-compare {
#mw-history-compare { // stylelint-disable-line selector-max-id
width: 100%;
max-width: 100%;
}
@ -68,6 +68,7 @@
margin-bottom: 1em;
}
// stylelint-disable selector-max-id
#pagehistory {
margin-bottom: 24px;
padding: 0;
@ -172,6 +173,7 @@
margin-left: @revision-selectors-width;
}
}
// stylelint-enable selector-max-id
// hide page instructions
.mw-history-legend,

View file

@ -7,7 +7,7 @@
}
@media all and ( min-width: @width-breakpoint-tablet ) {
#search {
#search { // stylelint-disable-line selector-max-id
display: none;
}
}

View file

@ -1,6 +1,8 @@
@import '../../minerva.less/minerva.variables.less';
@import '../../minerva.less/minerva.mixins.less';
// stylelint-disable selector-max-id
// Hide the texts inside these selectors because they push the login form below the fold
// `#user-button` serves no purpose on the login screen as you are not logged in so cannot use.
#userloginprompt,
@ -155,3 +157,4 @@
margin-top: @margin;
}
}
// stylelint-enable selector-max-id

View file

@ -3,7 +3,7 @@
@media all and ( max-width: @width-breakpoint-tablet ) {
// T233151: Remove post-content margin on mobile diff page drawer
// .post-content margin
#mw-mf-userinfo .post-content {
#mw-mf-userinfo .post-content { // stylelint-disable-line selector-max-id
margin: 0;
}
}

View file

@ -11,7 +11,7 @@ body.navigation-full-screen {
visibility: visible !important;
}
#mw-mf-page-center {
#mw-mf-page-center { // stylelint-disable-line selector-max-id
display: none;
}
}

View file

@ -1,5 +1,6 @@
@import '../../minerva.less/minerva.variables.less';
// stylelint-disable selector-max-id
@media all and ( min-width: @width-breakpoint-tablet ) {
.ns-special .pre-content {
background: #fff;
@ -30,3 +31,4 @@
font-size: 1.2em;
}
}
// stylelint-enable selector-max-id

View file

@ -16,11 +16,9 @@
}
.ns-special {
#content {
#section_0 {
font-size: 1.5em;
font-weight: bold;
}
#content #section_0 { // stylelint-disable-line selector-max-id
font-size: 1.5em;
font-weight: bold;
}
.heading-holder {