diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..4335daa --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,20 @@ + module.exports = { + + "extends": "eslint:recommended", + + "rules": { + "no-console": "off", + "no-unused-vars": ["error" ,{ "vars": "all", "args": "none" }], + "no-undef": 'error' + }, + "env": { + "es6": true, + "node": true + }, + + "parserOptions": { + "ecmaVersion": 6 + } + + }; + diff --git a/main.js b/main.js index b82becb..c94de67 100644 --- a/main.js +++ b/main.js @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -var sys = require('util') - , fs = require('fs') + + var fs = require('fs') , path = require('path') , events = require('events') ; diff --git a/package.json b/package.json index 833a558..c734a8b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "scripts": { "release:major": "bash scripts/release.sh major", "release:minor": "bash scripts/release.sh minor", - "release:patch": "bash scripts/release.sh patch" + "release:patch": "bash scripts/release.sh patch", + "lint": "eslint ." }, "keywords": [ "util", @@ -36,5 +37,8 @@ "dependencies": { "exec-sh": "^0.2.0", "minimist": "^1.2.0" + }, + "devDependencies": { + "eslint": "4.18.2" } } diff --git a/test/test_monitorRootDirectory.js b/test/test_monitorRootDirectory.js index e3df595..78279a8 100644 --- a/test/test_monitorRootDirectory.js +++ b/test/test_monitorRootDirectory.js @@ -1,7 +1,7 @@ -var fs, watch, watch_original; +var watch, watch_original; watch = require('../main'); watch_original = require('watch'); -fs = require('fs'); + watch.createMonitor(__dirname, function (monitor) { monitor.on("created", function (f, stat) { @@ -25,4 +25,4 @@ watch_original.createMonitor(__dirname, function (monitor) { monitor.on("removed", function (f, stat) { console.log("ORIGINAL: " + f + " removed"); }); -}); \ No newline at end of file +}); diff --git a/test/test_watchTree.js b/test/test_watchTree.js index 727b22d..404e7b8 100644 --- a/test/test_watchTree.js +++ b/test/test_watchTree.js @@ -1,5 +1,4 @@ -var fs = require('fs') - , watch = require('../main') +var watch = require('../main') , assert = require('assert') ;