Skip to content

Commit

Permalink
build: lint ava tests (#91)
Browse files Browse the repository at this point in the history
* build: autofix lints when committing
* build: switch from standard to eslint for ava test linting
* fix(cli): adapt to Promise API
  • Loading branch information
malept authored Mar 25, 2020
1 parent e8dae76 commit ef3995d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
11 changes: 5 additions & 6 deletions cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env node

/* eslint-disable no-process-exit */

var extract = require('./')

var args = process.argv.slice(2)
Expand All @@ -10,11 +12,8 @@ if (!source) {
process.exit(1)
}

extract(source, { dir: dest }, function (err, results) {
if (err) {
extract(source, { dir: dest })
.catch(function (err) {
console.error('error!', err)
process.exit(1)
} else {
process.exit(0)
}
})
})
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const debug = require('debug')('extract-zip')
// eslint-disable-next-line node/no-unsupported-features/node-builtins
const { createWriteStream, promises: fs } = require('fs')
const getStream = require('get-stream')
const path = require('path')
Expand Down
34 changes: 29 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"scripts": {
"ava": "ava",
"coverage": "nyc ava",
"lint": "standard",
"lint": "eslint .",
"test": "npm run lint && ava"
},
"files": [
Expand All @@ -33,11 +33,35 @@
},
"devDependencies": {
"ava": "^3.5.1",
"eslint": "^6.8.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-ava": "^10.2.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"fs-extra": "^9.0.0",
"nyc": "^15.0.0",
"standard": "^14.3.3"
"husky": "^4.2.3",
"lint-staged": "^10.0.9",
"nyc": "^15.0.0"
},
"directories": {
"test": "test"
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:ava/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:node/recommended",
"plugin:promise/recommended",
"standard"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": "eslint --fix"
}
}

0 comments on commit ef3995d

Please sign in to comment.