diff --git a/build/screenshots.userGuide.js b/build/screenshots.userGuide.js index d57fa171ed..6547f4c1ec 100644 --- a/build/screenshots.userGuide.js +++ b/build/screenshots.userGuide.js @@ -1,4 +1,5 @@ /* global seleniumUtils, langs */ +/* eslint-disable jquery/no-global-selector */ ( function () { 'use strict'; diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js index 67c6cb584b..d1f6304b62 100644 --- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js +++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.init.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + ( function () { var target, $specialTab = $( '#ca-nstab-special' ), diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js index 8f04f8b192..da1cc080e1 100644 --- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js +++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js @@ -41,6 +41,7 @@ ve.init.mw.CollabTarget = function VeInitMwCollabTarget( title, rebaserUrl, conf ve.ui.commandRegistry.unregister( 'referencesList' ); ve.ui.commandRegistry.unregister( 'citefromid' ); + // eslint-disable-next-line jquery/no-global-selector this.$editableContent = $( '#mw-content-text' ); this.toolbarExportButton = new OO.ui.ButtonWidget( { diff --git a/modules/ve-mw-collab/ve.init.mw.DesktopCollabTarget.js b/modules/ve-mw-collab/ve.init.mw.DesktopCollabTarget.js index d9dfdb64b0..013466075b 100644 --- a/modules/ve-mw-collab/ve.init.mw.DesktopCollabTarget.js +++ b/modules/ve-mw-collab/ve.init.mw.DesktopCollabTarget.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + /** * MediaWiki mobile article target. * diff --git a/modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js b/modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js index 47495b361f..ad64f0a3e5 100644 --- a/modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js +++ b/modules/ve-mw-collab/ve.init.mw.MobileCollabTarget.js @@ -24,7 +24,7 @@ ve.init.mw.MobileCollabTarget = function VeInitMwMobileCollabTarget( title, reba // Initialization this.$element.addClass( 've-init-mw-mobileArticleTarget ve-init-mw-mobileCollabTarget' ); - $( 'body' ).removeClass( 'ns-special' ); + $( document.body ).removeClass( 'ns-special' ); }; /* Inheritance */ diff --git a/modules/ve-mw-collab/ve.ui.MWExportWikitextDialog.js b/modules/ve-mw-collab/ve.ui.MWExportWikitextDialog.js index 02273404a7..fdaa8a980e 100644 --- a/modules/ve-mw-collab/ve.ui.MWExportWikitextDialog.js +++ b/modules/ve-mw-collab/ve.ui.MWExportWikitextDialog.js @@ -174,7 +174,7 @@ ve.ui.MWExportWikitextDialog.prototype.export = function () { } // Submit the form, mimicking a traditional edit // Firefox requires the form to be attached - $form.attr( 'action', submitUrl ).appendTo( 'body' ).submit(); + $form.attr( 'action', submitUrl ).appendTo( 'body' ).trigger( 'submit' ); }; /* Registration */ diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js index 1d74407be5..e89aae27aa 100644 --- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js +++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js @@ -86,7 +86,7 @@ ve.ce.MWBlockImageNode.static.renderHtmlAttributes = false; ve.ce.MWBlockImageNode.static.transition = false; ve.ce.MWBlockImageNode.static.cssClasses = { - 'default': { + default: { left: 'mw-halign-left', right: 'mw-halign-right', center: 'mw-halign-center', diff --git a/modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.js b/modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.js index 61c5ceebb4..94634d5cd1 100644 --- a/modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.js +++ b/modules/ve-mw/dm/models/ve.dm.MWTemplateSpecModel.js @@ -113,7 +113,7 @@ ve.dm.MWTemplateSpecModel.prototype.getDefaultParameterSpec = function ( name ) return { label: name, description: null, - 'default': '', + default: '', type: 'string', aliases: [], name: name, diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js index b9daba308e..58b4014703 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js @@ -9,6 +9,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + /** * Platform preparation for the MediaWiki view page. This loads (when user needs it) the * actual MediaWiki integration and VisualEditor library. diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index d61eadb3fb..ca39aeb435 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + /** * MediaWiki desktop article target. * diff --git a/modules/ve-mw/init/ve.init.MWVESwitchConfirmDialog.js b/modules/ve-mw/init/ve.init.MWVESwitchConfirmDialog.js index d73d6e25cd..568bfb3213 100644 --- a/modules/ve-mw/init/ve.init.MWVESwitchConfirmDialog.js +++ b/modules/ve-mw/init/ve.init.MWVESwitchConfirmDialog.js @@ -67,6 +67,7 @@ mw.libs.ve.SwitchConfirmDialog.prototype.getSetupProcess = function ( data ) { this.actions.setMode( data.mode ); } else if ( mw.config.get( 'wgVisualEditorConfig' ).fullRestbaseUrl && + // eslint-disable-next-line jquery/no-global-selector !$( 'input[name=wpSection]' ).val() ) { this.actions.setMode( 'restbase' ); diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js index 639cdec829..7c4fef5109 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + /* global EasyDeflate */ /** @@ -63,7 +65,11 @@ ve.init.mw.ArticleTarget = function VeInitMwArticleTarget( config ) { action: 'submit', veswitched: 1 } ); - this.events = { track: $.noop, trackActivationStart: $.noop, trackActivationComplete: $.noop }; + this.events = { + track: function () {}, + trackActivationStart: function () {}, + trackActivationComplete: function () {} + }; this.welcomeDialog = null; this.welcomeDialogPromise = null; @@ -1754,7 +1760,7 @@ ve.init.mw.ArticleTarget.prototype.submit = function ( wikitext, fields ) { } // Submit the form, mimicking a traditional edit // Firefox requires the form to be attached - $form.attr( 'action', this.submitUrl ).appendTo( 'body' ).submit(); + $form.attr( 'action', this.submitUrl ).appendTo( 'body' ).trigger( 'submit' ); return true; }; diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js index 8ab63a5a25..6e2503a760 100644 --- a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js +++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js @@ -253,6 +253,7 @@ if ( // wikitext can be an empty string options.wikitext !== undefined && + // eslint-disable-next-line jquery/no-global-selector !$( '[name=wpSection]' ).val() ) { if ( conf.fullRestbaseUrl ) { diff --git a/modules/ve-mw/init/ve.init.mw.DiffPage.init.js b/modules/ve-mw/init/ve.init.mw.DiffPage.init.js index 9f95418cba..239ffbe94d 100644 --- a/modules/ve-mw/init/ve.init.mw.DiffPage.init.js +++ b/modules/ve-mw/init/ve.init.mw.DiffPage.init.js @@ -5,6 +5,8 @@ * @license The MIT License (MIT); see LICENSE.txt */ +/* eslint-disable jquery/no-global-selector */ + ( function () { var reviewModeButtonSelect, diffElement, lastDiff, $wikitextDiffContainer, $wikitextDiffHeader, $wikitextDiffBody, diff --git a/modules/ve-mw/init/ve.init.mw.LinkCache.js b/modules/ve-mw/init/ve.init.mw.LinkCache.js index 930fc9b977..6e24e13006 100644 --- a/modules/ve-mw/init/ve.init.mw.LinkCache.js +++ b/modules/ve-mw/init/ve.init.mw.LinkCache.js @@ -189,6 +189,6 @@ ve.init.mw.LinkCache.prototype.getRequestPromise = function ( subqueue ) { pilimit: subqueue.length, ppprop: 'disambiguation|hiddencat', titles: subqueue, - 'continue': '' + continue: '' } ); }; diff --git a/modules/ve-mw/tests/.eslintrc.json b/modules/ve-mw/tests/.eslintrc.json index 8907117533..4a4e3f724a 100644 --- a/modules/ve-mw/tests/.eslintrc.json +++ b/modules/ve-mw/tests/.eslintrc.json @@ -8,5 +8,8 @@ }, "globals": { "sinon": false + }, + "rules": { + "jquery/no-parse-html-literal": "off" } } diff --git a/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js b/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js index b797b07f33..bb25e96ad5 100644 --- a/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js +++ b/modules/ve-mw/tests/init/targets/ve.init.mw.DesktopArticleTarget.test.js @@ -26,7 +26,7 @@ QUnit.test( 'init', function ( assert ) { tooltip: 'minoredit', 'label-id': 'mw-editpage-minoredit', 'legacy-name': 'minor', - 'default': false + default: false }, wpWatchthis: { id: 'wpWatchthis', @@ -34,7 +34,7 @@ QUnit.test( 'init', function ( assert ) { tooltip: 'watch', 'label-id': 'mw-editpage-watch', 'legacy-name': 'watch', - 'default': true + default: true } }, checkboxesMessages: { diff --git a/modules/ve-mw/tests/ve.test.utils.js b/modules/ve-mw/tests/ve.test.utils.js index 96bb58a304..3e62344a50 100644 --- a/modules/ve-mw/tests/ve.test.utils.js +++ b/modules/ve-mw/tests/ve.test.utils.js @@ -90,6 +90,7 @@ ve.init.target = mwTarget; mw.libs.ve.setEditorPreference = dummySetEditorPreference; // Ensure the current target is appended to the current fixture + // eslint-disable-next-line jquery/no-global-selector $( '#qunit-fixture' ).append( ve.init.target.$element ); } diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js index 9f4ced34d0..c5ff2788be 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js @@ -468,6 +468,8 @@ ve.ui.MWSaveDialog.prototype.showMessage = function ( name, message, options ) { } this.$saveMessages.append( $message.css( 'display', 'none' ) ); + // FIXME: Use CSS transitions + // eslint-disable-next-line jquery/no-slide $message.slideDown( { duration: 250, progress: this.updateSize.bind( this ) diff --git a/modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js b/modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js index 61ed182c45..f140e4e780 100644 --- a/modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js +++ b/modules/ve-mw/ui/pages/ve.ui.MWAdvancedSettingsPage.js @@ -82,6 +82,7 @@ ve.ui.MWAdvancedSettingsPage = function VeUiMWAdvancedSettingsPage( name, config $overlay: config.$overlay, align: 'top', label: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-label' ), + // eslint-disable-next-line jquery/no-global-selector help: ve.msg( 'visualeditor-dialog-meta-settings-newsectioneditlink-help', $( '#ca-edit' ).text() ) } ); diff --git a/modules/ve-mw/ui/ve.ui.MWWikitextSurface.js b/modules/ve-mw/ui/ve.ui.MWWikitextSurface.js index 2b6d90478f..54fb43143d 100644 --- a/modules/ve-mw/ui/ve.ui.MWWikitextSurface.js +++ b/modules/ve-mw/ui/ve.ui.MWWikitextSurface.js @@ -26,6 +26,7 @@ ve.ui.MWWikitextSurface = function VeUiMWWikitextSurface() { this.$element.addClass( 've-ui-mwWikitextSurface' ); this.getView().$element.addClass( 'mw-editfont-' + mw.user.options.get( 'editfont' ) ); this.$placeholder.addClass( 'mw-editfont-' + mw.user.options.get( 'editfont' ) ); + // eslint-disable-next-line jquery/no-global-selector this.$textbox = $( '#wpTextbox1' ); if ( !this.$textbox.length ) { diff --git a/package.json b/package.json index 61a5d0e8c9..b8ad2bb4fa 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "screenshots-all": "grunt screenshots-all" }, "devDependencies": { - "eslint-config-wikimedia": "0.9.0", + "eslint-config-wikimedia": "0.10.0", "grunt": "1.0.3", "grunt-banana-checker": "0.6.0", "grunt-contrib-copy": "1.0.0",