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

Change subject: build: Replace jshint and jscs with eslint
......................................................................


build: Replace jshint and jscs with eslint

Change-Id: I07e70759fcf80011d8806c04a24d392a86b3a10f
---
A .eslintrc.json
D .jscsrc
D .jshintrc
M Gruntfile.js
M build/moduleUtils.js
M build/tasks/copy.js
M build/tasks/git-build.js
M package.json
M src/unicodejs.js
M src/unicodejs.wordbreak.js
D tests/.jshintrc
M tests/unicodejs.test.js
M tools/unicodejs-properties.js
13 files changed, 44 insertions(+), 57 deletions(-)

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



diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..4e9ac70
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,17 @@
+{
+    "extends": "wikimedia",
+
+    "ecmaVersion": 5,
+    "env": {
+        "jquery": true,
+        "qunit": true
+    },
+    "globals": {
+        "unicodeJS": false
+    },
+
+    "rules": {
+        "dot-notation": [ "error", { "allowKeywords": true } ],
+        "no-fallthrough": 0
+    }
+}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 5b6f4bd..0000000
--- a/.jscsrc
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-       "preset": "wikimedia",
-
-       "requireSpacesInsideArrayBrackets": null
-}
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index a6f2e96..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-       // Enforcing
-       "bitwise": true,
-       "eqeqeq": true,
-       "freeze": true,
-       "latedef": true,
-       "noarg": true,
-       "nonew": true,
-       "undef": true,
-       "unused": true,
-
-       "globals": {
-               "unicodeJS": true
-       }
-}
diff --git a/Gruntfile.js b/Gruntfile.js
index 49e23fd..ce5fe3e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,4 +1,4 @@
-/*jshint node:true */
+/* eslint-env node */
 module.exports = function ( grunt ) {
        var modules = grunt.file.readJSON( 'build/modules.json' ),
                moduleUtils = require( './build/moduleUtils' ),
@@ -7,9 +7,8 @@
 
        grunt.loadNpmTasks( 'grunt-contrib-clean' );
        grunt.loadNpmTasks( 'grunt-contrib-concat' );
-       grunt.loadNpmTasks( 'grunt-contrib-jshint' );
        grunt.loadNpmTasks( 'grunt-contrib-watch' );
-       grunt.loadNpmTasks( 'grunt-jscs' );
+       grunt.loadNpmTasks( 'grunt-eslint' );
        grunt.loadNpmTasks( 'grunt-karma' );
        grunt.loadTasks( 'build/tasks' );
 
@@ -30,17 +29,11 @@
                                src: srcFiles
                        }
                },
-               jshint: {
-                       options: {
-                               jshintrc: true
-                       },
+               eslint: {
                        all: [
                                '*.js',
                                '{build,src,tests}/**/*.js'
                        ]
-               },
-               jscs: {
-                       src: '<%= jshint.all %>'
                },
                karma: {
                        options: {
@@ -72,15 +65,15 @@
                },
                runwatch: {
                        files: [
-                               '.{jscsrc,jshintignore,jshintrc}',
-                               '<%= jshint.all %>'
+                               '.eslintrc.json',
+                               '<%= elhint.all %>'
                        ],
                        tasks: [ 'test', 'karma:bg:run' ]
                }
        } );
 
        grunt.registerTask( 'build', [ 'clean', 'concat' ] );
-       grunt.registerTask( 'lint', [ 'jshint', 'jscs' ] );
+       grunt.registerTask( 'lint', [ 'eslint' ] );
        grunt.registerTask( 'unit', [ 'karma:phantomjs' ] );
        grunt.registerTask( 'test', [ 'git-build', 'build', 'lint', 'unit' ] );
        grunt.registerTask( 'watch', [ 'karma:bg:start', 'runwatch' ] );
diff --git a/build/moduleUtils.js b/build/moduleUtils.js
index 862d5f3..2c5504f 100644
--- a/build/moduleUtils.js
+++ b/build/moduleUtils.js
@@ -4,7 +4,7 @@
  * Code shared with the OOjs UI project
  */
 
