Upgrade eslint-config-wikimedia to 0.21.0

JavaScript code and comments changes:
* Remove no-multi-str disabling.
* Document $ parameter.
* Replace .substring() with .slice().
* Change assert.ok() to assert.strictEqual() in a test.
This commit is contained in:
Amir E. Aharoni
2022-01-28 13:42:19 +02:00
committed by Niklas Laxström
parent 27a8471816
commit c10140c12b
6 changed files with 1110 additions and 313 deletions

1407
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,7 @@
"Siebrand Mazeland"
],
"devDependencies": {
"eslint-config-wikimedia": "0.20.0",
"eslint-config-wikimedia": "0.21.0",
"eslint-plugin-html": "6.1.2",
"grunt": "1.4",
"grunt-contrib-qunit": "4.0.0",

View File

@@ -23,7 +23,6 @@
var template, ULS;
// Region numbers in id attributes also appear in the langdb.
// eslint-disable-next-line no-multi-str
template = '<div class="grid uls-menu"> \
<div id="search" class="row uls-search"> \
<div class="uls-search-wrapper"> \

View File

@@ -19,6 +19,8 @@
/**
* Usage: $( 'inputbox' ).languagefilter();
* The values for autocompletion is from the options.languages or options.searchAPI.
*
* @param {jQuery} $
*/
( function ( $ ) {
'use strict';
@@ -270,12 +272,12 @@
userInput = this.$element.val();
suggestion = userInput +
languageName.substring( userInput.length, languageName.length );
languageName.slice( userInput.length, languageName.length );
if ( suggestion.toLowerCase() !== languageName.toLowerCase() ) {
// see if it was autonym match
autonym = $.uls.data.getAutonym( langCode ) || '';
suggestion = userInput + autonym.substring( userInput.length, autonym.length );
suggestion = userInput + autonym.slice( userInput.length, autonym.length );
if ( suggestion !== autonym ) {
// Give up. It may be an ISO/script code match.

View File

@@ -21,7 +21,6 @@
( function ( $ ) {
'use strict';
// eslint-disable-next-line no-multi-str
var noResultsTemplate = '<div class="uls-no-results-view"> \
<h2 data-i18n="uls-no-results-found" class="uls-no-results-found-title">No results found</h2> \
<div class="uls-no-results-suggestions"></div> \

View File

@@ -19,7 +19,7 @@
QUnit.module( 'jquery.uls' );
QUnit.test( '-- Initial check', function ( assert ) {
assert.ok( $.fn.uls, '$.fn.uls is defined' );
assert.strictEqual( typeof $.fn.uls, 'function', '$.fn.uls is a function' );
} );
}( jQuery ) );