From 94972150c105c9045a1e853d1fc2d310be66b887 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 23 Aug 2016 12:15:18 -0400 Subject: [PATCH] Add ESLint as the default linter - Create `.eslintrc` and `.eslintignore` - Add the above files to `.npmignore` - Save `eslint` to devDependencies - Create task `npm run lint` that lints `lib` and `test` directory Documentation: http://eslint.org --- .eslintignore | 1 + .eslintrc | 34 ++++++++++++++++++++++++++++++++++ .npmignore | 1 + package.json | 4 +++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .eslintignore create mode 100644 .eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..a6c57f5f --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +*.json diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..17350214 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,34 @@ +{ + "env": { + "node": true, + "browser": true, + "mocha": true, + "commonjs": true + }, + + "extends": "eslint:recommended", + + "rules": { + "indent": [ + "error", + 4, + { SwitchCase: 1 } + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ], + "strict": 2, + "no-unused-vars": 2, + "no-cond-assign": 2, + "camelcase": 1 + } +} diff --git a/.npmignore b/.npmignore index 9daeafb9..8cd94105 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ test +.eslint* diff --git a/package.json b/package.json index 01f90ff1..a812919b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "author": "Mark ", "main": "index.js", "scripts": { - "test": "mocha" + "test": "mocha", + "lint": "eslint index.js \"lib/**\" \"test/**\"" }, "repository": { "type": "git", @@ -26,6 +27,7 @@ "htmlparser2": "^3.9.1" }, "devDependencies": { + "eslint": "^3.3.1", "jsdomify": "^2.1.0", "mocha": "^3.0.2", "react": "^15.3.0",