couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject couchdb-nmo git commit: Add linting check
Date Wed, 11 Nov 2015 14:28:59 GMT
Repository: couchdb-nmo
Updated Branches:
  refs/heads/master 810a3d2ec -> f29ee61d7


Add linting check

Change to eslint and setup linting.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/commit/f29ee61d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/tree/f29ee61d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-nmo/diff/f29ee61d

Branch: refs/heads/master
Commit: f29ee61d78587101ea74ea4d99d72dd64670f441
Parents: 810a3d2
Author: Garren Smith <garren.smith@gmail.com>
Authored: Wed Nov 11 10:52:12 2015 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Wed Nov 11 16:28:44 2015 +0200

----------------------------------------------------------------------
 .eslintrc            | 12 +++++++++
 package.json         |  6 +++--
 src/cluster.js       |  4 +--
 src/couch-config.js  |  2 +-
 src/v.js             |  3 +--
 test/config.js       | 16 +++++------
 test/couch-config.js |  6 ++---
 test/import-csv.js   | 10 +++----
 test/isonline.js     |  2 +-
 test/savetofile.js   | 68 +++++++++++++++++++++++------------------------
 test/utils.js        |  4 +--
 test/v.js            |  2 +-
 12 files changed, 74 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/.eslintrc
----------------------------------------------------------------------
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..25e0930
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,12 @@
+{
+  "parser": "babel-eslint",
+  "env": {
+    "node": true
+  },
+  "rules": {
+    "quotes": [2, "single"],
+    "eol-last": [0],
+    "no-mixed-requires": [0],
+    "no-underscore-dangle": [0]
+  }
+}

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index d6da9ac..eed54e5 100644
--- a/package.json
+++ b/package.json
@@ -7,8 +7,8 @@
   "scripts": {
     "transpile": "babel src -d lib",
     "prepublish": "make && npm run transpile",
-    "test": "lab -v --transform node_modules/lab-babel -S -I core,_babelPolyfill,regeneratorRuntime,__core-js_shared__,Reflect",
-    "lint": "jshint ./src ./test"
+    "test": "npm run lint && lab -v --transform node_modules/lab-babel -S -I core,_babelPolyfill,regeneratorRuntime,__core-js_shared__,Reflect",
+    "lint": "eslint ./src ./test"
   },
   "author": "Robert Kowalski <rok@kowalski.gd>",
   "license": "Apache 2.0",
