[MediaWiki-commits] [Gerrit] mediawiki...cxserver[master]: Replace jshint, jscs, jsbeautify with eslint

2016-11-30 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Replace jshint, jscs, jsbeautify with eslint
..


Replace jshint, jscs, jsbeautify with eslint

Bug: T151741
Change-Id: I55051ff2d4e5d64a8cb5e8c8e2fd1e3e67a4a841
---
A .eslintrc.json
D .jsbeautifyrc
D .jscsrc
D .jshintignore
D .jshintrc
M app.js
M dictionary/dict/DictClient.js
M lineardoc/Doc.js
M lineardoc/Normalizer.js
M lineardoc/Parser.js
M lineardoc/TextBlock.js
M lineardoc/Utils.js
M lineardoc/index.js
M mt/Yandex.js
M mt/Youdao.js
M mt/annotationmapper/SubsequenceMatcher.js
M mt/index.js
M package.json
M pageloader/PageLoader.js
M routes/doc.js
M routes/info.js
M routes/root.js
M routes/v1.js
M segmentation/languages/index.js
M test/index.js
M utils/api-util.js
M utils/util.js
27 files changed, 84 insertions(+), 87 deletions(-)

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



diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 000..1cc15b0
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,16 @@
+{
+   "extends": "wikimedia",
+   "env": {
+   "browser": true,
+   "jquery": true,
+   "qunit": true,
+   "node": true
+   },
+   "globals": {
+   "require": false
+   },
+   "rules": {
+   "dot-notation": 0,
+   "wrap-iife": 0
+   }
+}
diff --git a/.jsbeautifyrc b/.jsbeautifyrc
deleted file mode 100644
index 0631808..000
--- a/.jsbeautifyrc
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-"preserve_newlines": true,
-"jslint_happy": true,
-"keep_array_indentation": true,
-"space_before_conditional": true,
-"max_preserve_newlines": 10,
-"brace_style": "collapse",
-"keep_function_indentation": false,
-"break_chained_methods": false,
-"eval_code": false,
-"unescape_strings": false,
-"wrap_line_length": 0,
-"space_in_paren": true,
-"space_in_square_bracket": true,
-"git_happy": true,
-"indent_with_tabs": true
-}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 9b13945..000
--- a/.jscsrc
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-   "preset": "wikimedia",
-   "requireVarDeclFirst": false,
-   "requireCamelCaseOrUpperCaseIdentifiers": {
-   "ignoreProperties": true
-   }
-}
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index e3bef7f..000
--- a/.jshintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-doc/
-node_modules
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 6245cdd..000
--- a/.jshintrc
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-   // Enforcing
-   "bitwise": true,
-   "eqeqeq": true,
-   "freeze": true,
-   "latedef": true,
-   "noarg": true,
-   "nonew": true,
-   "undef": true,
-   "unused": true,
-   "strict": true,
-
-   // Environment
-   "node": true,
-   "jasmine": true,
-
-   "globals": {
-   "CX": false,
-   "QUnit": false,
-   "before": false,
-   "beforeEach": false,
-   "after": false,
-   "afterEach": false
-   }
-}
diff --git a/app.js b/app.js
index 816eba9..f6ddda8 100644
--- a/app.js
+++ b/app.js
@@ -1,7 +1,5 @@
 'use strict';
 
-require( 'core-js/shim' );
-
 var http = require( 'http' ),
