build: Update eslint-config-wikimedia to 0.10.0

Change-Id: I5fea8a1d6c91ea69c3490101ea38ce4626bd7e11
This commit is contained in:
Ed Sanders 2019-01-08 23:32:56 +00:00
parent 3a0bb5890f
commit 583ad04b87
7 changed files with 56 additions and 54 deletions

View file

@ -8,6 +8,7 @@
"OO": false
},
"rules": {
"max-len": 0
"max-len": "off",
"jquery/no-global-selector": "off"
}
}

View file

@ -93,7 +93,7 @@
} );
} );
}
$textarea.closest( 'form' ).submit( function () {
$textarea.closest( 'form' ).on( 'submit', function () {
submitting = true;
} );
onUnloadFallback = window.onunload;

View file

@ -209,7 +209,7 @@
} )
);
}
$( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).click( function () {
$( '#wikieditor-toolbar-link-type-int, #wikieditor-toolbar-link-type-ext' ).on( 'click', function () {
var request;
if ( $( '#wikieditor-toolbar-link-type-ext' ).prop( 'checked' ) ) {
// Abort previous request
@ -250,7 +250,7 @@
if ( $( '#wikieditor-toolbar-link-int-text' ).data( 'untouched' ) ) {
$( '#wikieditor-toolbar-link-int-text' )
.val( $( '#wikieditor-toolbar-link-int-target' ).val() )
.change();
.trigger( 'change' );
}
}, 0 );
} );
@ -395,13 +395,13 @@
buttons = {};
buttons[ mw.msg( 'wikieditor-toolbar-tool-link-lookslikeinternal-int' ) ] =
function () {
$( '#wikieditor-toolbar-link-int-target' ).val( match[ 1 ] ).change();
$( '#wikieditor-toolbar-link-int-target' ).val( match[ 1 ] ).trigger( 'change' );
$( this ).dialog( 'close' );
};
buttons[ mw.msg( 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' ) ] =
function () {
$( that ).data( 'ignoreLooksInternal', true );
$( that ).closest( '.ui-dialog' ).find( 'button:first' ).click();
$( that ).closest( '.ui-dialog' ).find( 'button:first' ).trigger( 'click' );
$( that ).data( 'ignoreLooksInternal', false );
$( this ).dialog( 'close' );
};
@ -456,9 +456,9 @@
// Pre-fill the text fields based on the current selection
context = $( this ).data( 'context' );
selection = context.$textarea.textSelection( 'getSelection' );
$( '#wikieditor-toolbar-link-int-target' ).focus();
$( '#wikieditor-toolbar-link-int-target' ).trigger( 'focus' );
// Trigger the change event, so the link status indicator is up to date
$( '#wikieditor-toolbar-link-int-target' ).change();
$( '#wikieditor-toolbar-link-int-target' ).trigger( 'change' );
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
if ( selection !== '' ) {
if ( ( matches = selection.match( /^(\s*)\[\[([^\]|]+)(\|([^\]|]*))?\]\](\s*)$/ ) ) ) {
@ -492,10 +492,10 @@
// Change the value by calling val() doesn't trigger the change event, so let's do that
// ourselves
if ( typeof text !== 'undefined' ) {
$( '#wikieditor-toolbar-link-int-text' ).val( text ).change();
$( '#wikieditor-toolbar-link-int-text' ).val( text ).trigger( 'change' );
}
if ( typeof target !== 'undefined' ) {
$( '#wikieditor-toolbar-link-int-target' ).val( target ).change();
$( '#wikieditor-toolbar-link-int-target' ).val( target ).trigger( 'change' );
}
if ( typeof type !== 'undefined' ) {
$( '#wikieditor-toolbar-link-' + type ).prop( 'checked', true );
@ -516,7 +516,7 @@
$( this ).data( 'dialogkeypressset', true );
// Execute the action associated with the first button
// when the user presses Enter
$( this ).closest( '.ui-dialog' ).keypress( function ( e ) {
$( this ).closest( '.ui-dialog' ).on( 'keypress', function ( e ) {
var button;
if ( ( e.keyCode || e.which ) === 13 ) {
button = $( this ).data( 'dialogaction' ) || $( this ).find( 'button:first' );
@ -527,7 +527,7 @@
// Make tabbing to a button and pressing
// Enter do what people expect
$( this ).closest( '.ui-dialog' ).find( 'button' ).focus( function () {
$( this ).closest( '.ui-dialog' ).find( 'button' ).on( 'focus', function () {
$( this ).closest( '.ui-dialog' ).data( 'dialogaction', this );
} );
}
@ -639,12 +639,12 @@
}
},
open: function () {
$( '#wikieditor-toolbar-file-target' ).focus();
$( '#wikieditor-toolbar-file-target' ).trigger( 'focus' );
if ( !( $( this ).data( 'dialogkeypressset' ) ) ) {
$( this ).data( 'dialogkeypressset', true );
// Execute the action associated with the first button
// when the user presses Enter
$( this ).closest( '.ui-dialog' ).keypress( function ( e ) {
$( this ).closest( '.ui-dialog' ).on( 'keypress', function ( e ) {
var button;
if ( e.which === 13 ) {
button = $( this ).data( 'dialogaction' ) ||
@ -656,7 +656,7 @@
// Make tabbing to a button and pressing
// Enter do what people expect
$( this ).closest( '.ui-dialog' ).find( 'button' ).focus( function () {
$( this ).closest( '.ui-dialog' ).find( 'button' ).on( 'focus', function () {
$( this ).closest( '.ui-dialog' ).data( 'dialogaction', this );
} );
}
@ -676,7 +676,7 @@
$( '#wikieditor-toolbar-table-dimensions-rows' ).val( 3 );
$( '#wikieditor-toolbar-table-dimensions-columns' ).val( 3 );
$( '#wikieditor-toolbar-table-wikitable' ).click( function () {
$( '#wikieditor-toolbar-table-wikitable' ).on( 'click', function () {
$( '.wikieditor-toolbar-table-preview' ).toggleClass( 'wikitable' );
} );
@ -693,7 +693,7 @@
$( '#wikieditor-toolbar-table-preview2' ).tablesorter();
} );
$( '#wikieditor-toolbar-table-sortable' ).click( function () {
$( '#wikieditor-toolbar-table-sortable' ).on( 'click', function () {
// Swap the currently shown one clone with the other one
$( '#wikieditor-toolbar-table-preview' )
.hide()
@ -704,7 +704,7 @@
$( '#wikieditor-toolbar-table-preview3' ).attr( 'id', 'wikieditor-toolbar-table-preview2' );
} );
$( '#wikieditor-toolbar-table-dimensions-header' ).click( function () {
$( '#wikieditor-toolbar-table-dimensions-header' ).on( 'click', function () {
// Instead of show/hiding, switch the HTML around
// We do this because the sortable tables script styles the first row,
// visible or not
@ -795,13 +795,13 @@
// Simulate clicks instead of setting values, so the according
// actions are performed
if ( !$( '#wikieditor-toolbar-table-dimensions-header' ).is( ':checked' ) ) {
$( '#wikieditor-toolbar-table-dimensions-header' ).click();
$( '#wikieditor-toolbar-table-dimensions-header' ).trigger( 'click' );
}
if ( !$( '#wikieditor-toolbar-table-wikitable' ).is( ':checked' ) ) {
$( '#wikieditor-toolbar-table-wikitable' ).click();
$( '#wikieditor-toolbar-table-wikitable' ).trigger( 'click' );
}
if ( $( '#wikieditor-toolbar-table-sortable' ).is( ':checked' ) ) {
$( '#wikieditor-toolbar-table-sortable' ).click();
$( '#wikieditor-toolbar-table-sortable' ).trigger( 'click' );
}
},
'wikieditor-toolbar-tool-table-cancel': function () {
@ -809,12 +809,12 @@
}
},
open: function () {
$( '#wikieditor-toolbar-table-dimensions-rows' ).focus();
$( '#wikieditor-toolbar-table-dimensions-rows' ).trigger( 'focus' );
if ( !( $( this ).data( 'dialogkeypressset' ) ) ) {
$( this ).data( 'dialogkeypressset', true );
// Execute the action associated with the first button
// when the user presses Enter
$( this ).closest( '.ui-dialog' ).keypress( function ( e ) {
$( this ).closest( '.ui-dialog' ).on( 'keypress', function ( e ) {
var button;
if ( ( e.keyCode || e.which ) === 13 ) {
button = $( this ).data( 'dialogaction' ) || $( this ).find( 'button:first' );
@ -825,7 +825,7 @@
// Make tabbing to a button and pressing
// Enter do what people expect
$( this ).closest( '.ui-dialog' ).find( 'button' ).focus( function () {
$( this ).closest( '.ui-dialog' ).find( 'button' ).on( 'focus', function () {
$( this ).closest( '.ui-dialog' ).data( 'dialogaction', this );
} );
}
@ -973,6 +973,7 @@
end: end } );
$textarea.textSelection( 'scrollToCaretPosition' );
$( this ).data( 'offset', end );
// eslint-disable-next-line jquery/no-event-shorthand
$textarea[ 0 ].focus();
}
} );
@ -1004,13 +1005,13 @@
$( this ).data( 'offset', 0 );
$( this ).data( 'matchIndex', 0 );
$( '#wikieditor-toolbar-replace-search' ).focus();
$( '#wikieditor-toolbar-replace-search' ).trigger( 'focus' );
$( '#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex' ).hide();
if ( !( $( this ).data( 'onetimeonlystuff' ) ) ) {
$( this ).data( 'onetimeonlystuff', true );
// Execute the action associated with the first button
// when the user presses Enter
$( this ).closest( '.ui-dialog' ).keypress( function ( e ) {
$( this ).closest( '.ui-dialog' ).on( 'keypress', function ( e ) {
var button;
if ( ( e.keyCode || e.which ) === 13 ) {
button = $( this ).data( 'dialogaction' ) || $( this ).find( 'button:first' );
@ -1020,7 +1021,7 @@
} );
// Make tabbing to a button and pressing
// Enter do what people expect
$( this ).closest( '.ui-dialog' ).find( 'button' ).focus( function () {
$( this ).closest( '.ui-dialog' ).find( 'button' ).on( 'focus', function () {
$( this ).closest( '.ui-dialog' ).data( 'dialogaction', this );
} );
}

View file

@ -366,7 +366,7 @@
context.$buttons.show();
return $( '<button>' )
.text( $.wikiEditor.autoMsg( options, 'caption' ) )
.click( options.action )
.on( 'click', options.action )
.appendTo( context.$buttons );
},
@ -389,16 +389,16 @@
.addClass( context.view === options.name ? 'current' : null )
.append( $( '<a>' )
.attr( 'href', '#' )
.mousedown( function () {
.on( 'mousedown', function () {
// No dragging!
return false;
} )
.click( function ( event ) {
.on( 'click', function ( event ) {
context.$ui.find( '.wikiEditor-ui-view' ).hide();
context.$ui.find( '.' + $( this ).parent().attr( 'rel' ) ).show();
context.$tabs.find( 'div' ).removeClass( 'current' );
$( this ).parent().addClass( 'current' );
$( this ).blur();
$( this ).trigger( 'blur' );
if ( 'init' in options && typeof options.init === 'function' ) {
options.init( context );
}
@ -507,7 +507,7 @@
// Setup the initial view
context.view = 'wikitext';
// Trigger the "resize" event anytime the window is resized
$( window ).resize( function ( event ) {
$( window ).on( 'resize', function ( event ) {
context.fn.trigger( 'resize', event );
} );
}

View file

@ -113,12 +113,12 @@
// Character
$characters.append(
$( $.wikiEditor.modules.toolbar.fn.buildCharacter( data.characters[ i ], actions ) )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
.on( 'click', function ( e ) {
$.wikiEditor.modules.toolbar.fn.doAction( $( this ).parent().data( 'context' ),
$( this ).parent().data( 'actions' )[ $( this ).attr( 'rel' ) ] );
e.preventDefault();
@ -251,7 +251,7 @@
},
buildGroup: function ( context, id, group ) {
var $label, empty, tool,
$group = $( '<div>' ).attr( { 'class': 'group group-' + id, rel: id } ),
$group = $( '<div>' ).attr( { class: 'group group-' + id, rel: id } ),
label = $.wikiEditor.autoMsg( group, 'label' );
if ( label ) {
$label = $( '<span>' )
@ -312,7 +312,7 @@
title: label,
rel: id,
role: 'button',
'class': 'tool tool-button'
class: 'tool tool-button'
} )
.text( label );
if ( tool.icon ) {
@ -335,7 +335,7 @@
$button
.data( 'action', tool.action )
.data( 'context', context )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
@ -359,7 +359,7 @@
return $button;
case 'select':
$select = $( '<div>' )
.attr( { rel: id, 'class': 'tool tool-select' } );
.attr( { rel: id, class: 'tool tool-select' } );
$options = $( '<div>' ).addClass( 'options' );
if ( 'list' in tool ) {
for ( option in tool.list ) {
@ -368,12 +368,12 @@
$( '<a>' )
.data( 'action', tool.list[ option ].action )
.data( 'context', context )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
.on( 'click', function ( e ) {
$.wikiEditor.modules.toolbar.fn.doAction(
$( this ).data( 'context' ), $( this ).data( 'action' ), $( this )
);
@ -393,7 +393,7 @@
.text( label )
.data( 'options', $options )
.attr( 'href', '#' )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
@ -416,12 +416,12 @@
.text( label )
.attr( 'rel', id )
.data( 'context', context )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( event ) {
.on( 'click', function ( event ) {
var section;
$( this ).parent().parent().find( '.page' ).hide();
$( this ).parent().parent().find( '.page-' + $( this ).attr( 'rel' ) ).show().trigger( 'loadPage' );
@ -440,7 +440,7 @@
},
buildPage: function ( context, id, page, deferLoad ) {
var $page = $( '<div>' ).attr( {
'class': 'page page-' + id,
class: 'page page-' + id,
rel: id
} );
if ( deferLoad ) {
@ -492,12 +492,12 @@
$characters
.html( html )
.children()
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
.on( 'click', function ( e ) {
$.wikiEditor.modules.toolbar.fn.doAction(
$( this ).parent().data( 'context' ),
$( this ).parent().data( 'actions' )[ $( this ).attr( 'rel' ) ],
@ -589,15 +589,15 @@
} )
.text( $.wikiEditor.autoMsg( section, 'label' ) )
.data( 'context', context )
.mouseup( function () {
$( this ).blur();
.on( 'mouseup', function () {
$( this ).trigger( 'blur' );
} )
.mousedown( function ( e ) {
.on( 'mousedown', function ( e ) {
// No dragging!
e.preventDefault();
return false;
} )
.click( function ( e ) {
.on( 'click', function ( e ) {
// We have to set aria-pressed over here, as NVDA wont recognize it
// if we do it in the below .each as it seems
$( this ).attr( 'aria-pressed', 'true' );
@ -635,7 +635,7 @@
} );
return $( '<span>' )
.attr( {
'class': 'tab tab-' + id,
class: 'tab tab-' + id,
rel: id
} )
.append( $link );
@ -643,7 +643,7 @@
buildSection: function ( context, id, section ) {
var selected, show,
$section = $( '<div>' ).attr( {
'class': section.type + ' section section-' + id,
class: section.type + ' section section-' + id,
rel: id,
id: 'wikiEditor-section-' + id
} );

View file

@ -4,7 +4,7 @@
"test": "grunt test"
},
"devDependencies": {
"eslint-config-wikimedia": "0.9.0",
"eslint-config-wikimedia": "0.10.0",
"grunt": "1.0.3",
"grunt-banana-checker": "0.6.0",
"grunt-eslint": "21.0.0",

View file

@ -2,7 +2,7 @@
QUnit.module( 'ext.wikiEditor.toolbar', QUnit.newMwEnvironment( {
setup: function () {
var $fixture = $( '#qunit-fixture' ),
$target = $( '<textarea id="wpTextBox1">' );
$target = $( '<textarea>' ).attr( 'id', 'wpTextBox1' );
this.$target = $target;
$fixture.append( $target );
$target.wikiEditor( 'addModule', 'toolbar' );