jenkins-bot has submitted this change and it was merged.

Change subject: jshint, gruntfile, and compatibility fixes
......................................................................


jshint, gruntfile, and compatibility fixes

Wow, we weren't actually checking anything except the Gruntfile.
Now enforcing ES3 on the whole shebang to avoid old browser breakage.

Bug: T136408, T136387
Change-Id: Ia57448377237fb507ce046b45b61f50116538d3e
---
M .jshintrc
M CentralNotice.modules.php
M Gruntfile.js
M resources/infrastructure/ext.centralNotice.adminUi.campaignPager.js
M resources/subscribing/ext.centralNotice.display.js
M resources/subscribing/ext.centralNotice.display.state.js
M resources/subscribing/ext.centralNotice.impressionDiet.js
M resources/subscribing/ext.centralNotice.kvStore.js
M resources/subscribing/ext.centralNotice.largeBannerLimit.js
M tests/qunit/subscribing/ext.centralNotice.display.tests.js
10 files changed, 24 insertions(+), 16 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintrc b/.jshintrc
index 6a6491e..338b8eb 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -2,7 +2,8 @@
        "predef": [
                "jQuery",
                "mediaWiki",
-               "QUnit"
+               "QUnit",
+               "JSON"
        ],
 
        "undef": true,
@@ -11,5 +12,7 @@
 
        "laxbreak": true,
 
-       "browser": true
+       "browser": true,
+
+       "es3": true
 }
diff --git a/CentralNotice.modules.php b/CentralNotice.modules.php
index cde693e..02c0bd4 100644
--- a/CentralNotice.modules.php
+++ b/CentralNotice.modules.php
@@ -50,7 +50,8 @@
        'remoteExtPath' => 'CentralNotice/resources',
        'dependencies' => array(
                'jquery.ui.datepicker',
-               'jquery.ui.multiselect'
+               'jquery.ui.multiselect',
+               'json'
        ),
        'scripts'       => 'infrastructure/centralnotice.js',
        'styles'        => array(
diff --git a/Gruntfile.js b/Gruntfile.js
index a2517cb..eaed9d5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -10,7 +10,10 @@
                                jshintrc: true
                        },
                        all: [
-                               '*.js'
+                               '**/*.js',
+                               '!node_modules/**',
+                               '!vendor/**',
+                               '!resources/vendor/**'
                        ]
                },
                banana: {
diff --git 
a/resources/infrastructure/ext.centralNotice.adminUi.campaignPager.js 
b/resources/infrastructure/ext.centralNotice.adminUi.campaignPager.js
index cb0c3fb..175e65b 100644
--- a/resources/infrastructure/ext.centralNotice.adminUi.campaignPager.js
+++ b/resources/infrastructure/ext.centralNotice.adminUi.campaignPager.js
@@ -68,7 +68,7 @@
                setChange(
                        $this.data( 'campaignName' ),
                        'priority',
-                       parseInt( $this.val() ), // Munge to int for comparison 
needs
+                       parseInt( $this.val(), 10 ), // Munge to int for 
comparison needs
                        $this.data( 'initialValue' ) // jQuery munges to int
                );
        }
@@ -147,4 +147,4 @@
                        $( '#cn-campaign-pager-submit' ).click( submitChanges );
                }
        } );
-} )( mediaWiki, jQuery );
\ No newline at end of file
+} )( mediaWiki, jQuery );
diff --git a/resources/subscribing/ext.centralNotice.display.js 
b/resources/subscribing/ext.centralNotice.display.js
index e160de3..84e642f 100644
--- a/resources/subscribing/ext.centralNotice.display.js
+++ b/resources/subscribing/ext.centralNotice.display.js
@@ -551,7 +551,7 @@
                 * @param {string} identifier A string to identify the test. 
Should not contain
                 *   commas.
                 */