BBPromise = require( 'bluebird' ),
express = require( 'express' ),
@@ -13,6 +11,8 @@
packageInfo = require( './package.json' ),
path = require( 'path' ),
yaml = require( 'js-yaml' );
+
+require( 'core-js/shim' );
 
 /**
  * Creates an express app and initialises it
@@ -36,6 +36,7 @@
app.conf.interface = '0.0.0.0';
}
if ( app.conf.compression_level === undefined ) {
+   /* eslint camelcase:off */
app.conf.compression_level = 3;
}
if ( app.conf.cors === undefined ) {
@@ -232,6 +233,9 @@
  * options and the logger and metrics-reporting objects from
  * service-runner and starts an HTTP server, attaching the application
  * object to it.
+ *
+ * @param {Object} options
+ * @return {Promise} a promise for an http server.
  */
 module.exports = function ( options ) {
return initApp( options )
diff --git a/dictionary/dict/DictClient.js b/dictionary/dict/DictClient.js
index 4f569f2..be40e48 100644
--- a/dictionary/dict/DictClient.js
+++ b/dictionary/dict/DictClient.js
@@ -39,6 +39,7 @@
  * Sanitize the words
  *
  * @param {Object} words
+ * @return {Object} result
  */
 function parseWords( words ) {
var i, word, db, nDb, dbIdx,
@@ -235,7 +236,7 @@
nextResponse();
}
// Continuing previous data
-
+   /* eslint no-fallthrough:off */
switch ( status ) {
// greetings

[MediaWiki-commits] [Gerrit] mediawiki...cxserver[master]: Replace jshint, jscs, jsbeautify with eslint

2016-11-28 Thread Santhosh (Code Review)
Santhosh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/323793

Change subject: Replace jshint, jscs, jsbeautify with eslint
..

Replace jshint, jscs, jsbeautify with eslint

Bug: T151741
Change-Id: I55051ff2d4e5d64a8cb5e8c8e2fd1e3e67a4a841
---
A .eslintrc.json
D .jsbeautifyrc
D .jscsrc
D .jshintignore
D .jshintrc
M app.js
M dictionary/dict/DictClient.js
M lineardoc/Doc.js
M lineardoc/Normalizer.js
M lineardoc/Parser.js
M lineardoc/TextBlock.js
M lineardoc/Utils.js
M lineardoc/index.js
M mt/index.js
M package.json
M pageloader/PageLoader.js
M routes/doc.js
M routes/info.js
M routes/root.js
M routes/v1.js
M segmentation/languages/index.js
M test/index.js
M utils/api-util.js
M utils/util.js
24 files changed, 65 insertions(+), 84 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/93/323793/1

diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 000..1cc15b0
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,16 @@
+{
+   "extends": "wikimedia",
+   "env": {
+   "browser": true,
+   "jquery": true,
+   "qunit": true,
+   "node": true
+   },
+   "globals": {
+   "require": false
+   },
+   "rules": {
+   "dot-notation": 0,
+   "wrap-iife": 0
+   }
+}
diff --git a/.jsbeautifyrc b/.jsbeautifyrc
deleted file mode 100644
index 0631808..000
--- a/.jsbeautifyrc
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-"preserve_newlines": true,
-"jslint_happy": true,
-"keep_array_indentation": true,
-"space_before_conditional": true,
-"max_preserve_newlines": 10,
-"brace_style": "collapse",
-"keep_function_indentation": false,
-"break_chained_methods": false,
-"eval_code": false,
-"unescape_strings": false,
-"wrap_line_length": 0,
-"space_in_paren": true,
-"space_in_square_bracket": true,
-"git_happy": true,
-"indent_with_tabs": true
-}
diff --git a/.jscsrc b/.jscsrc
deleted file mode 100644
index 9b13945..000
--- a/.jscsrc
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-   "preset": "wikimedia",
-   "requireVarDeclFirst": false,
-   "requireCamelCaseOrUpperCaseIdentifiers": {
-   "ignoreProperties": true
-   }
-}
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index e3bef7f..000
--- a/.jshintignore
+++ /dev/null
@@ -1,2 +0,0 @@
-doc/
-node_modules
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index 6245cdd..000
--- a/.jshintrc
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-   // Enforcing
-   "bitwise": true,
-   "eqeqeq": true,
-   "freeze": true,
-   "latedef": true,
-   "noarg": true,
-   "nonew": true,
-   "undef": true,
-   "unused": true,
-   "strict": true,
-
-   // Environment
-   "node": true,
-   "jasmine": true,
-
-   "globals": {
-   "CX": false,
-   "QUnit": false,
-   "before": false,
-   "beforeEach": false,
-   "after": false,
-   "afterEach": false
-   }
-}
diff --git a/app.js b/app.js
index 816eba9..e1f4aef 100644
--- a/app.js
+++ b/app.js
@@ -1,6 +1,5 @@
 'use strict';
 
-require( 'core-js/shim' );
 
 var http = require( 'http' ),
BBPromise = require( 'bluebird' ),
@@ -13,6 +12,8 @@
packageInfo = require( './package.json' ),
path = require( 'path' ),
yaml = require( 'js-yaml' );
+
+require( 'core-js/shim' );
 
 /**
  * Creates an express app and initialises it
@@ -36,6 +37,7 @@
app.conf.interface = '0.0.0.0';
}
if ( app.conf.compression_level === undefined ) {
+   /* eslint camelcase:off */
app.conf.compression_level = 3;
}
if ( app.conf.cors === undefined ) {
diff --git a/dictionary/dict/DictClient.js b/dictionary/dict/DictClient.js
index 4f569f2..9a228f4 100644
--- a/dictionary/dict/DictClient.js
+++ b/dictionary/dict/DictClient.js
@@ -39,6 +39,7 @@
  * Sanitize the words
  *
  * @param {Object} words
+ * @return {Object} result
  */
 function parseWords( words ) {
var i, word, db, nDb, dbIdx,
@@ -418,7 +419,7 @@
  * @param {Object} options
  */
 function lookup( word, options ) {
-   var defs, words, wordList = [],
+   var words, wordList = [],
action = options.action || 'def';
 
switch ( action ) {
@@ -441,7 +442,7 @@
// Sanitize the wordList
words = parseWords( wordList );
if ( words.count ) {
-   defs = getDefs( words, {
+   getDefs( words, {
action: options.action,
suggestions: !!options.suggestions,
error: options.error,
diff --git a/lineardoc/Doc.js b/lineardoc/Doc.js
index 5639f4d..e40807a 100644
--- a/lineardoc/Doc.js
+++