From f64d6d293afb117e11cf704b23daf06651fddfb2 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 2 Nov 2016 08:54:33 -0300 Subject: [PATCH 1/5] running lint before commiting --- package.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/package.json b/package.json index 9f70a3f54..12cb1bfef 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,17 @@ "start": "./server/bin/www", "lint": "eslint ." }, + "config": { + "pre-git": { + "commit-msg": [], + "pre-commit": [ + "npm run lint" + ], + "pre-push": [], + "post-commit": [], + "post-merge": [] + } + }, "repository": { "type": "git", "url": "git+https://github.com/coralproject/talk.git" @@ -27,5 +38,11 @@ "debug": "^2.2.0", "express": "^4.14.0", "mongoose": "^4.6.5" + }, + "devDependencies": { + "chai": "^3.5.0", + "mocha": "^3.1.2", + "pre-git": "^3.10.0", + "supertest": "^2.0.1" } } From ac80d2683dd0dbc5a8bd2b010fab90513ae3e12f Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 2 Nov 2016 08:58:31 -0300 Subject: [PATCH 2/5] Adding eslint as devDep --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 12cb1bfef..dbee39dd4 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "chai": "^3.5.0", + "eslint": "^3.9.1", "mocha": "^3.1.2", "pre-git": "^3.10.0", "supertest": "^2.0.1" From 61e9e30ac58133638938e172197442b06e8c2ba2 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 2 Nov 2016 09:02:34 -0300 Subject: [PATCH 3/5] Adding test script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index dbee39dd4..333f6b98e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "./server/bin/www", "scripts": { "start": "./server/bin/www", - "lint": "eslint ." + "lint": "eslint .", + "test": "mocha" }, "config": { "pre-git": { From 265be1898d03e21d19ccb1a2a3d8d1003074f63b Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Wed, 2 Nov 2016 09:57:18 -0300 Subject: [PATCH 4/5] Adding mock test --- package.json | 7 +++++-- tests/index.js | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 tests/index.js diff --git a/package.json b/package.json index 422caa613..a4b4d603c 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "scripts": { "start": "./bin/www", "lint": "eslint .", - "test": "mocha" + "pretest": "npm install", + "test": "mocha tests" }, "config": { "pre-git": { @@ -14,7 +15,9 @@ "pre-commit": [ "npm run lint" ], - "pre-push": [], + "pre-push": [ + "npm test" + ], "post-commit": [], "post-merge": [] } diff --git a/tests/index.js b/tests/index.js new file mode 100644 index 000000000..0a212b7a4 --- /dev/null +++ b/tests/index.js @@ -0,0 +1,12 @@ +/* eslint-env node, mocha */ +'use strict'; + +const expect = require('chai').expect; + +describe('Comment', () => { + describe.only('#add', () => { + it('should add a comment', () => { + expect(0).to.be.equal(0); + }); + }); +}); From f0f6963aa5618be26c4ea3757b57c207d4ca2500 Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Wed, 2 Nov 2016 14:09:10 -0600 Subject: [PATCH 5/5] add more rules to eslint file --- .eslintrc.json | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index a28ebd512..f92aa27b1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -23,6 +23,29 @@ "semi": [ "error", "always" - ] + ], + "no-template-curly-in-string": [1], + "no-unsafe-negation": [1], + "array-callback-return": [1], + "eqeqeq": [2], + "no-eval": [2], + "no-global-assign": [2], + "no-implied-eval": [2], + "no-script-url": [2], + "no-throw-literal": [2], + "yoda": [1], + "no-path-concat": [2], + "no-process-exit": [2], + "camelcase": [1], + "eol-last": [1], + "no-continue": [1], + "no-nested-ternary": [1], + "no-tabs": [2], + "no-unneeded-ternary": [1], + "object-curly-spacing": [1], + "space-infix-ops": ["error"], + "no-const-assign": [2], + "no-duplicate-imports": [2], + "prefer-template": [1] } }