Skip to content

Commit

Permalink
lint: add basic eslint configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jul 12, 2019
1 parent 512d1e2 commit 9d7ebbd
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.nyc_output
coverage
node_modules
7 changes: 7 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -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" }]
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/async.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports = function() {
args.push(function(res) {
cur_waiter.resolve(id, res);
})

fn.apply(null, args);

// return the id placeholder
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
2 changes: 2 additions & 0 deletions test/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
env:
mocha: true

0 comments on commit 9d7ebbd

Please sign in to comment.