jenkins-bot has submitted this change and it was merged.
Change subject: Copy jshint from core and update accordingly.
......................................................................
Copy jshint from core and update accordingly.
* Only modification is to remove nomen due to guiders identifiers
with a leading underscore
Change-Id: I98822f67317bbb014925b7427db25539c40a6628
---
M .jshintrc
M modules/ext.guidedTour.lib.js
M
modules/externals/mediawiki.libs.guiders/mediawiki.libs.guiders.exposeGuiders.js
3 files changed, 51 insertions(+), 21 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.jshintrc b/.jshintrc
index 178d624..e278a9c 100755
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,13 +1,33 @@
{
- "globals": {
- "QUnit": true
- },
- "maxerr": 50,
- "newcap": false,
- "plusplus": false,
- "regexdash": true,
- "supernew": true,
- "white": false,
+ "predef": [
+ "mediaWiki",
+ "jQuery",
+ "QUnit"
+ ],
+
+ "bitwise": true,
+ "camelcase": true,
+ "curly": true,
+ "eqeqeq": true,
+ "forin": false,
+ "immed": true,
"latedef": true,
- "unused": true
+ "newcap": true,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "quotmark": "single",
+ "regexp": false,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+ "trailing": true,
+
+ "laxbreak": true,
+ "smarttabs": true,
+ "multistr": true,
+
+ "browser": true,
+
+ "onevar": true
}
diff --git a/modules/ext.guidedTour.lib.js b/modules/ext.guidedTour.lib.js
index 18a3f7e..0c293d7 100644
--- a/modules/ext.guidedTour.lib.js
+++ b/modules/ext.guidedTour.lib.js
@@ -184,6 +184,8 @@
* @return {void}
*/
function callApi ( guider, source ) {
+ var ajaxParams, data;
+
if ( source !== 'page' && source !== 'text' ) {
mw.log( 'callApi called incorrectly' );
return;
@@ -195,7 +197,7 @@
return;
}
- var ajaxParams = {
+ ajaxParams = {
async: false,
type: 'POST',
url: mw.util.wikiScript( 'api' ),
@@ -207,7 +209,7 @@
ajaxParams.data[source] = guider.description;
// parse (make synchronous API request)
- var data = JSON.parse(
+ data = JSON.parse(
$.ajax( ajaxParams ).responseText
);
if ( data.error ) {
@@ -368,7 +370,7 @@
* @throws {mw.guidedTour.TourDefinitionError} On invalid actions
*/
function getButtons( buttonSpecs ) {
- var okayButton, guiderButtons, currentButton, url;
+ var i, okayButton, guiderButtons, currentButton, url;
function next() {
guiders.next();
@@ -380,7 +382,7 @@
buttonSpecs = buttonSpecs || [];
guiderButtons = [];
- for ( var i = 0; i < buttonSpecs.length; i++ ) {
+ for ( i = 0; i < buttonSpecs.length; i++ ) {
currentButton = buttonSpecs[i];
if ( currentButton.action !== undefined ) {
switch ( currentButton.action ) {
@@ -634,13 +636,15 @@
* @return {string} return.step Tour step
*/
parseTourId: function ( tourId ) {
+ // Keep in sync with regex in GuidedTourHooks.php
+ var TOUR_ID_REGEX = /^gt-([^.\-]+)-(\d+)$/,
+ tourMatch, tourName, tourStep;
+
if ( typeof tourId !== 'string' ) {
return null;
}
- // Keep in sync with regex in GuidedTourHooks.php
- var TOUR_ID_REGEX = /^gt-([^.-]+)-(\d+)$/;
- var tourMatch = tourId.match( TOUR_ID_REGEX ),
tourName, tourStep;
+ tourMatch = tourId.match( TOUR_ID_REGEX );
if ( ! tourMatch ) {
return null;
}
@@ -755,14 +759,14 @@
*/
launchTourFromEnvironment: function () {
// Tour is either in the query string or cookie (prefer
query string)
- var tourName = mw.util.getParamValue( 'tour' );
- var tourId, tourInfo;
+ var tourName = mw.util.getParamValue( 'tour' ), tourId,
+ tourInfo, step;
//clean out path variables
if ( tourName ) {
tourName = cleanTourName( tourName );
}
if ( tourName !== null && tourName.length !== 0 ) {
- var step = mw.util.getParamValue( 'step' );
+ step = mw.util.getParamValue( 'step' );
if ( step === null || step === '' ) {
step = '1';
}
@@ -954,8 +958,9 @@
} );
if ( (step === 0) && $.cookie( guiders.cookie ) ) {
// start from cookie position
- if ( guiders.resume() )
+ if ( guiders.resume() ) {
return;
+ }
}
if (step === 0) {
diff --git
a/modules/externals/mediawiki.libs.guiders/mediawiki.libs.guiders.exposeGuiders.js
b/modules/externals/mediawiki.libs.guiders/mediawiki.libs.guiders.exposeGuiders.js
index c251664..b366d22 100644
---
a/modules/externals/mediawiki.libs.guiders/mediawiki.libs.guiders.exposeGuiders.js
+++
b/modules/externals/mediawiki.libs.guiders/mediawiki.libs.guiders.exposeGuiders.js
@@ -1,8 +1,13 @@
+/*global guiders: false */
( function ( mw ) {
+
/* This is in the same module as the guiders code from the submodule.
Capture it
* in mw.libs
* (per
https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Globals)
* before we leave the module/anonymous function.
+ *
+ * It is not actually global in production mode; that just suppresses an
+ * inapplicable jshint warning on this file.
*/
mw.libs.guiders = guiders;
}( mediaWiki ) );
--
To view, visit https://gerrit.wikimedia.org/r/54629
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I98822f67317bbb014925b7427db25539c40a6628
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GuidedTour
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits