Add stylelint and make required style fixes

Change-Id: I8a9def8056a72c3da0c066413e94311a1d839f5b
This commit is contained in:
Ed Sanders 2016-05-17 18:15:13 +01:00
parent a8465a7973
commit bac8dd6be7
10 changed files with 116 additions and 57 deletions

3
.stylelintrc Normal file
View file

@ -0,0 +1,3 @@
{
"extends": "stylelint-config-wikimedia"
}

View file

@ -11,6 +11,7 @@ module.exports = function ( grunt ) {
grunt.loadNpmTasks( 'grunt-jscs' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.initConfig( {
jshint: {
options: {
@ -38,6 +39,23 @@ module.exports = function ( grunt ) {
src: '<%= jshint.all %>'
}
},
stylelint: {
core: {
src: [
'**/*.css',
'!modules/ve-cite/**',
'!node_modules/**'
]
},
've-cite': {
options: {
configFile: 'modules/ve-cite/.stylelintrc'
},
src: [
'modules/ve-cite/**/*.css'
]
}
},
jsonlint: {
all: [
'**/*.json',
@ -46,6 +64,6 @@ module.exports = function ( grunt ) {
}
} );
grunt.registerTask( 'test', [ 'jshint', 'jscs:main', 'jsonlint', 'banana' ] );
grunt.registerTask( 'test', [ 'jshint', 'jscs:main', 'stylelint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};

View file

@ -3,14 +3,16 @@
* and https://en.wikipedia.org/w/index.php?oldid=572888139#Scrolling_past_the_bottom_of_the_page...
*/
.cite-accessibility-label {
position: absolute !important;
/* Workaround a Webkit/Blink bug about positioning within columns as many wikis format references with several columns */
top: -99999px;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
clip: rect( 1px 1px 1px 1px ); /* IE6, IE7 */
clip: rect( 1px, 1px, 1px, 1px );
/* stylelint-disable declaration-no-important */
position: absolute !important;
padding: 0 !important;
border: 0 !important;
height: 1px !important;
width: 1px !important;
/* stylelint-enable declaration-no-important */
overflow: hidden;
}

View file

@ -11,39 +11,41 @@ span.mw-ref {
/* With a group set */
span.mw-ref a[data-mw-group]::after {
content: "[" attr(data-mw-group) " " counter(mw-Ref, decimal) "]"}
content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, decimal ) ']';
}
/* Groups with special appearance */
span.mw-ref a[data-mw-group="decimal"]::after {
content: "[" counter(mw-Ref, decimal) "]";
span.mw-ref a[data-mw-group='decimal']::after {
content: '[' counter( mw-Ref, decimal ) ']';
}
span.mw-ref a[data-mw-group="lower-alpha"]::after {
content: "[" counter(mw-Ref, lower-alpha) "]";
span.mw-ref a[data-mw-group='lower-alpha']::after {
content: '[' counter( mw-Ref, lower-alpha ) ']';
}
span.mw-ref a[data-mw-group="upper-alpha"]::after {
content: "[" counter(mw-Ref, upper-alpha) "]";
span.mw-ref a[data-mw-group='upper-alpha']::after {
content: '[' counter( mw-Ref, upper-alpha ) ']';
}
span.mw-ref a[data-mw-group="lower-greek"]::after {
content: "[" counter(mw-Ref, lower-greek) "]";
span.mw-ref a[data-mw-group='lower-greek']::after {
content: '[' counter( mw-Ref, lower-greek ) ']';
}
span.mw-ref a[data-mw-group="lower-roman"]::after {
content: "[" counter(mw-Ref, lower-roman) "]";
span.mw-ref a[data-mw-group='lower-roman']::after {
content: '[' counter( mw-Ref, lower-roman ) ']';
}
span.mw-ref a[data-mw-group="upper-roman"]::after {
content: "[" counter(mw-Ref, upper-roman) "]";
span.mw-ref a[data-mw-group='upper-roman']::after {
content: '[' counter( mw-Ref, upper-roman ) ']';
}
span.mw-ref a[data-mw-group="error-test"]::after {
content: "[" counter(mw-Ref, symbols(cyclic "first" "second" "last!")) "]";
span.mw-ref a[data-mw-group='error-test']::after {
content: '[' counter( mw-Ref, symbols( cyclic 'first' 'second' 'last!' ) ) ']';
}
/* Without a group */
span.mw-ref a::after {
content: "[" counter(mw-Ref, decimal) "]";
content: '[' counter( mw-Ref, decimal ) ']';
}
/* Hide the default rendering in browsers that support content
* generation by selecting for ::after pseudo-element.*/
x-thereisnoelementwiththisname::after, span.mw-reflink-text {
x-thereisnoelementwiththisname::after,
span.mw-reflink-text {
display: none;
}
@ -56,28 +58,29 @@ ol.mw-references li {
counter-increment: mw-ref-linkback;
}
[rel="mw:referencedBy"] {
[rel='mw:referencedBy'] {
counter-reset: mw-ref-linkback -1;
}
[rel="mw:referencedBy"]::before {
content: "↑ ";
[rel='mw:referencedBy']::before {
content: '↑ ';
}
span[rel="mw:referencedBy"] a::before {
span[rel='mw:referencedBy'] a::before {
counter-increment: mw-ref-linkback;
content: counters(mw-ref-linkback, ".", decimal);
content: counters( mw-ref-linkback, '.', decimal );
vertical-align: super;
line-height: 1;
font-size: smaller;
}
span[rel="mw:referencedBy"] a::after {
content: " ";
span[rel='mw:referencedBy'] a::after {
content: ' ';
}
/* Hide the default rendering in browsers that support content
* generation by selecting for ::after pseudo-element.*/
x-thereisnoelementwiththisname[rel="mw:referencedBy"]::before, span.mw-linkback-text {
x-thereisnoelementwiththisname[rel='mw:referencedBy']::before,
span.mw-linkback-text {
display: none;
}

View file

@ -1,15 +1,15 @@
/* Farsi Cite CSS */
/* <ref>s with a group */
span.mw-ref a[data-mw-group]::after {
content: "[" attr(data-mw-group) " " counter(mw-Ref, persian) "]";
content: '[' attr( data-mw-group ) ' ' counter( mw-Ref, persian ) ']';
}
/* <ref>s without a group */
span.mw-ref a::after {
content: "[" counter(mw-Ref, persian) "]";
content: '[' counter( mw-Ref, persian ) ']';
}
/* Linkbacks from <references> to <ref>s */
span[rel="mw:referencedBy"] a::before {
content: counters(mw-ref-linkback, "٫", persian);
span[rel='mw:referencedBy'] a::before {
content: counters( mw-ref-linkback, '٫', persian );
}

View file

@ -21,7 +21,7 @@ sup.reference {
ol.references li:target,
sup.reference:target {
background-color: #def; /* fallback */
background-color: rgba(0, 127, 255, 0.133);
background-color: rgba( 0, 127, 255, 0.133 );
}
/* Make cite errors "strong" */

View file

@ -0,0 +1,12 @@
{
"extends": "stylelint-config-wikimedia",
"rules": {
"no-browser-hacks": [ true, {
"browsers": [ ">5%", "Chrome >= 1", "Firefox >= 15", "Explorer >= 9", "Edge >= 1", "iOS >= 7", "Opera >= 12", "Safari >= 7", "ExplorerMobile >= 10", "Android >= 3", "not BlackBerry >= 1", "ChromeAndroid >= 1", "FirefoxAndroid >= 1", "OperaMobile >= 12", "not OperaMini >= 1" ]
} ],
"no-unsupported-browser-features": [ true, {
"browsers": [ ">5%", "Chrome >= 1", "Firefox >= 15", "Explorer >= 9", "Edge >= 12", "iOS >= 7", "Opera >= 12", "Safari >= 7", "ExplorerMobile >= 10", "Android >= 4", "not BlackBerry >= 1", "ChromeAndroid >= 1", "FirefoxAndroid >= 1", "OperaMobile >= 12", "not OperaMini >= 1" ]
} ],
}
}

View file

@ -6,5 +6,5 @@
*/
.ve-ui-mwReferenceGroupInputWidget .oo-ui-flaggableElement-emptyGroupPlaceholder {
color: grey;
color: #888;
}

View file

@ -4,52 +4,63 @@
* @copyright 2011-2016 Cite VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/*csslint duplicate-background-images:false */
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-reference,
/* HACK */ .ve-ui-surface-dir-rtl .oo-ui-icon-reference,
/* HACK */ .oo-ui-rtl .oo-ui-icon-reference {
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-reference,
/* HACK */
.oo-ui-rtl .oo-ui-icon-reference {
/* @embed */
background-image: url( icons/reference-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-reference,
/* HACK */ .ve-ui-surface-dir-ltr .oo-ui-icon-reference,
/* HACK */ .oo-ui-ltr .oo-ui-icon-reference {
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-reference,
/* HACK */
.oo-ui-ltr .oo-ui-icon-reference {
/* @embed */
background-image: url( icons/reference-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-reference-existing,
/* HACK */ .ve-ui-surface-dir-rtl .oo-ui-icon-reference-existing,
/* HACK */ .oo-ui-rtl .oo-ui-icon-reference-existing {
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-reference-existing,
/* HACK */
.oo-ui-rtl .oo-ui-icon-reference-existing {
/* @embed */
background-image: url( icons/reference-existing-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-reference-existing,
/* HACK */ .ve-ui-surface-dir-ltr .oo-ui-icon-reference-existing,
/* HACK */ .oo-ui-ltr .oo-ui-icon-reference-existing {
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-reference-existing,
/* HACK */
.oo-ui-ltr .oo-ui-icon-reference-existing {
/* @embed */
background-image: url( icons/reference-existing-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-references,
/* HACK */ .ve-ui-surface-dir-rtl .oo-ui-icon-references,
/* HACK */ .oo-ui-rtl .oo-ui-icon-references {
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-references,
/* HACK */
.oo-ui-rtl .oo-ui-icon-references {
/* @embed */
background-image: url( icons/references-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-references,
/* HACK */ .ve-ui-surface-dir-ltr .oo-ui-icon-references,
/* HACK */ .oo-ui-ltr .oo-ui-icon-references {
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-references,
/* HACK */
.oo-ui-ltr .oo-ui-icon-references {
/* @embed */
background-image: url( icons/references-ltr.svg );
}
@ -61,32 +72,40 @@
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-ref-cite-journal,
/* HACK */ .ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-journal,
/* HACK */ .oo-ui-rtl .oo-ui-icon-ref-cite-journal {
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-journal,
/* HACK */
.oo-ui-rtl .oo-ui-icon-ref-cite-journal {
/* @embed */
background-image: url( icons/ref-cite-journal-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-ref-cite-journal,
/* HACK */ .ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-journal,
/* HACK */ .oo-ui-ltr .oo-ui-icon-ref-cite-journal {
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-journal,
/* HACK */
.oo-ui-ltr .oo-ui-icon-ref-cite-journal {
/* @embed */
background-image: url( icons/ref-cite-journal-ltr.svg );
}
/* @noflip */
.ve-ui-dir-block-rtl .oo-ui-icon-ref-cite-news,
/* HACK */ .ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-news,
/* HACK */ .oo-ui-rtl .oo-ui-icon-ref-cite-news {
/* HACK */
.ve-ui-surface-dir-rtl .oo-ui-icon-ref-cite-news,
/* HACK */
.oo-ui-rtl .oo-ui-icon-ref-cite-news {
/* @embed */
background-image: url( icons/ref-cite-news-rtl.svg );
}
/* @noflip */
.ve-ui-dir-block-ltr .oo-ui-icon-ref-cite-news,
/* HACK */ .ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-news,
/* HACK */ .oo-ui-ltr .oo-ui-icon-ref-cite-news {
/* HACK */
.ve-ui-surface-dir-ltr .oo-ui-icon-ref-cite-news,
/* HACK */
.oo-ui-ltr .oo-ui-icon-ref-cite-news {
/* @embed */
background-image: url( icons/ref-cite-news-ltr.svg );
}

View file

@ -12,6 +12,8 @@
"grunt-banana-checker": "0.4.0",
"grunt-contrib-jshint": "0.11.3",
"grunt-jsonlint": "1.0.7",
"grunt-jscs": "2.5.0"
"grunt-jscs": "2.5.0",
"grunt-stylelint": "0.2.0",
"stylelint-config-wikimedia": "0.1.0"
}
}