From e4d0fd66c9af115fd429b74a074a4cf31949f080 Mon Sep 17 00:00:00 2001 From: Nik Butenko Date: Fri, 7 Aug 2015 21:14:04 +1000 Subject: [PATCH 1/2] Add ESLint dependencies and configs --- .eslintignore | 3 +++ .eslintrc | 9 +++++++++ package.json | 8 ++++++++ 3 files changed, 20 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..5bcb6fe --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +dist +coverage +node_modules diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..c7dbc91 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,9 @@ +{ + "extends": "eslint-config-airbnb-lite", + "env": { + "es6": true, + "mocha": true + }, + "rules": { + } +} diff --git a/package.json b/package.json index 46b112c..2666a0f 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,19 @@ }, "devDependencies": { "babel": "^5.8.20", + "babel-eslint": "^4.0.5", "css-modules-loader-core": "0.0.12", + "eslint": "^1.0.0", + "eslint-config-airbnb": "0.0.7", + "eslint-config-airbnb-lite": "^1.0.3", + "eslint-watch": "^1.2.4", "in-publish": "^2.0.0", "mocha": "^2.2.5" }, "scripts": { + "start": "esw -w .", + "lint": "eslint .", + "pretest": "npm run -s lint || true", "test": "npm run -s build && mocha --compilers js:babel/register", "build": "babel src --out-dir dist", "prepublish": "in-publish && npm run -s build || in-install" From f852fb3dc58310a030c14561aed4a10e78859f83 Mon Sep 17 00:00:00 2001 From: Nik Butenko Date: Fri, 7 Aug 2015 21:20:27 +1000 Subject: [PATCH 2/2] Add pre-commit hook --- .gitignore | 3 +++ package.json | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5399ef3..c170dfd 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,7 @@ build/Release # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules +# added automatically by precommit-hook as defaults +.jshint* + dist/ diff --git a/package.json b/package.json index 2666a0f..1f36790 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "eslint-config-airbnb-lite": "^1.0.3", "eslint-watch": "^1.2.4", "in-publish": "^2.0.0", - "mocha": "^2.2.5" + "mocha": "^2.2.5", + "precommit-hook": "^3.0.0" }, "scripts": { "start": "esw -w .", @@ -45,5 +46,9 @@ "bugs": { "url": "https://github.com/sullenor/css-modules-require-hook/issues" }, - "homepage": "https://github.com/sullenor/css-modules-require-hook" + "homepage": "https://github.com/sullenor/css-modules-require-hook", + "pre-commit": [ + "lint", + "test" + ] }