Merge "build: Update eslint-config-wikimedia to 0.21.0"
This commit is contained in:
commit
2b9cabf5b3
31 changed files with 13573 additions and 242 deletions
13709
package-lock.json
generated
13709
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -20,7 +20,7 @@
|
||||||
"@wdio/sync": "7.4.6",
|
"@wdio/sync": "7.4.6",
|
||||||
"api-testing": "1.3.0",
|
"api-testing": "1.3.0",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
"eslint-config-wikimedia": "0.20.0",
|
"eslint-config-wikimedia": "0.21.0",
|
||||||
"grunt": "1.4.1",
|
"grunt": "1.4.1",
|
||||||
"grunt-banana-checker": "0.9.0",
|
"grunt-banana-checker": "0.9.0",
|
||||||
"grunt-contrib-copy": "1.0.0",
|
"grunt-contrib-copy": "1.0.0",
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
* author Mozilla Contributors
|
* author Mozilla Contributors
|
||||||
* license CC0 per https://developer.mozilla.org/en-US/docs/MDN/About#copyrights_and_licenses
|
* license CC0 per https://developer.mozilla.org/en-US/docs/MDN/About#copyrights_and_licenses
|
||||||
*
|
*
|
||||||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
|
* https://github.com/mdn/content/blob/b81aa721130/files/en-us/web/javascript/reference/global_objects/array/find/index.html#L113
|
||||||
*/
|
*/
|
||||||
if ( !Array.prototype.find ) {
|
if ( !Array.prototype.find ) {
|
||||||
Object.defineProperty( Array.prototype, 'find', {
|
Object.defineProperty( Array.prototype, 'find', {
|
||||||
|
|
@ -19,7 +19,7 @@ if ( !Array.prototype.find ) {
|
||||||
|
|
||||||
// 1. Let O be ? ToObject(this value).
|
// 1. Let O be ? ToObject(this value).
|
||||||
if ( this == null ) {
|
if ( this == null ) {
|
||||||
throw TypeError( '"this" is null or not defined' );
|
throw new TypeError( '"this" is null or not defined' );
|
||||||
}
|
}
|
||||||
|
|
||||||
o = Object( this );
|
o = Object( this );
|
||||||
|
|
@ -29,7 +29,7 @@ if ( !Array.prototype.find ) {
|
||||||
|
|
||||||
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
||||||
if ( typeof predicate !== 'function' ) {
|
if ( typeof predicate !== 'function' ) {
|
||||||
throw TypeError( 'predicate must be a function' );
|
throw new TypeError( 'predicate must be a function' );
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@
|
||||||
* @param {jQuery} [options.$customTogglers] Elements to be used as togglers
|
* @param {jQuery} [options.$customTogglers] Elements to be used as togglers
|
||||||
* for this collapsible element. By default, if the collapsible element
|
* for this collapsible element. By default, if the collapsible element
|
||||||
* has an id attribute like 'mw-customcollapsible-XXX', elements with a
|
* has an id attribute like 'mw-customcollapsible-XXX', elements with a
|
||||||
* *class* of 'mw-customtoggle-XXX' are made togglers for it.
|
* **class** of 'mw-customtoggle-XXX' are made togglers for it.
|
||||||
* @param {boolean} [options.plainMode=false] Whether to use a "plain mode" when making the
|
* @param {boolean} [options.plainMode=false] Whether to use a "plain mode" when making the
|
||||||
* element collapsible - that is, hide entire tables and lists (instead
|
* element collapsible - that is, hide entire tables and lists (instead
|
||||||
* of hiding only all rows but first of tables, and hiding each list
|
* of hiding only all rows but first of tables, and hiding each list
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
if ( !el ) {
|
if ( !el ) {
|
||||||
val = '';
|
val = '';
|
||||||
} else {
|
} else {
|
||||||
val = el.value.substring( el.selectionStart, el.selectionEnd );
|
val = el.value.slice( el.selectionStart, el.selectionEnd );
|
||||||
}
|
}
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ module.exports = ( function () {
|
||||||
return '*';
|
return '*';
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line compat/compat
|
|
||||||
origin = location.protocol + '//' + location.hostname;
|
origin = location.protocol + '//' + location.hostname;
|
||||||
if ( location.port ) {
|
if ( location.port ) {
|
||||||
origin += ':' + location.port;
|
origin += ':' + location.port;
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,7 @@ Title.newFromUserInput = function ( title, defaultNamespace, options ) {
|
||||||
namespace = NS_MAIN;
|
namespace = NS_MAIN;
|
||||||
title = title
|
title = title
|
||||||
// Strip colon
|
// Strip colon
|
||||||
.substr( 1 )
|
.slice( 1 )
|
||||||
// Trim underscores
|
// Trim underscores
|
||||||
.replace( rUnderscoreTrim, '' );
|
.replace( rUnderscoreTrim, '' );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,7 @@ mw.jqueryMsg.Parser.prototype = {
|
||||||
var len = s.length;
|
var len = s.length;
|
||||||
return function () {
|
return function () {
|
||||||
var result = null;
|
var result = null;
|
||||||
if ( input.substr( pos, len ) === s ) {
|
if ( input.slice( pos, pos + len ) === s ) {
|
||||||
result = s;
|
result = s;
|
||||||
pos += len;
|
pos += len;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@
|
||||||
newSegment = segment.toUpperCase();
|
newSegment = segment.toUpperCase();
|
||||||
// ISO 15924 script code
|
// ISO 15924 script code
|
||||||
} else if ( segment.length === 4 && !isFirstSegment ) {
|
} else if ( segment.length === 4 && !isFirstSegment ) {
|
||||||
newSegment = segment.charAt( 0 ).toUpperCase() + segment.substring( 1 ).toLowerCase();
|
newSegment = segment.charAt( 0 ).toUpperCase() + segment.slice( 1 ).toLowerCase();
|
||||||
// Use lowercase for other cases
|
// Use lowercase for other cases
|
||||||
} else {
|
} else {
|
||||||
newSegment = segment.toLowerCase();
|
newSegment = segment.toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -1141,7 +1141,7 @@ Controller.prototype._trackHighlight = function ( action, filters ) {
|
||||||
*/
|
*/
|
||||||
Controller.prototype.trackFilterGroupings = function ( action ) {
|
Controller.prototype.trackFilterGroupings = function ( action ) {
|
||||||
var controller = this,
|
var controller = this,
|
||||||
rightNow = new Date().getTime(),
|
rightNow = Date.now(),
|
||||||
randomIdentifier = String( mw.user.sessionId() ) + String( rightNow ) + String( Math.random() ),
|
randomIdentifier = String( mw.user.sessionId() ) + String( rightNow ) + String( Math.random() ),
|
||||||
// Get all current filters
|
// Get all current filters
|
||||||
filters = this.filtersModel.findSelectedItems().map( function ( item ) {
|
filters = this.filtersModel.findSelectedItems().map( function ( item ) {
|
||||||
|
|
|
||||||
|
|
@ -1020,13 +1020,13 @@ FiltersViewModel.prototype.findMatches = function ( query, returnFlat ) {
|
||||||
groupTitle,
|
groupTitle,
|
||||||
result = {},
|
result = {},
|
||||||
flatResult = [],
|
flatResult = [],
|
||||||
view = this.getViewByTrigger( query.substr( 0, 1 ) ),
|
view = this.getViewByTrigger( query.slice( 0, 1 ) ),
|
||||||
items = this.getFiltersByView( view );
|
items = this.getFiltersByView( view );
|
||||||
|
|
||||||
// Normalize so we can search strings regardless of case and view
|
// Normalize so we can search strings regardless of case and view
|
||||||
query = query.trim().toLowerCase();
|
query = query.trim().toLowerCase();
|
||||||
if ( view !== 'default' ) {
|
if ( view !== 'default' ) {
|
||||||
query = query.substr( 1 );
|
query = query.slice( 1 );
|
||||||
}
|
}
|
||||||
// Trim again to also intercept cases where the spaces were after the trigger
|
// Trim again to also intercept cases where the spaces were after the trigger
|
||||||
// eg: '# str'
|
// eg: '# str'
|
||||||
|
|
@ -1166,7 +1166,7 @@ FiltersViewModel.prototype.getViewByTrigger = function ( trigger ) {
|
||||||
*/
|
*/
|
||||||
FiltersViewModel.prototype.removeViewTriggers = function ( str ) {
|
FiltersViewModel.prototype.removeViewTriggers = function ( str ) {
|
||||||
if ( this.getViewFromString( str ) !== 'default' ) {
|
if ( this.getViewFromString( str ) !== 'default' ) {
|
||||||
str = str.substr( 1 );
|
str = str.slice( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
@ -1179,7 +1179,7 @@ FiltersViewModel.prototype.removeViewTriggers = function ( str ) {
|
||||||
* @return {string} View name
|
* @return {string} View name
|
||||||
*/
|
*/
|
||||||
FiltersViewModel.prototype.getViewFromString = function ( str ) {
|
FiltersViewModel.prototype.getViewFromString = function ( str ) {
|
||||||
return this.getViewByTrigger( str.substr( 0, 1 ) );
|
return this.getViewByTrigger( str.slice( 0, 1 ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ SavedQueriesModel.prototype.convertToParameters = function ( data ) {
|
||||||
SavedQueriesModel.prototype.addNewQuery = function ( label, fulldata, isDefault, id ) {
|
SavedQueriesModel.prototype.addNewQuery = function ( label, fulldata, isDefault, id ) {
|
||||||
var normalizedData = { params: {}, highlights: {} },
|
var normalizedData = { params: {}, highlights: {} },
|
||||||
highlightParamNames = Object.keys( this.filtersModel.getEmptyHighlightParameters() ),
|
highlightParamNames = Object.keys( this.filtersModel.getEmptyHighlightParameters() ),
|
||||||
randomID = String( id || ( new Date() ).getTime() ),
|
randomID = String( id || Date.now() ),
|
||||||
data = this.filtersModel.getMinimizedParamRepresentation( fulldata );
|
data = this.filtersModel.getMinimizedParamRepresentation( fulldata );
|
||||||
|
|
||||||
// Split highlight/params
|
// Split highlight/params
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,8 @@ ChangesListWrapperWidget.prototype.onModelUpdate = function (
|
||||||
} );
|
} );
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Toggles overlay class on changes list
|
/**
|
||||||
|
* Toggles overlay class on changes list
|
||||||
*
|
*
|
||||||
* @param {boolean} isVisible True if overlay should be visible
|
* @param {boolean} isVisible True if overlay should be visible
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -502,11 +502,11 @@ FilterTagMultiselectWidget.prototype.onModelUpdate = function () {
|
||||||
FilterTagMultiselectWidget.prototype.updateElementsForView = function () {
|
FilterTagMultiselectWidget.prototype.updateElementsForView = function () {
|
||||||
var view = this.model.getCurrentView(),
|
var view = this.model.getCurrentView(),
|
||||||
inputValue = this.input.getValue().trim(),
|
inputValue = this.input.getValue().trim(),
|
||||||
inputView = this.model.getViewByTrigger( inputValue.substr( 0, 1 ) );
|
inputView = this.model.getViewByTrigger( inputValue.slice( 0, 1 ) );
|
||||||
|
|
||||||
if ( inputView !== 'default' ) {
|
if ( inputView !== 'default' ) {
|
||||||
// We have a prefix already, remove it
|
// We have a prefix already, remove it
|
||||||
inputValue = inputValue.substr( 1 );
|
inputValue = inputValue.slice( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inputView !== view ) {
|
if ( inputView !== view ) {
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
if ( v[ 0 ] !== '\x1f' ) {
|
if ( v[ 0 ] !== '\x1f' ) {
|
||||||
return v.split( '|' );
|
return v.split( '|' );
|
||||||
} else {
|
} else {
|
||||||
return v.substr( 1 ).split( '\x1f' );
|
return v.slice( 1 ).split( '\x1f' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -973,7 +973,7 @@
|
||||||
if ( Object.prototype.hasOwnProperty.call( availableFormats, params.format + 'fm' ) ) {
|
if ( Object.prototype.hasOwnProperty.call( availableFormats, params.format + 'fm' ) ) {
|
||||||
params.format = params.format + 'fm';
|
params.format = params.format + 'fm';
|
||||||
}
|
}
|
||||||
if ( params.format.substr( -2 ) === 'fm' ) {
|
if ( params.format.slice( -2 ) === 'fm' ) {
|
||||||
params.wrappedhtml = 1;
|
params.wrappedhtml = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1675,8 +1675,8 @@
|
||||||
deprecatedItems = [],
|
deprecatedItems = [],
|
||||||
buttons = [],
|
buttons = [],
|
||||||
filterFmModules = function ( v ) {
|
filterFmModules = function ( v ) {
|
||||||
return v.substr( -2 ) !== 'fm' ||
|
return v.slice( -2 ) !== 'fm' ||
|
||||||
!Object.prototype.hasOwnProperty.call( availableFormats, v.substr( 0, v.length - 2 ) );
|
!Object.prototype.hasOwnProperty.call( availableFormats, v.slice( 0, v.length - 2 ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is something of a hack. We always want the 'format' and
|
// This is something of a hack. We always want the 'format' and
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@
|
||||||
*/
|
*/
|
||||||
.mw-prefs-buttons {
|
.mw-prefs-buttons {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
position: -webkit-sticky;
|
position: -webkit-sticky;
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
position: sticky;
|
position: sticky;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
margin-top: -1px;
|
margin-top: -1px;
|
||||||
|
|
@ -43,6 +45,7 @@
|
||||||
// Support Edge: The `position: sticky` rule above causes the buttons to
|
// Support Edge: The `position: sticky` rule above causes the buttons to
|
||||||
// disappear in RTL languages on Microsoft Edge. This magically fixes the issue. See T220706.
|
// disappear in RTL languages on Microsoft Edge. This magically fixes the issue. See T220706.
|
||||||
#preferences {
|
#preferences {
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
filter: brightness( 1 );
|
filter: brightness( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
// Background properties.
|
// Background properties.
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
// Using static value instead of `background-size: contain` because of T233521#5545513.
|
// Using static value instead of `background-size: contain` because of T233521#5545513.
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
background-size: @size @size;
|
background-size: @size @size;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
|
|
@ -64,6 +65,7 @@
|
||||||
.mw-ui-icon {
|
.mw-ui-icon {
|
||||||
// reset font-size so the "em" value is relative to the more
|
// reset font-size so the "em" value is relative to the more
|
||||||
// predictable rem font size ...and no rems because we can't have nice things.
|
// predictable rem font size ...and no rems because we can't have nice things.
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
font-size: initial;
|
font-size: initial;
|
||||||
|
|
||||||
// sizing
|
// sizing
|
||||||
|
|
@ -89,7 +91,9 @@
|
||||||
.text-overflow( @visible: false );
|
.text-overflow( @visible: false );
|
||||||
|
|
||||||
// resetting styles for <button> elements
|
// resetting styles for <button> elements
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
-moz-appearance: none;
|
-moz-appearance: none;
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
@ -195,6 +199,7 @@
|
||||||
&:before {
|
&:before {
|
||||||
// sizing
|
// sizing
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
||||||
font-size: initial;
|
font-size: initial;
|
||||||
width: auto;
|
width: auto;
|
||||||
min-width: @icon-size-md;
|
min-width: @icon-size-md;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@
|
||||||
if ( !this.shortZones ) {
|
if ( !this.shortZones ) {
|
||||||
this.shortZones = [
|
this.shortZones = [
|
||||||
'Z',
|
'Z',
|
||||||
this.fullZones[ 1 ].substr( 0, 1 ).toUpperCase()
|
this.fullZones[ 1 ].slice( 0, 1 ).toUpperCase()
|
||||||
];
|
];
|
||||||
if ( this.shortZones[ 1 ] === 'Z' ) {
|
if ( this.shortZones[ 1 ] === 'Z' ) {
|
||||||
this.shortZones[ 1 ] = 'L';
|
this.shortZones[ 1 ] = 'L';
|
||||||
|
|
@ -210,7 +210,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( last < format.length ) {
|
if ( last < format.length ) {
|
||||||
ret.push( format.substr( last ) );
|
ret.push( format.slice( last ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
|
|
@ -37,28 +37,28 @@
|
||||||
config.shortMonthNames = {};
|
config.shortMonthNames = {};
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( config.fullMonthNames, function ( k, v ) {
|
$.each( config.fullMonthNames, function ( k, v ) {
|
||||||
config.shortMonthNames[ k ] = v.substr( 0, 3 );
|
config.shortMonthNames[ k ] = v.slice( 0, 3 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
if ( config.shortDayNames && !config.dayLetters ) {
|
if ( config.shortDayNames && !config.dayLetters ) {
|
||||||
config.dayLetters = [];
|
config.dayLetters = [];
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( config.shortDayNames, function ( k, v ) {
|
$.each( config.shortDayNames, function ( k, v ) {
|
||||||
config.dayLetters[ k ] = v.substr( 0, 1 );
|
config.dayLetters[ k ] = v.slice( 0, 1 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
if ( config.fullDayNames && !config.dayLetters ) {
|
if ( config.fullDayNames && !config.dayLetters ) {
|
||||||
config.dayLetters = [];
|
config.dayLetters = [];
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( config.fullDayNames, function ( k, v ) {
|
$.each( config.fullDayNames, function ( k, v ) {
|
||||||
config.dayLetters[ k ] = v.substr( 0, 1 );
|
config.dayLetters[ k ] = v.slice( 0, 1 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
if ( config.fullDayNames && !config.shortDayNames ) {
|
if ( config.fullDayNames && !config.shortDayNames ) {
|
||||||
config.shortDayNames = {};
|
config.shortDayNames = {};
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( config.fullDayNames, function ( k, v ) {
|
$.each( config.fullDayNames, function ( k, v ) {
|
||||||
config.shortDayNames[ k ] = v.substr( 0, 3 );
|
config.shortDayNames[ k ] = v.slice( 0, 3 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
config = $.extend( {
|
config = $.extend( {
|
||||||
|
|
@ -159,28 +159,28 @@
|
||||||
this.shortMonthNames = {};
|
this.shortMonthNames = {};
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( this.fullMonthNames, function ( k, v ) {
|
$.each( this.fullMonthNames, function ( k, v ) {
|
||||||
this.shortMonthNames[ k ] = v.substr( 0, 3 );
|
this.shortMonthNames[ k ] = v.slice( 0, 3 );
|
||||||
}.bind( this ) );
|
}.bind( this ) );
|
||||||
}
|
}
|
||||||
if ( this.shortDayNames && !this.dayLetters ) {
|
if ( this.shortDayNames && !this.dayLetters ) {
|
||||||
this.dayLetters = [];
|
this.dayLetters = [];
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( this.shortDayNames, function ( k, v ) {
|
$.each( this.shortDayNames, function ( k, v ) {
|
||||||
this.dayLetters[ k ] = v.substr( 0, 1 );
|
this.dayLetters[ k ] = v.slice( 0, 1 );
|
||||||
}.bind( this ) );
|
}.bind( this ) );
|
||||||
}
|
}
|
||||||
if ( this.fullDayNames && !this.dayLetters ) {
|
if ( this.fullDayNames && !this.dayLetters ) {
|
||||||
this.dayLetters = [];
|
this.dayLetters = [];
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( this.fullDayNames, function ( k, v ) {
|
$.each( this.fullDayNames, function ( k, v ) {
|
||||||
this.dayLetters[ k ] = v.substr( 0, 1 );
|
this.dayLetters[ k ] = v.slice( 0, 1 );
|
||||||
}.bind( this ) );
|
}.bind( this ) );
|
||||||
}
|
}
|
||||||
if ( this.fullDayNames && !this.shortDayNames ) {
|
if ( this.fullDayNames && !this.shortDayNames ) {
|
||||||
this.shortDayNames = {};
|
this.shortDayNames = {};
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( this.fullDayNames, function ( k, v ) {
|
$.each( this.fullDayNames, function ( k, v ) {
|
||||||
this.shortDayNames[ k ] = v.substr( 0, 3 );
|
this.shortDayNames[ k ] = v.slice( 0, 3 );
|
||||||
}.bind( this ) );
|
}.bind( this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +243,7 @@
|
||||||
this.dayLetters = [];
|
this.dayLetters = [];
|
||||||
// eslint-disable-next-line no-jquery/no-each-util
|
// eslint-disable-next-line no-jquery/no-each-util
|
||||||
$.each( this.shortDayNames, function ( k, v ) {
|
$.each( this.shortDayNames, function ( k, v ) {
|
||||||
this.dayLetters[ k ] = v.substr( 0, 1 );
|
this.dayLetters[ k ] = v.slice( 0, 1 );
|
||||||
}.bind( this ) );
|
}.bind( this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,12 +162,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getInterwikiPrefixesPromise().then( function ( interwikiPrefixes ) {
|
return this.getInterwikiPrefixesPromise().then( function ( interwikiPrefixes ) {
|
||||||
var interwiki;
|
|
||||||
// Optimization: check we have any prefixes.
|
// Optimization: check we have any prefixes.
|
||||||
if ( interwikiPrefixes.length ) {
|
if ( interwikiPrefixes.length ) {
|
||||||
interwiki = query.substring( 0, query.indexOf( ':' ) );
|
var interwiki = query.slice( 0, Math.max( 0, query.indexOf( ':' ) ) );
|
||||||
if (
|
if (
|
||||||
interwiki && interwiki !== '' &&
|
interwiki !== '' &&
|
||||||
interwikiPrefixes.indexOf( interwiki ) !== -1
|
interwikiPrefixes.indexOf( interwiki ) !== -1
|
||||||
) {
|
) {
|
||||||
// Interwiki prefix is valid: return the original query as a valid title
|
// Interwiki prefix is valid: return the original query as a valid title
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@
|
||||||
var mw, log,
|
var mw, log,
|
||||||
con = window.console;
|
con = window.console;
|
||||||
|
|
||||||
|
/* https://github.com/gajus/eslint-plugin-jsdoc/issues/806 */
|
||||||
|
/* eslint-disable jsdoc/valid-types */
|
||||||
/**
|
/**
|
||||||
* Log a message to window.console, if possible.
|
* Log a message to window.console, if possible.
|
||||||
*
|
*
|
||||||
|
|
@ -47,6 +49,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* eslint-enable jsdoc/valid-types */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an object that can be read from or written to via methods that allow
|
* Create an object that can be read from or written to via methods that allow
|
||||||
|
|
|
||||||
|
|
@ -1220,9 +1220,8 @@
|
||||||
|
|
||||||
for ( i = 0; i < modules.length; i++ ) {
|
for ( i = 0; i < modules.length; i++ ) {
|
||||||
// Determine how many bytes this module would add to the query string
|
// Determine how many bytes this module would add to the query string
|
||||||
// If lastDotIndex is -1, substr() returns an empty string
|
|
||||||
var lastDotIndex = modules[ i ].lastIndexOf( '.' ),
|
var lastDotIndex = modules[ i ].lastIndexOf( '.' ),
|
||||||
prefix = modules[ i ].substr( 0, lastDotIndex ),
|
prefix = modules[ i ].slice( 0, Math.max( 0, lastDotIndex ) ),
|
||||||
suffix = modules[ i ].slice( lastDotIndex + 1 ),
|
suffix = modules[ i ].slice( lastDotIndex + 1 ),
|
||||||
bytesAdded = moduleMap[ prefix ] ?
|
bytesAdded = moduleMap[ prefix ] ?
|
||||||
suffix.length + 3 : // '%2C'.length == 3
|
suffix.length + 3 : // '%2C'.length == 3
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ describe( 'Listing Users', function () {
|
||||||
|
|
||||||
before( async () => {
|
before( async () => {
|
||||||
prefix = await utils.title();
|
prefix = await utils.title();
|
||||||
prefix = prefix.substring( 0, 7 );
|
prefix = prefix.slice( 0, 7 );
|
||||||
|
|
||||||
// NOTE: Because of T199393, the accounts have to be created sequentially.
|
// NOTE: Because of T199393, the accounts have to be created sequentially.
|
||||||
// Doing so in parallel triggers a race condition that often results in a DBQueryError.
|
// Doing so in parallel triggers a race condition that often results in a DBQueryError.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// @vue/component
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// @vue/component
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
// @vue/component
|
||||||
module.exports = {
|
module.exports = {
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
*/
|
*/
|
||||||
QUnit.fixurl = function ( value ) {
|
QUnit.fixurl = function ( value ) {
|
||||||
return value + ( /\?/.test( value ) ? '&' : '?' ) +
|
return value + ( /\?/.test( value ) ? '&' : '?' ) +
|
||||||
String( new Date().getTime() ) +
|
String( Date.now() ) +
|
||||||
String( parseInt( Math.random() * 100000, 10 ) );
|
String( parseInt( Math.random() * 100000, 10 ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
// something is minified, there are occasionally line breaks inserted after
|
// something is minified, there are occasionally line breaks inserted after
|
||||||
// every few thousand bytes, which means the test result changes over time
|
// every few thousand bytes, which means the test result changes over time
|
||||||
// based on the code above.
|
// based on the code above.
|
||||||
// eslint-disable-next-line no-multi-str, no-eval
|
// eslint-disable-next-line no-eval
|
||||||
eval( "({\
|
eval( "({\
|
||||||
main: 'init.js',\
|
main: 'init.js',\
|
||||||
files: {\
|
files: {\
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
assert.strictEqual( typeof mw.now(), 'number', 'Return a number' );
|
assert.strictEqual( typeof mw.now(), 'number', 'Return a number' );
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
String( Math.round( mw.now() ) ).length,
|
String( Math.round( mw.now() ) ).length,
|
||||||
String( +new Date() ).length,
|
String( Date.now() ).length,
|
||||||
'Match size of current timestamp'
|
'Match size of current timestamp'
|
||||||
);
|
);
|
||||||
} );
|
} );
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function styleTestLoop() {
|
function styleTestLoop() {
|
||||||
var styleTestSince = new Date().getTime() - styleTestStart;
|
var styleTestSince = Date.now() - styleTestStart;
|
||||||
// If it is passing or if we timed out, run the real test and stop the loop
|
// If it is passing or if we timed out, run the real test and stop the loop
|
||||||
if ( isCssImportApplied() || styleTestSince > styleTestTimeout ) {
|
if ( isCssImportApplied() || styleTestSince > styleTestTimeout ) {
|
||||||
assert.strictEqual( $element.css( prop ), val,
|
assert.strictEqual( $element.css( prop ), val,
|
||||||
|
|
@ -101,7 +101,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the loop
|
// Start the loop
|
||||||
styleTestStart = new Date().getTime();
|
styleTestStart = Date.now();
|
||||||
styleTestLoop();
|
styleTestLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
var clock = this.clock = this.sandbox.useFakeTimers();
|
var clock = this.clock = this.sandbox.useFakeTimers();
|
||||||
|
|
||||||
this.sandbox.stub( mw, 'now', function () {
|
this.sandbox.stub( mw, 'now', function () {
|
||||||
return +new Date();
|
return Date.now();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
this.tick = function ( forward ) {
|
this.tick = function ( forward ) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue