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/.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 46b112c..1f36790 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,20 @@ }, "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" + "mocha": "^2.2.5", + "precommit-hook": "^3.0.0" }, "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" @@ -37,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" + ] }