Add stylelint for css and less files

Fixed the following rules:
- number-leading-zero
- length-zero-no-unit
- string-quotes
- max-empty-lines
- selector-pseudo-element-colon-notation
- at-rule-empty-line-before
- at-rule-name-space-after
- media-feature-parentheses-space-inside
- color-hex-case
- declaration-block-semicolon-space-bef
- declaration-property-value-blacklist

Change-Id: Id0b43bff22b3f9ae9b912bd886e2da4c8576b165
isekai
Umherirrender 8 years ago
parent 7af591fd4a
commit 77ff62c02c

@ -0,0 +1,9 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"no-duplicate-selectors": null,
"selector-no-id": null,
"declaration-no-important": null,
"no-descending-specificity": null
}
}

@ -3,6 +3,7 @@ module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-contrib-jshint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
jshint: {
@ -18,12 +19,21 @@ module.exports = function ( grunt ) {
jsonlint: {
all: [
'**/*.json',
'.stylelintrc',
'!node_modules/**',
'!vendor/**'
]
},
stylelint: {
all: [
'**/*.css',
'**/*.less',
'!resources/libraries/**',
'!node_modules/**'
]
}
} );
grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'test', [ 'jshint', 'jsonlint', 'banana', 'stylelint' ] );
grunt.registerTask( 'default', 'test' );
};

@ -8,6 +8,8 @@
"grunt-cli": "0.1.13",
"grunt-contrib-jshint": "0.11.3",
"grunt-banana-checker": "0.4.0",
"grunt-jsonlint": "1.0.7"
"grunt-jsonlint": "1.0.7",
"grunt-stylelint": "0.7.0",
"stylelint-config-wikimedia": "0.4.1"
}
}

