From 8d579a821a55d79860f6dc4b7e92f42904f2abc7 Mon Sep 17 00:00:00 2001 From: Volker E Date: Mon, 20 Feb 2017 23:33:57 -0800 Subject: [PATCH] build: Enable indentation stylelint rule Enabling indentation stylelint rule and making it pass. Also making use of mediawiki.mixins' `box-sizing()` mixin in StashedFileWidget and change interwikiwidget rules order slightly (example `:hover` modification after normal selector rule). Change-Id: Ifa9ccae5518d5426b390e0f8321eb3decb211c18 --- .stylelintrc | 2 - ...special.search.interwikiwidget.styles.less | 209 +++++++++--------- .../src/mediawiki.ui/components/inputs.less | 2 +- .../mw.widgets.StashedFileWidget.less | 10 +- resources/src/mediawiki/htmlform/styles.css | 7 +- 5 files changed, 114 insertions(+), 116 deletions(-) diff --git a/.stylelintrc b/.stylelintrc index 5c01b67427..837e0c7943 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -3,8 +3,6 @@ "rules": { "declaration-no-important": null, - "indentation": null, - "no-descending-specificity": null, "no-duplicate-selectors": null, diff --git a/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less b/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less index 7147f04fff..b4629c765e 100644 --- a/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less +++ b/resources/src/mediawiki.special/mediawiki.special.search.interwikiwidget.styles.less @@ -8,28 +8,28 @@ .iw-headline { font-weight: bold; - font-size: 1rem; - font-size: 16px; - opacity: 0.7; + font-size: 1rem; + font-size: 16px; + opacity: 0.7; } .iw-results { - list-style: none; + list-style: none; margin: 0; } .iw-resultset { margin-bottom: 1.2em; background-color: #f2f4f7; - vertical-align: top; - width: 100%; - float: left; - list-style-type: none; + vertical-align: top; + width: 100%; + float: left; + list-style-type: none; } /* clearfix */ .iw-result:after { - visibility: hidden; + visibility: hidden; display: block; font-size: 0; content: " "; @@ -38,10 +38,10 @@ } * html .interwiki-result { /* IE6 */ - zoom: 1; + zoom: 1; } *:first-child + html .iw-resultset { /* IE7 */ - zoom: 1; + zoom: 1; } /* padding each .iw-resultset section seperately. @@ -52,55 +52,55 @@ header and footer. */ .iw-result__title, .iw-result__content, .iw-result__footer { - padding: 0.25em 0.85em; + padding: 0.25em 0.85em; } /* definition titles appear inline, to resemble a traditional dictionary definition */ .iw-resultset--definition .iw-result__title { - display: inline; - padding: 0; + display: inline; + padding: 0; } .iw-resultset > div:first-child { - padding-top: 0.85em; + padding-top: 0.85em; } .iw-resultset > div:last-child { - padding-bottom: 0.85em; + padding-bottom: 0.85em; } .iw-result__title { - font-size: 16px; /* rem fallback */ - font-size: 1rem; + font-size: 16px; /* rem fallback */ + font-size: 1rem; } .iw-result__title a.extiw { - color: #252525; - font-weight: bold; + color: #252525; + font-weight: bold; } .iw-result__content:after { /* clearfix */ - visibility: hidden; - display: block; - font-size: 0; - content: " "; - clear: both; - height: 0; + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; } .iw-result__footer { - float: right; + float: right; } .iw-result__icon { - display: inline-block; - width: 24px; - height: 24px; - vertical-align: middle; - margin-right: 0.25em; - background: url( images/special.search/definition-icon.svg ) no-repeat 0 0; - background-size: 100% 100%; + display: inline-block; + width: 24px; + height: 24px; + vertical-align: middle; + margin-right: 0.25em; + background: url( images/special.search/definition-icon.svg ) no-repeat 0 0; + background-size: 100% 100%; } @interwikiContentTypes: definition, travel, quotation, book, course, news, textbook, image; @@ -108,78 +108,79 @@ to resemble a traditional dictionary definition */ .generate-iwIcons(); .generate-iwIcons( @i:1 ) when ( @i =< length( @interwikiContentTypes ) ) { - @iwIcon: extract( @interwikiContentTypes, @i ); + @iwIcon: extract( @interwikiContentTypes, @i ); - .iw-result__icon--@{iwIcon} { - /* stylelint-disable-next-line function-url-quotes */ - background-image: url( 'images/special.search/@{iwIcon}-icon.png' ); - /* stylelint-disable-next-line function-url-quotes */ - background-image: url( 'images/special.search/@{iwIcon}-icon.svg' ); - } + .iw-result__icon--@{iwIcon} { + /* stylelint-disable-next-line function-url-quotes */ + background-image: url( 'images/special.search/@{iwIcon}-icon.png' ); + /* stylelint-disable-next-line function-url-quotes */ + background-image: url( 'images/special.search/@{iwIcon}-icon.svg' ); + } - .generate-iwIcons( @i + 1 ); + .generate-iwIcons( @i + 1 ); } /* image search result */ .iw-result__mini-gallery { - position: relative; - float: left; - width: 60%; - height: 200px; - box-sizing: border-box; - padding: 0.25rem; + position: relative; + float: left; + width: 60%; + height: 200px; + box-sizing: border-box; + padding: 0.25rem; } -.iw-result__mini-gallery__image { - display: block; - position: relative; - width: 100%; - height: 100%; - background-size: cover; - background-repeat: no-repeat; - background-position: center center; +/* second and third images are small */ +.iw-result__mini-gallery:nth-child( 2 ), +.iw-result__mini-gallery:nth-child( 3 ) { /* stylelint-disable-line indentation */ + width: 40%; + height: 100px; } -.iw-result__mini-gallery__image:hover > .iw-result__mini-gallery__caption { - visibility: visible; +.iw-result__mini-gallery__image { + display: block; + position: relative; + width: 100%; + height: 100%; + background-size: cover; + background-repeat: no-repeat; + background-position: center center; } .iw-result__mini-gallery__image > .iw-result__mini-gallery__caption { /* image gallery text */ - visibility: hidden; - position: absolute; - bottom: 0; - left: 0; - text-align: center; - color: #fff; - text-shadow: 0 0 10px rgba( 0, 0, 0, 0.4 ); /* improves legibility on white background*/ - font-size: 0.8em; - padding: 5px; - background-color: rgba( 0, 0, 0, 0.5 ); + visibility: hidden; + position: absolute; + bottom: 0; + left: 0; + text-align: center; + color: #fff; + text-shadow: 0 0 10px rgba( 0, 0, 0, 0.4 ); /* improves legibility on white background*/ + font-size: 0.8em; + padding: 5px; + background-color: rgba( 0, 0, 0, 0.5 ); } -.iw-result__mini-gallery:nth-child(2), -.iw-result__mini-gallery:nth-child(3) { /* second and third images are small */ - width: 40%; - height: 100px; +.iw-result__mini-gallery__image:hover > .iw-result__mini-gallery__caption { + visibility: visible; } /* different types of interwiki result boxes */ /* quotation box */ .iw-resultset--quotation .iw-result__content { - border-left: 4px solid #afb1b5; - margin-left: 1em; - padding-top: 0; - margin-top: 0.25em; + border-left: 4px solid #afb1b5; + margin-left: 1em; + padding-top: 0; + margin-top: 0.25em; } -.iw-resultset--quotation .iw-result__title{ - margin-left: 1em; +.iw-resultset--quotation .iw-result__title { + margin-left: 1em; } -.iw-result--quotation .iw-result__title:before{ - content: ' — '; - display: inline-block; +.iw-result--quotation .iw-result__title:before { + content: ' — '; + display: inline-block; } .iw-result--quotation .iw-result__footer { - text-align: right; + text-align: right; } /* no results @@ -187,39 +188,39 @@ span the interwiki results across the bottom of the page. */ .mw-search-nonefound ~ #mw-search-interwiki { - width: 100%; + width: 100%; } .mw-search-nonefound ~ #mw-search-interwiki .iw-resultset { - width: 30%; - max-width: 300px; - margin-left: 0.5em; - margin-right: 0.5em; + width: 30%; + max-width: 300px; + margin-left: 0.5em; + margin-right: 0.5em; } /* mobile */ @media only screen and ( max-width: 768px ) { - #mw-interwiki-results { - width: 100%; - } - .mw-search-results { - max-width: none !important; - } - .iw-resultset { - width: 45% !important; - margin-left: 0.5em !important; - margin-right: 0.5em !important; - } + #mw-interwiki-results { + width: 100%; + } + .mw-search-results { + max-width: none !important; + } + .iw-resultset { + width: 45% !important; + margin-left: 0.5em !important; + margin-right: 0.5em !important; + } } @media only screen and ( max-width: 600px ) { - .iw-resultset { - width: 100% !important; - margin-left: 0 !important; - margin-right: 0 !important; - max-width: none !important; - } + .iw-resultset { + width: 100% !important; + margin-left: 0 !important; + margin-right: 0 !important; + max-width: none !important; + } } /* Evil temporary hax for cawiki */ diff --git a/resources/src/mediawiki.ui/components/inputs.less b/resources/src/mediawiki.ui/components/inputs.less index 87ce7bebe1..76500be415 100644 --- a/resources/src/mediawiki.ui/components/inputs.less +++ b/resources/src/mediawiki.ui/components/inputs.less @@ -109,7 +109,7 @@ // Remove the inner padding and cancel buttons in Chrome on OS X and Safari on OS X &::-webkit-search-cancel-button, &::-webkit-search-decoration { - -webkit-appearance: none; + -webkit-appearance: none; } } } diff --git a/resources/src/mediawiki.widgets/mw.widgets.StashedFileWidget.less b/resources/src/mediawiki.widgets/mw.widgets.StashedFileWidget.less index f70c03d1ca..4a59dae2b4 100644 --- a/resources/src/mediawiki.widgets/mw.widgets.StashedFileWidget.less +++ b/resources/src/mediawiki.widgets/mw.widgets.StashedFileWidget.less @@ -1,3 +1,5 @@ +@import 'mediawiki.mixins'; + .mw-widgets-stashedFileWidget { display: inline-block; vertical-align: middle; @@ -28,18 +30,14 @@ vertical-align: middle; position: relative; overflow: hidden; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; + .box-sizing( border-box ); > .mw-widgets-stashedFileWidget-label { line-height: 2.3em; margin: 0; overflow: hidden; white-space: nowrap; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; + .box-sizing( border-box ); text-overflow: ellipsis; left: 0.5em; right: 2.375em; diff --git a/resources/src/mediawiki/htmlform/styles.css b/resources/src/mediawiki/htmlform/styles.css index 1b9d2fb12a..a53e86351c 100644 --- a/resources/src/mediawiki/htmlform/styles.css +++ b/resources/src/mediawiki/htmlform/styles.css @@ -44,9 +44,10 @@ tr.mw-htmlform-vertical-label td.mw-label { margin-left: 4px; } -.mw-icon-question:lang(ar), -.mw-icon-question:lang(fa), -.mw-icon-question:lang(ur) { +/* stylelint-disable indentation */ +.mw-icon-question:lang( ar ), +.mw-icon-question:lang( fa ), +.mw-icon-question:lang( ur ) { -webkit-transform: scaleX( -1 ); -ms-transform: scaleX( -1 ); transform: scaleX( -1 ); -- 2.20.1