Merge "build: Update linters and fix errors"

This commit is contained in:
jenkins-bot 2017-10-31 19:17:42 +00:00 committed by Gerrit Code Review
commit 1c67de24a2
10 changed files with 64 additions and 76 deletions

View file

@ -10,7 +10,7 @@
}
}
/* stylelint-disable selector-no-id */
/* stylelint-disable selector-max-id */
form#editform {
margin: 0;

View file

@ -133,7 +133,7 @@
$( '#wikieditor-toolbar-link-int-target-status-invalid' ).html( reason );
} else {
$( '#wikieditor-toolbar-link-int-target-status-invalid' )
.text( mw.msg( 'wikieditor-toolbar-tool-link-int-target-status-invalid' ) );
.text( mw.msg( 'wikieditor-toolbar-tool-link-int-target-status-invalid' ) );
}
} else {
@ -395,8 +395,7 @@
search: title,
namespace: 0,
suggest: ''
} )
.done( function ( data ) {
} ).done( function ( data ) {
cache[ title ] = data[ 1 ];
$( that ).suggestions( 'suggestions', data[ 1 ] );
} );
@ -543,7 +542,7 @@
$( '#wikieditor-toolbar-link-int-target' ).change();
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
if ( selection !== '' ) {
if ( ( matches = selection.match( /^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/ ) ) ) {
if ( ( matches = selection.match( /^(\s*)\[\[([^\]|]+)(\|([^\]|]*))?\]\](\s*)$/ ) ) ) {
// [[foo|bar]] or [[foo]]
target = matches[ 2 ];
text = ( matches[ 4 ] ? matches[ 4 ] : matches[ 2 ] );
@ -675,7 +674,7 @@
.data( 'whitespace', [ '', '' ] )
.data( 'attributes', '' );
if ( selection !== '' ) {
if ( ( matches = selection.match( /^(\s*)<ref([^\>]*)>([^<]*)<\/ref\>(\s*)$/ ) ) ) {
if ( ( matches = selection.match( /^(\s*)<ref([^>]*)>([^<]*)<\/ref>(\s*)$/ ) ) ) {
text = matches[ 3 ];
// Preserve whitespace when replacing
$( '#wikieditor-toolbar-reference-dialog' )
@ -714,24 +713,20 @@
init: function () {
var magicWordsI18N = mw.config.get( 'wgWikiEditorMagicWords' ),
defaultMsg = mw.msg( 'wikieditor-toolbar-file-default' );
$( this )
.find( '[data-i18n-magic]' )
.text( function () {
return magicWordsI18N[ $( this ).attr( 'data-i18n-magic' ) ];
} )
.removeAttr( 'data-i18n-magic' )
.end()
.find( '#wikieditor-toolbar-file-size' )
.attr( 'placeholder', defaultMsg )
// The message may be long in some languages
.attr( 'size', defaultMsg.length )
.end()
.find( '[rel]' )
.text( function () {
return mw.msg( $( this ).attr( 'rel' ) );
} )
.removeAttr( 'rel' )
.end();
$( this ).find( '[data-i18n-magic]' )
.text( function () {
return magicWordsI18N[ $( this ).attr( 'data-i18n-magic' ) ];
} )
.removeAttr( 'data-i18n-magic' );
$( this ).find( '#wikieditor-toolbar-file-size' )
.attr( 'placeholder', defaultMsg )
// The message may be long in some languages
.attr( 'size', defaultMsg.length );
$( this ).find( '[rel]' )
.text( function () {
return mw.msg( $( this ).attr( 'rel' ) );
} )
.removeAttr( 'rel' );
},
dialog: {
resizable: false,

View file

@ -4,7 +4,7 @@
* CSS for WikiEditor Dialogs
*/
/* stylelint-disable selector-no-id */
/* stylelint-disable selector-max-id */
/* Replace Dialog */
#wikieditor-toolbar-replace-search,

View file

@ -14,7 +14,7 @@
}
/* stylelint-enable declaration-no-important */
input[type='text'] {
input[ type='text' ] {
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
@ -23,8 +23,8 @@
}
input {
&[type='radio'],
&[type='checkbox'] {
&[ type='radio' ],
&[ type='checkbox' ] {
margin-left: 0;
}
}

View file

@ -91,7 +91,7 @@
.html( data.parse.text );
$content.append( '<div class="visualClear"></div>' )
.find( 'a:not([href^="#"])' )
.click( false );
.click( false );
mw.hook( 'wikipage.content' ).fire( $content );
context.modules.preview.$preview.append( $content );
@ -126,11 +126,9 @@
};
postPromise = api.post( postdata );
$.when( postPromise, mw.loader.using( 'mediawiki.diff.styles' ) )
.always( function () {
$.when( postPromise, mw.loader.using( 'mediawiki.diff.styles' ) ).always( function () {
context.$changesTab.find( '.wikiEditor-preview-loading' ).hide();
} )
.done( function ( postResult ) {
} ).done( function ( postResult ) {
var diff;
try {
diff = postResult[ 0 ].query.pages[ 0 ]

View file

@ -21,17 +21,13 @@
}
/* FIXME: This only works for the first wikiEditor on the page! */
/* stylelint-disable-next-line selector-no-id */
#wikiEditor-0-preview-dialog {
.wikiEditor-ui-loading {
overflow: hidden;
border: 0;
}
/* stylelint-disable-next-line selector-max-id */
#wikiEditor-0-preview-dialog .wikiEditor-ui-loading {
overflow: hidden;
border: 0;
}
.ui-dialog {
.ui-dialog-buttonpane {
// stylelint-disable-next-line declaration-no-important
margin: 0 !important;
}
.ui-dialog .ui-dialog-buttonpane {
// stylelint-disable-next-line declaration-no-important
margin: 0 !important;
}

View file

@ -90,7 +90,7 @@
newCopyWarnHTML += '</ul>';
// No list if there's only one element
$( this ).find( '.wikiEditor-publish-dialog-copywarn' ).html(
copyWarnStatements.length > 1 ? newCopyWarnHTML : copyWarnHTML
copyWarnStatements.length > 1 ? newCopyWarnHTML : copyWarnHTML
);
}
/* END OF REALLY DIRTY HACK */

View file

@ -117,8 +117,7 @@
actions = $characters.data( 'actions' );
for ( i = 0; i < data.characters.length; i++ ) {
// Character
$characters
.append(
$characters.append(
$( $.wikiEditor.modules.toolbar.fn.buildCharacter( data.characters[ i ], actions ) )
.mousedown( function ( e ) {
// No dragging!
@ -334,11 +333,11 @@
.text( label );
if ( typeof offsetOrIcon === 'object' ) {
$button
.addClass( 'wikiEditor-toolbar-spritedButton' )
.css( 'backgroundPosition', offsetOrIcon[ 0 ] + 'px ' + offsetOrIcon[ 1 ] + 'px' );
.addClass( 'wikiEditor-toolbar-spritedButton' )
.css( 'backgroundPosition', offsetOrIcon[ 0 ] + 'px ' + offsetOrIcon[ 1 ] + 'px' );
} else if ( offsetOrIcon !== undefined ) { // Bug T172500
$button
.css( 'background-image', 'url(' + offsetOrIcon + ')' );
.css( 'background-image', 'url(' + offsetOrIcon + ')' );
}
if ( 'action' in tool ) {
$button
@ -395,20 +394,20 @@
}
$select.append( $( '<div>' ).addClass( 'menu' ).append( $options ) );
$select.append( $( '<a>' )
.addClass( 'label' )
.text( label )
.data( 'options', $options )
.attr( 'href', '#' )
.mousedown( function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
$( this ).data( 'options' ).animate( { opacity: 'toggle' }, 'fast' );
e.preventDefault();
return false;
} )
.addClass( 'label' )
.text( label )
.data( 'options', $options )
.attr( 'href', '#' )
.mousedown( function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
$( this ).data( 'options' ).animate( { opacity: 'toggle' }, 'fast' );
e.preventDefault();
return false;
} )
);
return $select;
default:

View file

@ -161,22 +161,22 @@
background-color: #eaf3ff;
}
&[rel='heading-2'] {
&[ rel='heading-2' ] {
font-size: 150%;
font-weight: normal;
}
&[rel='heading-3'] {
&[ rel='heading-3' ] {
font-size: 132%;
font-weight: normal;
}
&[rel='heading-4'] {
&[ rel='heading-4' ] {
font-size: 116%;
font-weight: normal;
}
&[rel='heading-5'] {
&[ rel='heading-5' ] {
font-size: 100%;
font-weight: bold;
}
@ -310,7 +310,7 @@
}
}
div[dir='rtl'] span {
div[ dir='rtl' ] span {
/* @noflip */
direction: rtl;
}

View file

@ -4,13 +4,13 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.4.0",
"eslint-config-wikimedia": "0.5.0",
"grunt": "1.0.1",
"grunt-banana-checker": "0.5.0",
"grunt-eslint": "19.0.0",
"grunt-jsonlint": "1.0.8",
"grunt-stylelint": "0.6.0",
"stylelint": "7.8.0",
"stylelint-config-wikimedia": "0.4.1"
"grunt-banana-checker": "0.6.0",
"grunt-eslint": "20.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.9.0",
"stylelint": "8.2.0",
"stylelint-config-wikimedia": "0.4.2"
}
}