jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/355419 )

Change subject: Tools: Use eslint instead of jshint & jscs
......................................................................


Tools: Use eslint instead of jshint & jscs

Bug: T149201
Change-Id: I9578d5669ef7f5a68e267370a522cec8051092bc
---
A .eslintrc.json
D .jscsrc
D .jshintignore
D .jshintrc
M Gruntfile.js
M package.json
M resources/CardListView.js
M resources/CardModel.js
M resources/CardView.js
M resources/CardsGateway.js
M resources/init.js
M resources/muhogan.js
12 files changed, 52 insertions(+), 65 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jdlrobson: Looks good to me, approved



diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..1dc4bf0
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,15 @@
+{
+       "extends": "wikimedia",
+       "env": {
+               "browser": true,
+               "jquery": true,
+               "qunit": true
+       },
+       "globals": {
+               "mediaWiki": false,
+               "OO": false
+       },
+       "rules": {
+               "dot-notation": [ "error", { "allowKeywords": true } ]
+       }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index dc37ba8..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-       "preset": "wikimedia",
-       "disallowDanglingUnderscores": null
-}
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index 0ecd6aa..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-node_modules/**
-lib/CSS.escape/**
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 94a0d01..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-       "globals": {
-               "console": true,
-               "jQuery": true,
-               "JsDiff": true,
-               "Hogan": true,
-               "QUnit": true,
-               "mw": true,
-               "CodeMirror": true,
-               "OO": true
-       },
-
-       "browser": true,
-       "curly": true,
-       "eqeqeq": true,
-       "forin": false,
-       "onevar": true,
-       "trailing": true,
-       "undef" : true,
-       "unused": true,
-       "supernew": true
-}
diff --git a/Gruntfile.js b/Gruntfile.js
index 2ab9976..b2d7ca2 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,7 +1,7 @@
-/*jshint node:true */
+/* eslint-env node */
+
 module.exports = function ( grunt ) {
-       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
-       grunt.loadNpmTasks( 'grunt-jscs' );
+       grunt.loadNpmTasks( 'grunt-eslint' );
        grunt.loadNpmTasks( 'grunt-jsonlint' );
        grunt.loadNpmTasks( 'grunt-banana-checker' );
        grunt.loadNpmTasks( 'grunt-jsduck' );
@@ -14,17 +14,11 @@
                banana: {
                        all: 'i18n/'
                },
-               jscs: {
-                       src: '<%= files.js %>'
-               },
-               jshint: {
-                       options: {
-                               jshintrc: true
-                       },
+               eslint: {
                        all: [
-                               '.',
                                '!node_modules/**',
-                               '!lib/CSS.escape/**'
+                               '!lib/CSS.escape/**',
+                               '<%= files.js %>'
                        ]
                },
                jsonlint: {
@@ -64,7 +58,7 @@
                }
        } );
 
-       grunt.registerTask( 'lint', [ 'jshint', 'jscs', 'jsonlint', 'banana', 
'stylelint' ] );
+       grunt.registerTask( 'lint', [ 'eslint', 'jsonlint', 'banana', 
'stylelint' ] );
        grunt.registerTask( 'test', [ 'lint' ] );
        grunt.registerTask( 'doc', [ 'jsduck' ] );
        grunt.registerTask( 'default', 'test' );