-               registerTest( identifier ) {
+               registerTest: function( identifier ) {
                        cn.internal.state.registerTest( identifier );
                },
 
diff --git a/resources/subscribing/ext.centralNotice.display.state.js 
b/resources/subscribing/ext.centralNotice.display.state.js
index 641df6b..149698a 100644
--- a/resources/subscribing/ext.centralNotice.display.state.js
+++ b/resources/subscribing/ext.centralNotice.display.state.js
@@ -358,7 +358,7 @@
                 * @param {string} identifier A string to identify the test. 
Should not contain
                 *   commas.
                 */
-               registerTest( identifier ) {
+               registerTest: function( identifier ) {
                        var tests = state.data.tests = state.data.tests || [];
 
                        // Add if it isn't already registered.
diff --git a/resources/subscribing/ext.centralNotice.impressionDiet.js 
b/resources/subscribing/ext.centralNotice.impressionDiet.js
index 8927b37..a546ba8 100644
--- a/resources/subscribing/ext.centralNotice.impressionDiet.js
+++ b/resources/subscribing/ext.centralNotice.impressionDiet.js
@@ -164,10 +164,10 @@
                waitData = ( rawWaitCookie || '' ) .split( /[|]/ );
 
                cookieCounts = {
-                       seenCount: parseInt( rawCookie ) || 0,
-                       waitCount: parseInt( waitData[0] ) || 0,
-                       waitUntil: parseInt( waitData[1] ) || 0,
-                       waitSeenCount: parseInt( waitData[2] ) || 0
+                       seenCount: parseInt( rawCookie, 10 ) || 0,
+                       waitCount: parseInt( waitData[0], 10 ) || 0,
+                       waitUntil: parseInt( waitData[1], 10 ) || 0,
+                       waitSeenCount: parseInt( waitData[2], 10 ) || 0
                };
 
                storeCounts( cookieCounts );
diff --git a/resources/subscribing/ext.centralNotice.kvStore.js 
b/resources/subscribing/ext.centralNotice.kvStore.js
index 4fea2d3..caeb4c1 100644
--- a/resources/subscribing/ext.centralNotice.kvStore.js
+++ b/resources/subscribing/ext.centralNotice.kvStore.js
@@ -263,9 +263,9 @@
 
                                try {
                                        localStorage.removeItem( lsKey );
-                               } catch ( e ) {
+                               } catch ( ex ) {
                                        setError( 'Couldn\'t remove value due 
to LocalStorage exception ' +
-                                               e.toString(), key, rawValue, 
context );
+                                               ex.toString(), key, rawValue, 
context );
                                }
 
                                return null;
@@ -535,4 +535,4 @@
                }
        };
 
-} )( jQuery, mediaWiki );
\ No newline at end of file
+} )( jQuery, mediaWiki );
diff --git a/resources/subscribing/ext.centralNotice.largeBannerLimit.js 
b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
index bb30292..89585bd 100644
--- a/resources/subscribing/ext.centralNotice.largeBannerLimit.js
+++ b/resources/subscribing/ext.centralNotice.largeBannerLimit.js
@@ -9,6 +9,7 @@
  * 
https://meta.wikimedia.org/wiki/MediaWiki:FR2014/Resources/ShowHideCheckFullscreen.js
  * 
https://meta.wikimedia.org/wiki/MediaWiki:FR2014/Resources/ChangeBucket-AtoC-BtoD.js
  */
+// jshint unused:false
 ( function ( mw ) {
        'use strict';
 
diff --git a/tests/qunit/subscribing/ext.centralNotice.display.tests.js 
b/tests/qunit/subscribing/ext.centralNotice.display.tests.js
index e3b89ac..7990ba6 100644
--- a/tests/qunit/subscribing/ext.centralNotice.display.tests.js
+++ b/tests/qunit/subscribing/ext.centralNotice.display.tests.js
@@ -119,7 +119,7 @@
                                        }
                                ],
                                mixins: { 'testMixin': [ 'arg1', 'arg2' ] }
-                       },
+                       }
                ];
 
        // Make this property configurable before the first time it's set,

-- 
To view, visit https://gerrit.wikimedia.org/r/291264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia57448377237fb507ce046b45b61f50116538d3e
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Ssmith <[email protected]>
Gerrit-Reviewer: Strainu <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to