@@ -58,6 +58,8 @@
   ],
   "devDependencies": {
     "babel": "^5.1.10",
+    "babel-eslint": "^4.1.5",
+    "eslint": "^1.9.0",
     "jshint": "^2.8.0",
     "lab": "~5.5.1",
     "lab-babel": "1.0.0",

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/src/cluster.js
----------------------------------------------------------------------
diff --git a/src/cluster.js b/src/cluster.js
index de27447..388e531 100644
--- a/src/cluster.js
+++ b/src/cluster.js
@@ -74,7 +74,7 @@ export function join (cluster) {
 
         const err = new Error(msg);
         err.type = 'EUSAGE';
-        return reject(err)
+        return reject(err);
       }
 
       const onlineNodes = Object.keys(res).reduce((acc, el) => {
@@ -93,7 +93,7 @@ export function join (cluster) {
           action: 'enable_cluster',
           username: user,
           password: pw,
-          bind_address: '0.0.0.0'
+          'bind_address': '0.0.0.0'
         };
 
         return utils.sendJsonToNode(u + '/_cluster_setup', json);

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/src/couch-config.js
----------------------------------------------------------------------
diff --git a/src/couch-config.js b/src/couch-config.js
index e5070b8..7c82eca 100644
--- a/src/couch-config.js
+++ b/src/couch-config.js
@@ -74,7 +74,7 @@ export function set(cluster, nodes, section, key, value) {
         return true;
       }
 
-      return false
+      return false;
     });
 
     if (offline.length > 0) {

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/src/v.js
----------------------------------------------------------------------
diff --git a/src/v.js b/src/v.js
index 4a20e6c..774a52a 100644
--- a/src/v.js
+++ b/src/v.js
@@ -19,5 +19,4 @@ function versionCli () {
     console.log(`node version: ${process.version}`);
     resolve();
   });
-};
-
+}

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/config.js
----------------------------------------------------------------------
diff --git a/test/config.js b/test/config.js
index 5894ab4..329ece5 100644
--- a/test/config.js
+++ b/test/config.js
@@ -20,15 +20,15 @@ mussman=dermussmaen
 `;
 
 const jsonData = {
-  "gang": {
-    "rocko": "artischocko",
-    "z": "zmeister",
-    "j": "janjuleschlie",
-    "mussman": "dermussmaen"
+  'gang': {
+    'rocko': 'artischocko',
+    'z': 'zmeister',
+    'j': 'janjuleschlie',
+    'mussman': 'dermussmaen'
   },
-  "clusterone": {
-    "node0": "http://127.0.0.1",
-    "node1": "http://192.168.0.1"
+  'clusterone': {
+    'node0': 'http://127.0.0.1',
+    'node1': 'http://192.168.0.1'
   }
 };
 

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/couch-config.js
----------------------------------------------------------------------
diff --git a/test/couch-config.js b/test/couch-config.js
index 1e56a84..5969e99 100644
--- a/test/couch-config.js
+++ b/test/couch-config.js
@@ -250,11 +250,11 @@ lab.experiment('couch-config', () => {
       //config update
       nock('http://127.0.0.1')
       .put('/_node/node0/_config/section/key', JSON.stringify('value'))
-      .reply(200, JSON.stringify("oldvalue"));
+      .reply(200, JSON.stringify('oldvalue'));
 
       nock('http://192.168.0.1')
       .put('/_node/node1/_config/section/key', JSON.stringify('value'))
-      .reply(200, JSON.stringify("oldvalue"));
+      .reply(200, JSON.stringify('oldvalue'));
 
       set('clusterone', getClusterNodes('clusterone'), 'section', 'key', 'value')
       .then(resp => {
@@ -279,7 +279,7 @@ lab.experiment('couch-config', () => {
       //config update
       nock('http://127.0.0.1')
       .put('/_node/node0/_config/section/key', JSON.stringify('value'))
-      .reply(200, JSON.stringify("oldvalue"));
+      .reply(200, JSON.stringify('oldvalue'));
 
       set('clusterone', getClusterNodes('clusterone'), 'section', 'key', 'value')
       .catch(err => {

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/import-csv.js
----------------------------------------------------------------------
diff --git a/test/import-csv.js b/test/import-csv.js
index 4bc24aa..8b9bb5b 100644
--- a/test/import-csv.js
+++ b/test/import-csv.js
@@ -9,11 +9,11 @@ import {cli} from '../src/import-csv.js';
 import importcsv from '../src/import-csv.js';
 
 const docs = {
-  "docs":[
+  'docs':[
     {
-      "name":"John",
-      "surname":" Rambo",
-      "email":" john@rambo.com"
+      'name':'John',
+      'surname':' Rambo',
+      'email':' john@rambo.com'
     },
     {
       name: 'Eddie',
@@ -61,7 +61,7 @@ lab.experiment('import csv', () => {
         .post('/fake-csv/_bulk_docs')
         .reply(200);
 
-      cli(__dirname + '/fixtures/fake.csv', 'http://127.0.0.1:5984/fake-csv', 'delimiter=","')
+      cli(__dirname + '/fixtures/fake.csv', 'http://127.0.0.1:5984/fake-csv', 'delimiter=','')
       .then(done);
     });
   });

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/isonline.js
----------------------------------------------------------------------
diff --git a/test/isonline.js b/test/isonline.js
index 3ad645e..5546789 100644
--- a/test/isonline.js
+++ b/test/isonline.js
@@ -2,7 +2,7 @@ import assert from 'assert';
 import Lab from 'lab';
 
 import isonline from '../src/isonline.js';
-import {cli, getClusterUrls } from '../src/isonline.js';
+import {cli} from '../src/isonline.js';
 
 import * as common from './common.js';
 import nmo from '../src/nmo.js';

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/savetofile.js
----------------------------------------------------------------------
diff --git a/test/savetofile.js b/test/savetofile.js
index 89f5bce..307d85a 100644
--- a/test/savetofile.js
+++ b/test/savetofile.js
@@ -83,27 +83,27 @@ lab.experiment('savetofile', () => {
 
     lab.test('saves contents to file', done => {
       const resp = {
-        "total_rows":2,
-        "offset":0,
-        "rows":[
+        'total_rows':2,
+        'offset':0,
+        'rows':[
             {
-              "id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-              "key":"0461444c-e60a-457d-a4bb-b8d811853f21",
-              "value":{"rev":"1-090ec379aecccc97f8d02bc024ba28e5"},
-              "doc":{
-                "_id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-                "_rev":"1-090ec379aecccc97f8d02bc024ba28e5",
-                "name": "Garren"
+              'id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+              'key':'0461444c-e60a-457d-a4bb-b8d811853f21',
+              'value':{'rev':'1-090ec379aecccc97f8d02bc024ba28e5'},
+              'doc':{
+                '_id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+                '_rev':'1-090ec379aecccc97f8d02bc024ba28e5',
+                'name': 'Garren'
               }
             },
             {
-              "id":"0461444c-e60a-457d-a4bb-b8d811853123",
-              "key":"0461444c-e60a-457d-a4bb-b8d811853123",
-              "value":{"rev":"1-090ec379aecccc97f8d02bc024ba123"},
-              "doc":{
-                "_id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-                "_rev":"1-090ec379aecccc97f8d02bc024ba28e5",
-                "name": "Robert"
+              'id':'0461444c-e60a-457d-a4bb-b8d811853123',
+              'key':'0461444c-e60a-457d-a4bb-b8d811853123',
+              'value':{'rev':'1-090ec379aecccc97f8d02bc024ba123'},
+              'doc':{
+                '_id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+                '_rev':'1-090ec379aecccc97f8d02bc024ba28e5',
+                'name': 'Robert'
               }
             }
         ]
@@ -125,27 +125,27 @@ lab.experiment('savetofile', () => {
 
     lab.test('saves contents to file and zips with --zip', done => {
       const resp = {
-        "total_rows":2,
-        "offset":0,
-        "rows":[
+        'total_rows':2,
+        'offset':0,
+        'rows':[
             {
-              "id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-              "key":"0461444c-e60a-457d-a4bb-b8d811853f21",
-              "value":{"rev":"1-090ec379aecccc97f8d02bc024ba28e5"},
-              "doc":{
-                "_id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-                "_rev":"1-090ec379aecccc97f8d02bc024ba28e5",
-                "name": "Garren"
+              'id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+              'key':'0461444c-e60a-457d-a4bb-b8d811853f21',
+              'value':{'rev':'1-090ec379aecccc97f8d02bc024ba28e5'},
+              'doc':{
+                '_id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+                '_rev':'1-090ec379aecccc97f8d02bc024ba28e5',
+                'name': 'Garren'
               }
             },
             {
-              "id":"0461444c-e60a-457d-a4bb-b8d811853123",
-              "key":"0461444c-e60a-457d-a4bb-b8d811853123",
-              "value":{"rev":"1-090ec379aecccc97f8d02bc024ba123"},
-              "doc":{
-                "_id":"0461444c-e60a-457d-a4bb-b8d811853f21",
-                "_rev":"1-090ec379aecccc97f8d02bc024ba28e5",
-                "name": "Robert"
+              'id':'0461444c-e60a-457d-a4bb-b8d811853123',
+              'key':'0461444c-e60a-457d-a4bb-b8d811853123',
+              'value':{'rev':'1-090ec379aecccc97f8d02bc024ba123'},
+              'doc':{
+                '_id':'0461444c-e60a-457d-a4bb-b8d811853f21',
+                '_rev':'1-090ec379aecccc97f8d02bc024ba28e5',
+                'name': 'Robert'
               }
             }
         ]

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/utils.js
----------------------------------------------------------------------
diff --git a/test/utils.js b/test/utils.js
index 7192f8f..90fcaf2 100644
--- a/test/utils.js
+++ b/test/utils.js
@@ -41,7 +41,7 @@ lab.experiment('utils: getClusterUrls', () => {
     });
   });
 
-  lab.test("getClustersUrl throws an error if the cluster doesn't exist", (done) => {
+  lab.test('getClustersUrl throws an error if the cluster does not exist', (done) => {
     nmo
       .load(nmoconf)
       .then(() => {
@@ -146,7 +146,7 @@ lab.experiment('utils: send json to node', () => {
       });
   });
 
-  lab.test('sets "Content-Type" as "application/json"', done => {
+  lab.test('sets Content-Type as application/json', done => {
     const url = 'http://content-type.test';
     const body = {test: true};
     nock(url,{

http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/f29ee61d/test/v.js
----------------------------------------------------------------------
diff --git a/test/v.js b/test/v.js
index 9f7b70a..92685b7 100644
--- a/test/v.js
+++ b/test/v.js
@@ -6,7 +6,7 @@ export const lab = Lab.script();
 import * as version from '../src/v.js';
 import versionApi from '../src/v.js';
 
-import pkg from '../package.json'
+import pkg from '../package.json';
 
 const oldConsole = console.log;
 


Mime
View raw message