@ -1,4 +1,4 @@
@import "../variables.less";
@import '../variables.less';
/* Handle and position Echo icons */
@ -12,7 +12,7 @@
}
#personal-extra {
// Position and keep it from randomly overflowing massively for no apparent reason
margin: .7em 0 -2em 0;
margin: 0.7em 0 -2em 0;
ul {
list-style: none;
@ -20,9 +20,10 @@
padding: 0;
}
li {
margin: 0 .75em 0 0;
margin: 0 0.75em 0 0;
}
}
@media ( min-width: @desktop-small-floor ) {
#personal-extra {
float: left;
@ -67,7 +68,7 @@
}
#personal-extra {
position: absolute;
top: .9em;
top: 0.9em;
right: 11.75em;
li {

@ -1,4 +1,4 @@
@import "../variables.less";
@import '../variables.less';
@media screen {
.client-js {

@ -1,8 +1,8 @@
@import "../variables.less";
@import '../variables.less';
@media screen {
.ve-ui-toolbar {
margin: -.8em -2em 0;
margin: -0.8em -2em 0;
}
// Still need a way to make it show up right away (instead of initially disappearin under the page header)
@ -23,9 +23,10 @@
@media ( min-width: @desktop-small-floor ) and ( max-width: @desktop-small-width ) {
.ve-ui-toolbar {
margin-top: -.5em;
margin-top: -0.5em;
}
}
@media ( max-width: @mobile-width ) {
.ve-ui-toolbar-floating > .oo-ui-toolbar-bar {
top: 0;

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
/*
* PREFERENCES AND FIELDSET STUFF
@ -25,7 +25,7 @@
min-height: 400px;
.prefsection {
border: none;
border: 0;
padding: 0;
margin: 0;
box-shadow: none;
@ -40,10 +40,10 @@
.mw-email-not-authenticated .mw-input,
.mw-email-none .mw-input {
display: block;
padding: .25em .5em;
padding: 0.25em 0.5em;
}
input[type="checkbox"],
input[type="radio"] {
input[type='checkbox'],
input[type='radio'] {
margin-left: 0;
}
}
@ -63,21 +63,21 @@ fieldset {
background: @background;
legend {
padding: .5em 1.25em;
padding: 0.5em 1.25em;
background: @background;
font-weight: bold;
color: @blue-dark;
}
}
label {
padding-left: .5em;
padding-left: 0.5em;
}
.mw-input label {
padding: 0;
margin-right: 1em;
}
.mw-label {
padding-right: .5em;
padding-right: 0.5em;
}
.mw-submit {
padding-top: 2em;
@ -97,13 +97,13 @@ label {
/* pile of bad hacks to try to catch all the different ones */
#searchInput,
input[name="target"],
input[name="user"],
input[name="mime"],
input[size$="0"],
input[type="text"],
input[type="checkbox"],
input[type="radio"],
input[name='target'],
input[name='user'],
input[name='mime'],
input[size$='0'],
input[type='text'],
input[type='checkbox'],
input[type='radio'],
input#wpTemplateSandboxPage,
input.mw-summary,
input.mw-input,
@ -112,36 +112,36 @@ textarea,
.mw-ui-input-inline,
.mw-ui-input {
box-sizing: border-box;
padding: .25em .35em;
padding: 0.25em 0.35em;
border: solid 1px @grey;
margin: .5em 0;
margin: 0.5em 0;
box-shadow: inset 0 1px 1px 1px rgba( 0, 0, 0, 0.05 );
font-size: 1em;
min-height: 30px;
font-family: @fonts;
}
select {
padding: .25em;
margin: .5em 0;
padding: 0.25em;
margin: 0.5em 0;
}
input[type="checkbox"],
input[type="radio"] {
input[type='checkbox'],
input[type='radio'] {
margin-left: 1em;
min-height: 0;
}
input[type="checkbox"] {
input[type='checkbox'] {
border-radius: 2px;
}
input[type="radio"] {
input[type='radio'] {
border-radius: 8px;
}
.mw-ui-button.mw-ui-progressive,
.mw-ui-button.mw-ui-progressive:active,
.mw-ui-button.mw-ui-progressive.mw-ui-checked,
input[type="submit"],
input[type="button"],
input[type='submit'],
input[type='button'],
button {
padding: .25em 1em .1em 1em;
padding: 0.25em 1em 0.1em 1em;
border: solid 1px @grey;
border-bottom-width: @border;
text-shadow: 0 -1px 0 @grey;
@ -191,20 +191,19 @@ div.editOptions {
fieldset,
legend {
background: inherit;
border: none;
border: 0;
box-shadow: none;
padding: 0;
margin-top: 2em;
}
}
/* Extension:TemplateSandbox stuff */
.mw-templatesandbox-page label {
padding: 0;
}
#wpTemplateSandboxPreview {
margin-left: .5em;
margin-left: 0.5em;
}
/* Recent changes and watchlist options */
@ -222,7 +221,7 @@ div.editOptions {
label {
padding: 0 1em 0 0;
}
input[type="submit"] {
input[type='submit'] {
margin: 0 0 0 4em;
}
}
@ -230,15 +229,15 @@ div.editOptions {
/* Related changes hacks */
.mw-special-Recentchangeslinked {
.rcoptions {
input[type="submit"] {
input[type='submit'] {
float: right;
margin: 0 0 0 4em;
}
td.mw-label.mw-target-label {
vertical-align: top;
padding-top: .75em;
padding-top: 0.75em;
}
input[name="target"] {
input[name='target'] {
float: left;
}
}
@ -246,8 +245,8 @@ div.editOptions {
clear: left;
float: left;
}
label[for="showlinkedto"] {
padding: .4em;
label[for='showlinkedto'] {
padding: 0.4em;
float: left;
}
}

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
/* Page layout */
@ -32,7 +32,7 @@ div {
}
#mw-footer-container {
border-top: solid 1px @background-dark2;
box-shadow: inset 0 7px 2px -4px rgba(0, 0, 0, .1);
box-shadow: inset 0 7px 2px -4px rgba( 0, 0, 0, 0.1 );
color: @text-inverse;
a {
@ -54,7 +54,7 @@ div {
height: 11em;
background-repeat: no-repeat;
background-position: 50% 50%;
margin: .75em auto 0;
margin: 0.75em auto 0;
}
#p-logo-text {
width: @column-left-size;
@ -62,7 +62,7 @@ div {
line-height: 1;
a {
padding: .2em 1em;
padding: 0.2em 1em;
color: @text;
font-family: @fonts-secondary;
font-variant: small-caps;
@ -72,8 +72,8 @@ div {
/* 13+ character names */
&.long {
font-size: 1.45em;
padding: 0 .75em 0 0;
line-height: .8;
padding: 0 0.75em 0 0;
line-height: 0.8;
}
}
}
@ -87,10 +87,10 @@ div {
border: solid 1px @grey;
}
#searchInput {
border: none;
border: 0;
margin: 0;
height: 2.1em;
padding: .4em 4.5em .2em 2em;
padding: 0.4em 4.5em 0.2em 2em;
box-shadow: none;
background: transparent;
width: 100%;
@ -117,7 +117,7 @@ div {
background-color: @background;
border: 1px solid @grey;
border-bottom-width: @border;
padding: .75em 2em;
padding: 0.75em 2em;
}
.suggestions-results {
background-color: @background;
@ -126,7 +126,7 @@ div {
}
.suggestions-result {
color: @text;
padding: .65em 2em .35em;
padding: 0.65em 2em 0.35em;
}
.suggestions-result-current {
background-color: @blue;
@ -141,11 +141,11 @@ div.suggestions {
/* Dropdown stuff */
.pokey,
.pokey::after {
.pokey:after {
border-bottom: 10px solid @grey-bright;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
content: "";
content: '';
height: 0;
position: absolute;
transform: rotate( 360deg ); // to force some smoothing in annoying browsers
@ -157,8 +157,8 @@ div.suggestions {
right: 1px;
display: none;
}
.pokey::after {
border-bottom-color: #FFFFFF;
.pokey:after {
border-bottom-color: #fff;
right: -10px;
top: 2px;
}
@ -170,7 +170,7 @@ div.suggestions {
/* Footer */
#mw-footer {
padding-top: .5em;
padding-top: 0.5em;
padding-bottom: 1em;
ul,
@ -211,7 +211,7 @@ div.suggestions {
padding: 0;
}
li {
margin: .25em 0 1em;
margin: 0.25em 0 1em;
border-bottom: solid 3px @background;
&:hover {
@ -279,7 +279,7 @@ a.new,
background-repeat: no-repeat;
background-position: 0 0;
display: inline-block;
padding: .5em 0 .25em 1.75em;
padding: 0.5em 0 0.25em 1.75em;
}
}
.mw-editsection-bracket {
@ -290,23 +290,30 @@ a.new,
}
.mw-indicators {
float: right;
margin: .75em 0 0 1em;
margin: 0.75em 0 0 1em;
}
#mw-content {
h1, h2, h3, h4, h5, h6, dt {
h1,
h2,
h3,
h4,
h5,
h6,
dt {
font-weight: normal;
font-family: @fonts-secondary;
line-height: 1.25;
margin: 1.5em 0 .5em;
margin: 1.5em 0 0.5em;
}
h1, h2 {
h1,
h2 {
border-bottom: solid 2px @blue;
}
h1.firstHeading {
margin: .25em 0 .5em;
margin: 0.25em 0 0.5em;
border-bottom: solid 4px @red;
}
@ -343,7 +350,7 @@ hr {
border-width: 1px;
border-color: @grey;
border-style: solid none solid none;
margin: .5em 0;
margin: 0.5em 0;
}
pre {
@ -353,7 +360,7 @@ pre {
}
p {
margin: .9em 0 .8em;
margin: 0.9em 0 0.8em;
}
.center,
@ -364,23 +371,23 @@ p {
/* Thumbnails */
.tright {
margin: 0 0 .5em .5em;
margin: 0 0 0.5em 0.5em;
padding: 0 0 1em 1.5em;
background: #fff;
}
.tleft {
margin: 0 .5em .5em 0;
margin: 0 0.5em 0.5em 0;
padding: 0 1.5em 1em 0;
background: #fff;
}
.thumbinner {
.box;
padding: .75em;
padding: 0.75em;
}
.thumbcaption {
font-size: 95%;
padding: .5em 1em;
padding: 0.5em 1em;
}
.thumbinner img{
border: solid 1px @grey-bright;
@ -392,7 +399,9 @@ p {
/* Tables of contents */
ul#filetoc,
#toc, .toc, .mw-warning {
#toc,
.toc,
.mw-warning {
display: inline-block;
.box;
padding: 1.25em 1.75em;
@ -401,7 +410,7 @@ ul#filetoc,
}
ul#filetoc {
display: block;
border: none;
border: 0;
}
#toc ul,
.toc ul {
@ -419,21 +428,21 @@ ul#filetoc {
color: @background3;
}
#toc li:last-child {
margin-bottom: .5em;
margin-bottom: 0.5em;
}
.toclevel-1 {
margin-bottom: .25em;
margin-bottom: 0.25em;
}
.mw-changeslist-legend,
#mw-content .mw-search-profile-tabs,
#mw-content fieldset#mw-searchoptions,
table.wikitable {
border: none;
border: 0;
color: @text;
.box;
}
#mw-content .mw-search-profile-tabs {
padding: .5em;
padding: 0.5em;
}
table.wikitable > tr > th,
@ -446,7 +455,7 @@ table.wikitable > * > tr > td {
table.wikitable > tr > th,
table.wikitable > * > tr > th {
border: none;
border: 0;
}
/* Color bars */

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
#mw-site-navigation {
.column-left();

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
#mw-site-navigation,
#mw-related-navigation {

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
// Redundant sidebar category list and stuff
@ -12,7 +12,6 @@
.categories-bottom();
// Header navigation
.sidebar-chunk {
@ -39,7 +38,7 @@
font-weight: normal;
font-family: @fonts-secondary;
font-size: 1.25em;
padding: .5em 0 .2em;
padding: 0.5em 0 0.2em;
margin: 0;
.dropdown-header();
@ -111,7 +110,7 @@
display: none;
}
h2:after {
margin-left: -.65em;
margin-left: -0.65em;
}
.dropdown {
right: -1em;

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
// Override menu display from mobile
// This also requires !importants where they hover and stuff
@ -56,7 +56,7 @@
/* Add offset to make anchor links work with the fixed header */
:target:before {
content: "";
content: '';
display: block;
height: @fixed-header-height;
margin: -@fixed-header-height 0 0;
@ -82,7 +82,7 @@
}
h2 {
margin: 0;
padding: .7em 0 0 25px;
padding: 0.7em 0 0 25px;
font-family: @fonts-secondary;
font-weight: normal;
font-size: 1.1em;

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
// Let's add some unnecessary white space. Or grey, as it were. In the dumbest possible way.

@ -1,4 +1,4 @@
@import "variables.less";
@import 'variables.less';
/* Layout */
@ -26,7 +26,7 @@
#mw-header-container {
background: @background;
padding: 3.75em @content-padding .35em;
padding: 3.75em @content-padding 0.35em;
}
#mw-header-hack {
@ -57,13 +57,13 @@
z-index: 100;
h3 {
margin: .5em 0 1.5em;
margin: 0.5em 0 1.5em;
}
ul {
margin: 1em 0 2em;
}
li {
margin: 0 0 .75em;
margin: 0 0 0.75em;
}
}
@ -76,7 +76,7 @@
width: 100%;
height: 100%;
background: @background2;
opacity: .8;
opacity: 0.8;
overflow: hidden;
}
@ -101,12 +101,12 @@
}
&:after {
position: absolute;
top: .65em;
top: 0.65em;
left: 23px;
}
}
#user-tools h2 {
right: @content-padding + .5em;
right: @content-padding + 0.5em;
.background-image-svg( 'images/user-large-grey.svg', 'images/user-large-grey.png' );
}
#site-navigation {
@ -128,7 +128,7 @@
#p-logo-text {
position: absolute;
top: .75em;
top: 0.75em;
left: 6em;
text-align: left;
@ -175,7 +175,7 @@
#ca-more,
#ca-languages {
&:after {
margin-left: -.35em;
margin-left: -0.35em;
}
span {
@ -212,12 +212,12 @@ div.thumb {
}
.thumbimage {
display: block;
margin: 0 auto .5em;
margin: 0 auto 0.5em;
}
#mw-content {
overflow: auto;
border: none;
border: 0;
}
#mw-content-block {
background: @background;
@ -232,7 +232,9 @@ div.thumb {
/* Table of contents */
#toc, .toc, .mw-warning {
#toc,
.toc,
.mw-warning {
width: 100%;
box-sizing: border-box;
}

@ -1,4 +1,4 @@
@import "mediawiki.mixins";
@import 'mediawiki.mixins';
// Colours
@ -33,7 +33,6 @@
@link: @blue;
@link-red: @red;
// Flair
// Fonts are chosen for consistent metrics, not necessarily overall prettiness.
@ -43,10 +42,10 @@
// Based on information on https://wiki.archlinux.org/index.php/Metric-compatible_fonts
@fonts-monospace: 'Consolas', 'Courier', 'Nimbus Mono', 'Liberation Mono', 'Courier New', monospace;
@border: .2em;
@radius: .2em;
@border: 0.2em;
@radius: 0.2em;
@font-size: .95em;
@font-size: 0.95em;
// Widths
@ -69,8 +68,7 @@
@column-right-size: 16em;
@fixed-header-height: 3.125em;
@color-height: .35em;
@color-height: 0.35em;
// Miscellaneous functions
@ -78,13 +76,13 @@
.hidden() {
position: absolute;
top: -9999px;
left: 0px;
left: 0;
}
// Icons - hides labels, but keep them accessible for screen-readers
.icon() {
text-indent: -99999px;
border: none;
border: 0;
background-color: transparent;
background-repeat: no-repeat;
}
@ -105,7 +103,7 @@
width: 20px;
height: 20px;
box-sizing: border-box;
margin-bottom: -.5em;
margin-bottom: -0.5em;
}
// Navigation column blocks
@ -125,15 +123,15 @@
h3 {
font-weight: normal;
font-size: 1em;
margin: .25em 0 .75em 0;
padding-bottom: .15em;
margin: 0.25em 0 0.75em 0;
padding-bottom: 0.15em;
border-bottom: solid 2px @grey;
}
ul {
margin-bottom: 2em;
}
li {
margin: 0 0 .35em;
margin: 0 0 0.35em;
}
}
@ -199,13 +197,13 @@
#catlinks {
margin: 0 @content-padding;
padding: 1.5em 0 .5em;
padding: 1.5em 0 0.5em;
li {
border-left: none;
border-left: 0;
}
div {
margin: 0 0 .35em;
margin: 0 0 0.35em;
}
}
}

Loading…
Cancel
Save