build: Update eslint-config-wikimedia to 0.21.0

Change-Id: I87bca80d107c965296af74e16961cd855d72b806
This commit is contained in:
Ed Sanders 2022-02-07 17:26:29 +00:00
parent 07f1703a5d
commit 7fea791042
10 changed files with 6439 additions and 359 deletions

View file

@ -1,15 +1,6 @@
{ {
"root": true, "root": true,
"extends": [ "extends": [
"wikimedia/client-es5", "wikimedia/server"
"wikimedia/jquery", ]
"wikimedia/mediawiki"
],
"env": {
"commonjs": true
},
"rules": {
"max-len": "off",
"no-jquery/no-global-selector": "off"
}
} }

View file

@ -1,6 +1,7 @@
/* eslint-env node */ 'use strict';
module.exports = function ( grunt ) { module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' ); const conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' ); grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-eslint' ); grunt.loadNpmTasks( 'grunt-eslint' );

15
modules/.eslintrc.json Normal file
View file

@ -0,0 +1,15 @@
{
"root": true,
"extends": [
"wikimedia/client-es5",
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"env": {
"commonjs": true
},
"rules": {
"max-len": "off",
"no-jquery/no-global-selector": "off"
}
}

View file

@ -13,7 +13,7 @@ function InsertLinkTitleOptionWidget( config ) {
config.icon = 'linkExternal'; config.icon = 'linkExternal';
config.description = mw.msg( 'wikieditor-toolbar-tool-link-int-target-status-external' ); config.description = mw.msg( 'wikieditor-toolbar-tool-link-int-target-status-external' );
// Lowercase the first character; it was uppercased by the API. // Lowercase the first character; it was uppercased by the API.
config.url = config.data.substr( 0, 1 ).toLowerCase() + config.data.substr( 1 ); config.url = config.data.slice( 0, 1 ).toLowerCase() + config.data.slice( 1 );
config.data = config.url; config.data = config.url;
// Prepend http:// if there is no protocol (i.e. if it starts with "www."). // Prepend http:// if there is no protocol (i.e. if it starts with "www.").
// @TODO This is repeated when the link is inserted (in jquery.wikiEditor.dialogs.config.js). // @TODO This is repeated when the link is inserted (in jquery.wikiEditor.dialogs.config.js).

View file

@ -305,10 +305,8 @@
target = text = selection.trim(); target = text = selection.trim();
if ( target.length < selection.length ) { if ( target.length < selection.length ) {
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ $( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [
selection.substr( 0, selection.indexOf( target.charAt( 0 ) ) ), selection.slice( 0, selection.indexOf( target.charAt( 0 ) ) ),
selection.substr( selection.slice( selection.lastIndexOf( target.charAt( target.length - 1 ) ) + 1 ) ]
selection.lastIndexOf( target.charAt( target.length - 1 ) ) + 1
) ]
); );
} }
} }
@ -696,7 +694,7 @@
} }
// Replace trailing space by newline // Replace trailing space by newline
// table[table.length - 1] is read-only // table[table.length - 1] is read-only
table = table.substr( 0, table.length - 1 ) + '\n'; table = table.slice( 0, table.length - 1 ) + '\n';
} }
var classes = []; var classes = [];
if ( $( '#wikieditor-toolbar-table-wikitable' ).is( ':checked' ) ) { if ( $( '#wikieditor-toolbar-table-wikitable' ).is( ':checked' ) ) {
@ -825,7 +823,7 @@
} else { } else {
offset = $( this ).data( 'offset' ); offset = $( this ).data( 'offset' );
} }
textRemainder = text.substr( offset ); textRemainder = text.slice( offset );
match = textRemainder.match( regex ); match = textRemainder.match( regex );
} }
if ( !match ) { if ( !match ) {
@ -872,7 +870,7 @@
// Find the next instance // Find the next instance
offset = offset + match.index + actualReplacement.length; offset = offset + match.index + actualReplacement.length;
textRemainder = text.substr( offset ); textRemainder = text.slice( offset );
match = textRemainder.match( regex ); match = textRemainder.match( regex );
if ( match ) { if ( match ) {

View file

@ -195,12 +195,12 @@
var src = icon[ key ]; var src = icon[ key ];
// Return a data URL immediately // Return a data URL immediately
if ( src.substr( 0, 5 ) === 'data:' ) { if ( src.slice( 0, 5 ) === 'data:' ) {
return src; return src;
} }
// Prepend path if src is not absolute // Prepend path if src is not absolute
if ( src.substr( 0, 7 ) !== 'http://' && src.substr( 0, 8 ) !== 'https://' && src[ 0 ] !== '/' ) { if ( src.slice( 0, 7 ) !== 'http://' && src.slice( 0, 8 ) !== 'https://' && src[ 0 ] !== '/' ) {
src = path + src; src = path + src;
} }
return src; return src;

View file

@ -365,7 +365,7 @@
} }
return $button; return $button;
case 'select': case 'select':
var menuId = 'menu-' + ( new Date() ).getTime(); var menuId = 'menu-' + Date.now();
var $select = $( '<div>' ) var $select = $( '<div>' )
.attr( { rel: id, class: 'tool tool-select' } ); .attr( { rel: id, class: 'tool tool-select' } );
var $options = $( '<div>' ).addClass( 'options' ); var $options = $( '<div>' ).addClass( 'options' );

6741
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
"test": "grunt test" "test": "grunt test"
}, },
"devDependencies": { "devDependencies": {
"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-eslint": "23.0.0", "grunt-eslint": "23.0.0",

View file

@ -1,6 +1,6 @@
{ {
"extends": [ "extends": [
"wikimedia/qunit", "wikimedia/qunit",
"../../.eslintrc.json" "../../modules/.eslintrc.json"
] ]
} }