diff --git a/package.json b/package.json
index 4bf3539..c117753 100644
--- a/package.json
+++ b/package.json
@@ -6,11 +6,14 @@
     "doc": "grunt doc"
   },
   "devDependencies": {
+    "eslint": "^3.19.0",
+    "eslint-config-wikimedia": "^0.4.0",
     "grunt": "0.4.5",
     "grunt-banana-checker": "0.4.0",
-    "grunt-contrib-jshint": "1.0.0",
-    "grunt-jscs": "2.8.0",
     "grunt-cli": "0.1.13",
+    "grunt-contrib-jshint": "1.0.0",
+    "grunt-eslint": "^19.0.0",
+    "grunt-jscs": "2.8.0",
     "grunt-jsduck": "^1.0.1",
     "grunt-jsonlint": "1.0.7",
     "grunt-stylelint": "0.6.0",
diff --git a/resources/CardListView.js b/resources/CardListView.js
index 2726a1b..d2ecce3 100644
--- a/resources/CardListView.js
+++ b/resources/CardListView.js
@@ -1,4 +1,4 @@
-( function ( $ ) {
+( function ( $, mw ) {
        'use strict';
 
        /**
@@ -34,4 +34,4 @@
        CardListView.prototype.template = mw.template.get( 'ext.cards', 
'cards.muhogan' );
 
        mw.cards.CardListView = CardListView;
-} )( jQuery );
+}( jQuery, mediaWiki ) );
diff --git a/resources/CardModel.js b/resources/CardModel.js
index 63797dd..ac12a4b 100644
--- a/resources/CardModel.js
+++ b/resources/CardModel.js
@@ -1,4 +1,4 @@
-( function () {
+( function ( mw ) {
        'use strict';
 
        /**
@@ -53,4 +53,4 @@
        };
 
        mw.cards.CardModel = CardModel;
-} )();
+}( mediaWiki ) );
diff --git a/resources/CardView.js b/resources/CardView.js
index d0c6ed4..6b6c91b 100644
--- a/resources/CardView.js
+++ b/resources/CardView.js
@@ -1,4 +1,5 @@
-( function ( $ ) {
+/* eslint-disable no-underscore-dangle */
+( function ( $, mw ) {
        'use strict';
 
        /**
@@ -40,6 +41,7 @@
         * Renders the template using the model attributes.
         *
         * @ignore
+        * @return {string}
         */
        CardView.prototype._render = function () {
                var attributes = $.extend( {}, this.model.attributes );
@@ -49,4 +51,4 @@
        };
 
        mw.cards.CardView = CardView;
-} )( jQuery );
+}( jQuery, mediaWiki ) );
diff --git a/resources/CardsGateway.js b/resources/CardsGateway.js
index 4086c8f..9ea8dda 100644
--- a/resources/CardsGateway.js
+++ b/resources/CardsGateway.js
@@ -1,4 +1,4 @@
-( function ( $ ) {
+( function ( $, mw ) {
        'use strict';
 
        /**
@@ -9,6 +9,15 @@
                CardModel = mw.cards.CardModel,
                CardView = mw.cards.CardView,
                CardListView = mw.cards.CardListView;
+
+       /**
+        * @ignore
+        * @param {Object} thumb
+        * @return {string}
+        */
+       function isValidThumbnail( thumb ) {
+               return thumb.source.substr( 0, 7 ) === 'http://' || 
thumb.source.substr( 0, 8 ) === 'https://';
+       }
 
        /**
         * Gateway for interacting with an API
@@ -61,7 +70,7 @@
                        exsentences: 1,
                        pithumbsize: thumbWidth || THUMB_WIDTH,
                        titles: articleTitles.join( '|' ),
-                       continue: '',
+                       'continue': '',
                        formatversion: 2
                } ).done( function ( data ) {
                        if ( data.query && data.query.pages ) {
@@ -92,12 +101,5 @@
                return result;
        };
 
-       /**
-        * @ignore
-        */
-       function isValidThumbnail( thumb ) {
-               return thumb.source.substr( 0, 7 ) === 'http://' || 
thumb.source.substr( 0, 8 ) === 'https://';
-       }
-
        mw.cards.CardsGateway = CardsGateway;
-} )( jQuery );
+}( jQuery, mediaWiki ) );
diff --git a/resources/init.js b/resources/init.js
index e706610..b3df859 100644
--- a/resources/init.js
+++ b/resources/init.js
@@ -1,4 +1,4 @@
-( function () {
+( function ( mw ) {
        'use strict';
 
        /**
@@ -9,4 +9,4 @@
                models: {},
                views: {}
        };
-} )();
+}( mediaWiki ) );
diff --git a/resources/muhogan.js b/resources/muhogan.js
index 7379d6e..a7ff443 100644
--- a/resources/muhogan.js
+++ b/resources/muhogan.js
@@ -1,6 +1,5 @@
-/*jshint -W002 */
 // Register the Hogan compiler with MediaWiki.
-( function () {
+( function ( mw ) {
        var compiler;
        /*
         * Check if muhogan is already registered (by QuickSurveys). If not
@@ -11,11 +10,11 @@
        } catch ( e ) {
                try {
                        compiler = mw.template.getCompiler( 'mustache' );
-               } catch ( e ) {
+               } catch ( e2 ) {
                        compiler = mw.template.getCompiler( 'hogan' );
                }
 
                // register hybrid compiler with core
                mw.template.registerCompiler( 'muhogan', compiler );
        }
-}() );
+}( mediaWiki ) );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9578d5669ef7f5a68e267370a522cec8051092bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cards
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to