From 76f55514ca965243f8b3035322536c19e9367a15 Mon Sep 17 00:00:00 2001 From: bananaappletw Date: Thu, 20 Oct 2016 14:02:09 +0800 Subject: [PATCH] Add eslint --- .eslintrc.yml | 15 +++++++++++++++ .travis.yml | 2 ++ Makefile | 5 ++++- Readme.md | 7 +++++++ package.json | 4 ++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .eslintrc.yml diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..0d5c8d4 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,15 @@ +env: + mocha: true +extends: standard +plugins: + - standard + - promise +rules: + arrow-parens: 0 + eqeqeq: 0 + no-return-assign: 0 # fails for arrow functions + semi: [2, always] + space-before-function-paren: [2, never] + yoda: 0 + arrow-spacing: 2 + dot-location: [2, "property"] diff --git a/.travis.yml b/.travis.yml index 28937c6..b03b984 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,3 +2,5 @@ node_js: - "4" - "6" language: node_js +script: + make lint diff --git a/Makefile b/Makefile index 69321c0..e07fe57 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +lint: + @./node_modules/.bin/eslint . + test: @NODE_ENV=test ./node_modules/.bin/mocha \ --harmony \ @@ -5,4 +8,4 @@ test: --require should \ */test.js -.PHONY: test +.PHONY: lint test diff --git a/Readme.md b/Readme.md index 302d593..278d902 100644 --- a/Readme.md +++ b/Readme.md @@ -2,6 +2,13 @@ A repository containing small examples to illustrate the use of Koa for creating web applications and other HTTP servers. + +# Running tests + +```bash +make test +make lint +``` ## Included Examples diff --git a/package.json b/package.json index 59944fd..daf14c1 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,10 @@ }, "devDependencies": { "co": "*", + "eslint": "^3.8.1", + "eslint-config-standard": "^6.2.0", + "eslint-plugin-promise": "^3.3.0", + "eslint-plugin-standard": "^2.0.1", "mocha": "*", "should": "^3.3.2", "supertest": "*"