build: Update linters

Change-Id: Ic11eea77b944cfc98e9494a9d215a138f386f1eb
This commit is contained in:
Ed Sanders 2018-09-09 18:05:47 +01:00 committed by Esanders
parent e793f66b2c
commit 0b7cc4ffce
3 changed files with 30 additions and 20 deletions

View File

@ -110,9 +110,15 @@
// if there are still moveable items in the dropdown menu,
// and there is sufficient space to place them in the tab container
if ( $( data.collapsedContainer + ' ' + data.collapsible ).length &&
data.expandCondition( $.collapsibleTabs.getSettings( $( data.collapsedContainer ).children(
data.collapsible + ':first' ) ).expandedWidth ) ) {
if (
$( data.collapsedContainer + ' ' + data.collapsible ).length &&
data.expandCondition(
$.collapsibleTabs.getSettings(
$( data.collapsedContainer ).children(
data.collapsible + ':first' )
).expandedWidth
)
) {
// move the element from the dropdown to the tab
$el.trigger( 'beforeTabExpand' );
$.collapsibleTabs
@ -127,7 +133,9 @@
if ( !outerData ) {
return;
}
expContainerSettings = $.collapsibleTabs.getSettings( $( outerData.expandedContainer ) );
expContainerSettings = $.collapsibleTabs.getSettings(
$( outerData.expandedContainer )
);
if ( !expContainerSettings ) {
return;
}
@ -173,9 +181,10 @@
.animate( { width: expandedWidth + 'px' }, 'normal', function () {
$( this ).attr( 'style', 'display: block;' );
rAF( function () {
// Update the 'expandedWidth' in case someone was brazen enough to change the tab's
// contents after the page load *gasp* (T71729). This doesn't prevent a tab from
// collapsing back and forth once, but at least it won't continue to do that forever.
// Update the 'expandedWidth' in case someone was brazen enough to
// change the tab's contents after the page load *gasp* (T71729). This
// doesn't prevent a tab from collapsing back and forth once, but at
// least it won't continue to do that forever.
data.expandedWidth = $moving.width();
$moving.data( 'collapsibleTabsSettings', data );
expContainerSettings.shifting = false;

View File

@ -5,13 +5,13 @@
"doc": "jsduck"
},
"devDependencies": {
"eslint-config-wikimedia": "0.5.0",
"grunt": "1.0.2",
"eslint-config-wikimedia": "0.7.2",
"grunt": "1.0.3",
"grunt-banana-checker": "0.6.0",
"grunt-eslint": "20.1.0",
"grunt-eslint": "21.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.9.0",
"stylelint": "8.2.0",
"stylelint-config-wikimedia": "0.4.2"
"grunt-stylelint": "0.10.1",
"stylelint": "9.2.0",
"stylelint-config-wikimedia": "0.4.3"
}
}

View File

@ -48,16 +48,16 @@ jQuery( function ( $ ) {
} )
.collapsibleTabs( {
expandCondition: function ( eleWidth ) {
// (This looks a bit awkward because we're doing expensive queries as late as possible.)
// This looks a bit awkward because we're doing expensive queries as late
// as possible.
var distance = $.collapsibleTabs.calculateTabDistance();
// If there are at least eleWidth + 1 pixels of free space, expand.
// We add 1 because .width() will truncate fractional values but .offset() will not.
if ( distance >= eleWidth + 1 ) {
return true;
} else {
// Maybe we can still expand? Account for the width of the "Actions" dropdown if the
// expansion would hide it.
// Maybe we can still expand? Account for the width of the "Actions" dropdown
// if the expansion would hide it.
if ( $cactions.find( 'li' ).length === 1 ) {
return distance >= eleWidth + 1 - initialCactionsWidth();
} else {
@ -68,9 +68,10 @@ jQuery( function ( $ ) {
collapseCondition: function () {
var collapsibleWidth = 0;
// (This looks a bit awkward because we're doing expensive queries as late as possible.)
// TODO The dropdown itself should probably "fold" to just the down-arrow (hiding the text)
// if it can't fit on the line?
// This looks a bit awkward because we're doing expensive queries as late
// as possible.
// TODO: The dropdown itself should probably "fold" to just the down-arrow
// (hiding the text) if it can't fit on the line?
// Never collapse if there is no overlap.
if ( $.collapsibleTabs.calculateTabDistance() >= 0 ) {