diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..76b1021 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +.nyc_output +coverage +node_modules diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 0000000..645e3f2 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,7 @@ +root: true +rules: + eol-last: error + eqeqeq: ["error", "always", { "null": "ignore" }] + no-mixed-spaces-and-tabs: error + no-trailing-spaces: error + one-var: ["error", { "initialized": "never" }] diff --git a/.travis.yml b/.travis.yml index e4149c0..7581382 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,11 @@ before_install: - "npm config set shrinkwrap false" # Setup Node.js version-specific dependencies - | + # eslint for linting + # - remove on Node.js < 6 + if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then + npm rm --slient --save-dev eslint + fi # nyc for coverage # - remove for Node.js < 6 if [[ "$(cut -d. -f1 <<< "$TRAVIS_NODE_VERSION")" -lt 6 ]]; then @@ -27,6 +32,11 @@ script: else npm test fi + # Run linting + - | + if npm -ps ls eslint | grep -q eslint; then + npm run lint + fi after_script: - | # Upload coverage to coveralls if exists diff --git a/appveyor.yml b/appveyor.yml index ca9f298..8cb2520 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,7 +18,7 @@ install: - if "%nodejs_version%" equ "0.8" npm install -g --prefix "%npm_prefix:~0,-1%" npm@1.2.8000 - npm config set shrinkwrap false # Remove all non-test dependencies - - npm rm --silent --save-dev nyc + - npm rm --silent --save-dev eslint nyc # Install Node.js modules - npm install build: off diff --git a/lib/async.js b/lib/async.js index 147dd6d..aa0029e 100644 --- a/lib/async.js +++ b/lib/async.js @@ -95,7 +95,7 @@ module.exports = function() { args.push(function(res) { cur_waiter.resolve(id, res); }) - + fn.apply(null, args); // return the id placeholder diff --git a/package.json b/package.json index 666a158..c792e02 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "walk": "2.3.14" }, "devDependencies": { + "eslint": "5.16.0", "mocha": "2.5.3", "nyc": "14.1.1", "rimraf": "2.7.1", @@ -30,6 +31,7 @@ "npm": "1.2.8000 || >= 1.4.16" }, "scripts": { + "lint": "eslint .", "test": "mocha --reporter spec test/*/index.js", "test-cov": "nyc --reporter=html --reporter=text npm test" } diff --git a/test/.eslintrc.yml b/test/.eslintrc.yml new file mode 100644 index 0000000..9808c3b --- /dev/null +++ b/test/.eslintrc.yml @@ -0,0 +1,2 @@ +env: + mocha: true