-/*jshint node:true */
+/* eslint-env node */
 module.exports = {
        /**
         * Expand an array of file paths and variant-objects into
@@ -41,11 +41,11 @@
                // (which will compile the less code) and the concat task
                // (which will prepend intro.css without it being stripped
                // like recess would).
-               var targets = { default: [] };
+               var targets = { 'default': [] };
                resources.forEach( function ( filepath ) {
                        var variant, buffer;
                        if ( typeof filepath !== 'object' ) {
-                               filepath = { default: filepath };
+                               filepath = { 'default': filepath };
                        }
                        // Fetch copy of buffer before filepath/variant loop, 
otherwise
                        // it can incorrectly include the default file in a 
non-default variant.
diff --git a/build/tasks/copy.js b/build/tasks/copy.js
index b4592d1..6f46ef6 100644
--- a/build/tasks/copy.js
+++ b/build/tasks/copy.js
@@ -5,7 +5,7 @@
  * version/date placeholder replacements.
  */
 
-/*jshint node:true */
+/* eslint-env node */
 module.exports = function ( grunt ) {
 
        grunt.registerMultiTask( 'copy', function () {
diff --git a/build/tasks/git-build.js b/build/tasks/git-build.js
index 7d34e06..7a2c0b0 100644
--- a/build/tasks/git-build.js
+++ b/build/tasks/git-build.js
@@ -2,7 +2,7 @@
  * Change the in-memory package version to contain the git HEAD
  */
 
-/*jshint node:true */
+/* eslint-env node */
 module.exports = function ( grunt ) {
 
        grunt.registerTask( 'git-build', function () {
diff --git a/package.json b/package.json
index 0fda604..44919a2 100644
--- a/package.json
+++ b/package.json
@@ -18,12 +18,12 @@
   },
   "dependencies": {},
   "devDependencies": {
+    "eslint-config-wikimedia" : "0.3.0",
     "grunt": "1.0.1",
     "grunt-contrib-clean": "1.0.0",
     "grunt-contrib-concat": "1.0.1",
-    "grunt-contrib-jshint": "1.0.0",
+    "grunt-eslint": "19.0.0",
     "grunt-contrib-watch": "1.0.0",
-    "grunt-jscs": "3.0.1",
     "grunt-karma": "1.0.0",
     "karma": "1.1.0",
     "karma-chrome-launcher": "1.0.1",
diff --git a/src/unicodejs.js b/src/unicodejs.js
index 8eb52ef..5716917 100644
--- a/src/unicodejs.js
+++ b/src/unicodejs.js
@@ -90,14 +90,14 @@
                loMax = 0xDFFF;
 
                // hi and lo surrogates for ch1
-               /* jslint bitwise: true */
+               /* eslint-disable no-bitwise */
                hi1 = 0xD800 + ( ( ch1 - 0x10000 ) >> 10 );
                lo1 = 0xDC00 + ( ( ch1 - 0x10000 ) & 0x3FF );
 
                // hi and lo surrogates for ch2
                hi2 = 0xD800 + ( ( ch2 - 0x10000 ) >> 10 );
                lo2 = 0xDC00 + ( ( ch2 - 0x10000 ) & 0x3FF );
-               /* jslint bitwise: false */
+               /* eslint-enable no-bitwise */
 
                if ( hi1 === hi2 ) {
                        return [ { hi: [ hi1, hi2 ], lo: [ lo1, lo2 ] } ];
@@ -105,12 +105,13 @@
 
                boxes = [];
 
-               /* jslint bitwise: true */
+               /* eslint-disable no-bitwise */
+
                // minimum hi surrogate which only represents characters >= ch1
                hiMinAbove = 0xD800 + ( ( ch1 - 0x10000 + 0x3FF ) >> 10 );
                // maximum hi surrogate which only represents characters <= ch2
                hiMaxBelow = 0xD800 + ( ( ch2 - 0x10000 - 0x3FF ) >> 10 );
-               /* jslint bitwise: false */
+               /* eslint-enable no-bitwise */
 
                if ( hi1 < hiMinAbove ) {
                        boxes.push( { hi: [ hi1, hi1 ], lo: [ lo1, loMax ] } );
@@ -158,10 +159,12 @@
 
                        // Handle single surrogate pair
                        if ( typeof range === 'number' && range > 0xFFFF ) {
-                               /* jslint bitwise: true */
+                               /* eslint-disable no-bitwise */
+
                                hi = 0xD800 + ( ( range - 0x10000 ) >> 10 );
                                lo = 0xDC00 + ( ( range - 0x10000 ) & 0x3FF );
-                               /* jslint bitwise: false */
+                               /* eslint-enable no-bitwise */
+
                                disjunction.push( uEsc( hi ) + uEsc( lo ) );
                                continue;
                        }
@@ -211,6 +214,6 @@
        };
 
        // Expose
-       /*jshint browser:true */
+       /* eslint-env browser */
        window.unicodeJS = unicodeJS;
 }() );
diff --git a/src/unicodejs.wordbreak.js b/src/unicodejs.wordbreak.js
index 129d5b1..b7bc66f 100644
--- a/src/unicodejs.wordbreak.js
+++ b/src/unicodejs.wordbreak.js
@@ -149,7 +149,7 @@
                }
 
                // get some context
-               rgt.push( getProperty( string.read( pos + r  ) ) );
+               rgt.push( getProperty( string.read( pos + r ) ) );
                lft.push( getProperty( string.read( pos - l - 1 ) ) );
 
                switch ( true ) {
diff --git a/tests/.jshintrc b/tests/.jshintrc
deleted file mode 100644
index 7bdd3a4..0000000
--- a/tests/.jshintrc
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-       "globals": {
-               "QUnit": true
-       },
-
-       "extends": "../.jshintrc"
-}
diff --git a/tests/unicodejs.test.js b/tests/unicodejs.test.js
index a6dab8e..33032b4 100644
--- a/tests/unicodejs.test.js
+++ b/tests/unicodejs.test.js
@@ -115,11 +115,12 @@
                );
        }
        for ( i = 0; i < throwTests.length; i++ ) {
-               /*jshint loopfunc:true */
+               /* eslint-disable no-loop-func */
                test = throwTests[ i ];
                doTestFunc = function () {
                        unicodeJS.charRangeArrayRegexp( test[ 0 ] );
                };
+               /* eslint-enable no-loop-func */
                assert.throws(
                        doTestFunc,
                        Error,
diff --git a/tools/unicodejs-properties.js b/tools/unicodejs-properties.js
index 54761f7..85c175b 100755
--- a/tools/unicodejs-properties.js
+++ b/tools/unicodejs-properties.js
@@ -2,7 +2,7 @@
 
 // Generates unicodejs.*(properties|categories).js from Unicode data
 
-/* jshint node: true */
+/* eslint-env node */
 
 var http = require( 'http' ),
        fs = require( 'fs' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I07e70759fcf80011d8806c04a24d392a86b3a10f
Gerrit-PatchSet: 1
Gerrit-Project: unicodejs
Gerrit-Branch: master
Gerrit-Owner: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Catrope <r...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to