Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2018-03-23 04:23:24 +0300
committerRebecca Turner <me@re-becca.org>2018-03-23 13:46:36 +0300
commit6d1aac42482a5fee7a38310ee2689050f95de056 (patch)
tree2edb3cdab3876945d2c25bdc922bf2a451c5560e /lib
parentc8146858d6e51411650ad4dc3bc5e294068ed1dc (diff)
standardize
Diffstat (limited to 'lib')
-rw-r--r--lib/access.js3
-rw-r--r--lib/adduser.js2
-rw-r--r--lib/auth/legacy.js60
-rw-r--r--lib/build.js4
-rw-r--r--lib/cache.js1
-rw-r--r--lib/ci.js14
-rw-r--r--lib/completion.js4
-rw-r--r--lib/config.js9
-rw-r--r--lib/config/core.js18
-rw-r--r--lib/config/defaults.js10
-rw-r--r--lib/config/fetch-opts.js12
-rw-r--r--lib/config/get-credentials-by-uri.js6
-rw-r--r--lib/config/load-prefix.js2
-rw-r--r--lib/config/set-credentials-by-uri.js2
-rw-r--r--lib/deprecate.js1
-rw-r--r--lib/dist-tag.js1
-rw-r--r--lib/edit.js4
-rw-r--r--lib/help-search.js18
-rw-r--r--lib/help.js6
-rw-r--r--lib/install.js6
-rw-r--r--lib/install/action/fetch.js2
-rw-r--r--lib/install/deps.js8
-rw-r--r--lib/install/diff-trees.js2
-rw-r--r--lib/install/read-shrinkwrap.js6
-rw-r--r--lib/link.js6
-rw-r--r--lib/ls.js16
-rw-r--r--lib/npm.js18
-rw-r--r--lib/outdated.js46
-rw-r--r--lib/owner.js3
-rw-r--r--lib/pack.js62
-rw-r--r--lib/profile.js1
-rw-r--r--lib/publish.js40
-rw-r--r--lib/repo.js4
-rw-r--r--lib/run-script.js2
-rw-r--r--lib/search/format-package-stream.js16
-rw-r--r--lib/search/package-filter.js20
-rw-r--r--lib/team.js1
-rw-r--r--lib/test.js1
-rw-r--r--lib/unbuild.js2
-rw-r--r--lib/uninstall.js4
-rw-r--r--lib/unpublish.js9
-rw-r--r--lib/update.js2
-rw-r--r--lib/utils/error-handler.js2
-rw-r--r--lib/utils/error-message.js2
-rw-r--r--lib/utils/gunzip-maybe.js4
-rw-r--r--lib/utils/is-registry.js1
-rw-r--r--lib/utils/metrics-launch.js1
-rw-r--r--lib/utils/parse-json.js2
-rw-r--r--lib/utils/perf.js1
-rw-r--r--lib/utils/pick-manifest-from-registry-metadata.js2
-rw-r--r--lib/utils/read-user-info.js1
-rw-r--r--lib/version.js6
-rw-r--r--lib/view.js8
53 files changed, 245 insertions, 239 deletions
diff --git a/lib/access.js b/lib/access.js
index ad7a1f54b..164ea3b7d 100644
--- a/lib/access.js
+++ b/lib/access.js
@@ -1,4 +1,5 @@
'use strict'
+/* eslint-disable standard/no-callback-literal */
var resolve = require('path').resolve
@@ -21,7 +22,7 @@ access.usage =
'npm access edit [<package>]'
access.subcommands = ['public', 'restricted', 'grant', 'revoke',
- 'ls-packages', 'ls-collaborators', 'edit']
+ 'ls-packages', 'ls-collaborators', 'edit']
access.completion = function (opts, cb) {
var argv = opts.conf.argv.remain
diff --git a/lib/adduser.js b/lib/adduser.js
index 0aac6b7fb..e1c221032 100644
--- a/lib/adduser.js
+++ b/lib/adduser.js
@@ -17,7 +17,7 @@ adduser.usage = usage(
function adduser (args, cb) {
if (!crypto) {
return cb(new Error(
- 'You must compile node with ssl support to use the adduser feature'
+ 'You must compile node with ssl support to use the adduser feature'
))
}
diff --git a/lib/auth/legacy.js b/lib/auth/legacy.js
index 08de61bff..cb27a1edc 100644
--- a/lib/auth/legacy.js
+++ b/lib/auth/legacy.js
@@ -42,38 +42,38 @@ module.exports.login = (creds, registry, scope, cb) => {
function login (conf) {
return profile.login(openerPromise, loginPrompter, conf)
- .catch((err) => {
- if (err.code === 'EOTP') throw err
- const u = conf.creds.username
- const p = conf.creds.password
- const e = conf.creds.email
- if (!(u && p && e)) throw err
- return profile.adduserCouch(u, e, p, conf)
- })
- .catch((err) => {
- if (err.code !== 'EOTP') throw err
- return read.otp('Authenticator provided OTP:').then((otp) => {
- conf.auth.otp = otp
+ .catch((err) => {
+ if (err.code === 'EOTP') throw err
const u = conf.creds.username
const p = conf.creds.password
- return profile.loginCouch(u, p, conf)
+ const e = conf.creds.email
+ if (!(u && p && e)) throw err
+ return profile.adduserCouch(u, e, p, conf)
})
- }).then((result) => {
- const newCreds = {}
- if (result && result.token) {
- newCreds.token = result.token
- } else {
- newCreds.username = conf.creds.username
- newCreds.password = conf.creds.password
- newCreds.email = conf.creds.email
- newCreds.alwaysAuth = npm.config.get('always-auth')
- }
+ .catch((err) => {
+ if (err.code !== 'EOTP') throw err
+ return read.otp('Authenticator provided OTP:').then((otp) => {
+ conf.auth.otp = otp
+ const u = conf.creds.username
+ const p = conf.creds.password
+ return profile.loginCouch(u, p, conf)
+ })
+ }).then((result) => {
+ const newCreds = {}
+ if (result && result.token) {
+ newCreds.token = result.token
+ } else {
+ newCreds.username = conf.creds.username
+ newCreds.password = conf.creds.password
+ newCreds.email = conf.creds.email
+ newCreds.alwaysAuth = npm.config.get('always-auth')
+ }
- const usermsg = conf.creds.username ? ' user ' + conf.creds.username : ''
- conf.log.info('login', 'Authorized' + usermsg)
- const scopeMessage = conf.scope ? ' to scope ' + conf.scope : ''
- const userout = conf.creds.username ? ' as ' + conf.creds.username : ''
- output('Logged in%s%s on %s.', userout, scopeMessage, conf.registry)
- return newCreds
- })
+ const usermsg = conf.creds.username ? ' user ' + conf.creds.username : ''
+ conf.log.info('login', 'Authorized' + usermsg)
+ const scopeMessage = conf.scope ? ' to scope ' + conf.scope : ''
+ const userout = conf.creds.username ? ' as ' + conf.creds.username : ''
+ output('Logged in%s%s on %s.', userout, scopeMessage, conf.registry)
+ return newCreds
+ })
}
diff --git a/lib/build.js b/lib/build.js
index 395f9437b..f8b3c4933 100644
--- a/lib/build.js
+++ b/lib/build.js
@@ -106,7 +106,7 @@ function rebuildBundles (pkg, folder, cb) {
if (!npm.config.get('rebuild-bundle')) return cb()
var deps = Object.keys(pkg.dependencies || {})
- .concat(Object.keys(pkg.devDependencies || {}))
+ .concat(Object.keys(pkg.devDependencies || {}))
var bundles = pkg.bundleDependencies || pkg.bundledDependencies || []
fs.readdir(path.resolve(folder, 'node_modules'), function (er, files) {
@@ -119,7 +119,7 @@ function rebuildBundles (pkg, folder, cb) {
chain(files.filter(function (file) {
// rebuild if:
// not a .folder, like .bin or .hooks
- return !file.match(/^[\._-]/) &&
+ return !file.match(/^[._-]/) &&
// not some old 0.x style bundle
file.indexOf('@') === -1 &&
// either not a dep, or explicitly bundled
diff --git a/lib/cache.js b/lib/cache.js
index 8bd2d5fcb..d80f196c8 100644
--- a/lib/cache.js
+++ b/lib/cache.js
@@ -1,4 +1,5 @@
'use strict'
+/* eslint-disable standard/no-callback-literal */
const BB = require('bluebird')
diff --git a/lib/ci.js b/lib/ci.js
index 6a3183d97..94b01235e 100644
--- a/lib/ci.js
+++ b/lib/ci.js
@@ -27,11 +27,11 @@ function ci (args, cb) {
config: npm.config,
log: npmlog
})
- .run()
- .then(
- (details) => console.error(`added ${details.pkgCount} packages in ${
- details.runTime / 1000
- }s`)
- )
- .then(() => cb(), cb)
+ .run()
+ .then(
+ (details) => console.error(`added ${details.pkgCount} packages in ${
+ details.runTime / 1000
+ }s`)
+ )
+ .then(() => cb(), cb)
}
diff --git a/lib/completion.js b/lib/completion.js
index 3157255bf..a682c134a 100644
--- a/lib/completion.js
+++ b/lib/completion.js
@@ -49,7 +49,7 @@ function completion (args, cb) {
if (isWindowsShell) {
var e = new Error('npm completion supported only in MINGW / Git bash on Windows')
e.code = 'ENOTSUP'
- e.errno = require('constants').ENOTSUP
+ e.errno = require('constants').ENOTSUP // eslint-disable-line node/no-deprecated-api
return cb(e)
}
@@ -150,7 +150,7 @@ function dumpScript (cb) {
fs.readFile(p, 'utf8', function (er, d) {
if (er) return cb(er)
- d = d.replace(/^\#\!.*?\n/, '')
+ d = d.replace(/^#!.*?\n/, '')
process.stdout.write(d, function () { cb() })
process.stdout.on('error', function (er) {
diff --git a/lib/config.js b/lib/config.js
index d260c04a5..a6862808f 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
module.exports = config
var log = require('npmlog')
@@ -39,7 +40,7 @@ config.completion = function (opts, cb) {
// todo: complete with valid values, if possible.
if (argv.length > 3) return cb(null, [])
// fallthrough
- /*eslint no-fallthrough:0*/
+ /* eslint no-fallthrough:0 */
case 'get':
case 'delete':
case 'rm':
@@ -89,7 +90,7 @@ function edit (cb) {
data = [
';;;;',
'; npm ' + (npm.config.get('global')
- ? 'globalconfig' : 'userconfig') + ' file',
+ ? 'globalconfig' : 'userconfig') + ' file',
'; this is a simple ini-formatted file',
'; lines that start with semi-colons are comments.',
'; read `npm help config` for help on the various options',
@@ -111,8 +112,8 @@ function edit (cb) {
.replace(/\n/g, '\n; ')
.split('\n'))
}, []))
- .concat([''])
- .join(os.EOL)
+ .concat([''])
+ .join(os.EOL)
writeFileAtomic(
f,
data,
diff --git a/lib/config/core.js b/lib/config/core.js
index 54a74bb84..4c542bc45 100644
--- a/lib/config/core.js
+++ b/lib/config/core.js
@@ -21,18 +21,20 @@ exports.defs = configDefs
Object.defineProperty(exports, 'defaults', { get: function () {
return configDefs.defaults
-}, enumerable: true })
+},
+enumerable: true })
Object.defineProperty(exports, 'types', { get: function () {
return configDefs.types
-}, enumerable: true })
+},
+enumerable: true })
exports.validate = validate
var myUid = process.env.SUDO_UID !== undefined
- ? process.env.SUDO_UID : (process.getuid && process.getuid())
+ ? process.env.SUDO_UID : (process.getuid && process.getuid())
var myGid = process.env.SUDO_GID !== undefined
- ? process.env.SUDO_GID : (process.getgid && process.getgid())
+ ? process.env.SUDO_GID : (process.getgid && process.getgid())
var loading = false
var loadCbs = []
@@ -274,7 +276,7 @@ Conf.prototype.save = function (where, cb) {
if (cb) return cb(er)
else return this.emit('error', er)
}
- this._saving --
+ this._saving--
if (this._saving === 0) {
if (cb) cb()
this.emit('save')
@@ -283,7 +285,7 @@ Conf.prototype.save = function (where, cb) {
then = then.bind(this)
done = done.bind(this)
- this._saving ++
+ this._saving++
var mode = where === 'user' ? '0600' : '0666'
if (!data.trim()) {
@@ -354,8 +356,8 @@ Conf.prototype.addEnv = function (env) {
// leave first char untouched, even if
// it is a '_' - convert all other to '-'
var p = k.toLowerCase()
- .replace(/^npm_config_/, '')
- .replace(/(?!^)_/g, '-')
+ .replace(/^npm_config_/, '')
+ .replace(/(?!^)_/g, '-')
conf[p] = env[k]
})
return CC.prototype.addEnv.call(this, '', conf, 'env')
diff --git a/lib/config/defaults.js b/lib/config/defaults.js
index 865805eb2..43c3f5ba0 100644
--- a/lib/config/defaults.js
+++ b/lib/config/defaults.js
@@ -82,7 +82,7 @@ if (home) process.env.HOME = home
else home = path.resolve(temp, 'npm-' + uidOrPid)
var cacheExtra = process.platform === 'win32' ? 'npm-cache' : '.npm'
-var cacheRoot = process.platform === 'win32' && process.env.APPDATA || home
+var cacheRoot = (process.platform === 'win32' && process.env.APPDATA) || home
var cache = path.resolve(cacheRoot, cacheExtra)
var globalPrefix
@@ -152,7 +152,7 @@ Object.defineProperty(exports, 'defaults', {get: function () {
globalconfig: path.resolve(globalPrefix, 'etc', 'npmrc'),
'global-style': false,
group: process.platform === 'win32' ? 0
- : process.env.SUDO_GID || (process.getgid && process.getgid()),
+ : process.env.SUDO_GID || (process.getgid && process.getgid()),
'ham-it-up': false,
heading: 'npm',
'if-present': false,
@@ -384,9 +384,9 @@ function getLocalAddresses () {
return interfaces[nic].filter(function (addr) {
return addr.family === 'IPv4'
})
- .map(function (addr) {
- return addr.address
- })
+ .map(function (addr) {
+ return addr.address
+ })
}).reduce(function (curr, next) {
return curr.concat(next)
}, []).concat(undefined)
diff --git a/lib/config/fetch-opts.js b/lib/config/fetch-opts.js
index 1a030c378..213c293d6 100644
--- a/lib/config/fetch-opts.js
+++ b/lib/config/fetch-opts.js
@@ -26,12 +26,12 @@ function fromPacote (opts) {
function getCacheMode (opts) {
return opts.offline
- ? 'only-if-cached'
- : opts.preferOffline
- ? 'force-cache'
- : opts.preferOnline
- ? 'no-cache'
- : 'default'
+ ? 'only-if-cached'
+ : opts.preferOffline
+ ? 'force-cache'
+ : opts.preferOnline
+ ? 'no-cache'
+ : 'default'
}
function getHeaders (uri, registry, opts) {
diff --git a/lib/config/get-credentials-by-uri.js b/lib/config/get-credentials-by-uri.js
index d04f6137d..5e672696b 100644
--- a/lib/config/get-credentials-by-uri.js
+++ b/lib/config/get-credentials-by-uri.js
@@ -40,14 +40,14 @@ function getCredentialsByURI (uri) {
var userDef = this.get('username')
var passDef = this.get('_password')
if (authDef && !(userDef && passDef)) {
- authDef = new Buffer(authDef, 'base64').toString()
+ authDef = Buffer.from(authDef, 'base64').toString()
authDef = authDef.split(':')
userDef = authDef.shift()
passDef = authDef.join(':')
}
if (this.get(nerfed + ':_password')) {
- c.password = new Buffer(this.get(nerfed + ':_password'), 'base64').toString('utf8')
+ c.password = Buffer.from(this.get(nerfed + ':_password'), 'base64').toString('utf8')
} else if (nerfed === defnerf && passDef) {
c.password = passDef
}
@@ -65,7 +65,7 @@ function getCredentialsByURI (uri) {
}
if (c.username && c.password) {
- c.auth = new Buffer(c.username + ':' + c.password).toString('base64')
+ c.auth = Buffer.from(c.username + ':' + c.password).toString('base64')
}
return c
diff --git a/lib/config/load-prefix.js b/lib/config/load-prefix.js
index c2af00c7f..090865d21 100644
--- a/lib/config/load-prefix.js
+++ b/lib/config/load-prefix.js
@@ -34,7 +34,7 @@ function loadPrefix (cb) {
Object.defineProperty(this, 'localPrefix',
{ set: function (prefix) { p = prefix },
get: function () { return p },
- enumerable: true })
+ enumerable: true })
// try to guess at a good node_modules location.
// If we are *explicitly* given a prefix on the cli, then
diff --git a/lib/config/set-credentials-by-uri.js b/lib/config/set-credentials-by-uri.js
index 74211380d..4723d561a 100644
--- a/lib/config/set-credentials-by-uri.js
+++ b/lib/config/set-credentials-by-uri.js
@@ -23,7 +23,7 @@ function setCredentialsByURI (uri, c) {
this.del(nerfed + ':_authToken', 'user')
- var encoded = new Buffer(c.password, 'utf8').toString('base64')
+ var encoded = Buffer.from(c.password, 'utf8').toString('base64')
this.set(nerfed + ':_password', encoded, 'user')
this.set(nerfed + ':username', c.username, 'user')
this.set(nerfed + ':email', c.email, 'user')
diff --git a/lib/deprecate.js b/lib/deprecate.js
index 15ae58e01..9b71d1de4 100644
--- a/lib/deprecate.js
+++ b/lib/deprecate.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
var npm = require('./npm.js')
var mapToRegistry = require('./utils/map-to-registry.js')
var npa = require('npm-package-arg')
diff --git a/lib/dist-tag.js b/lib/dist-tag.js
index 7c20ea990..bd0c5ae8a 100644
--- a/lib/dist-tag.js
+++ b/lib/dist-tag.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
module.exports = distTag
var log = require('npmlog')
diff --git a/lib/edit.js b/lib/edit.js
index 8e9bbd179..48bcd5d34 100644
--- a/lib/edit.js
+++ b/lib/edit.js
@@ -22,8 +22,8 @@ function edit (args, cb) {
))
}
p = p.split('/')
- .join('/node_modules/')
- .replace(/(\/node_modules)+/, '/node_modules')
+ .join('/node_modules/')
+ .replace(/(\/node_modules)+/, '/node_modules')
var f = path.resolve(npm.dir, p)
fs.lstat(f, function (er) {
if (er) return cb(er)
diff --git a/lib/help-search.js b/lib/help-search.js
index ffbe554b7..475f305e4 100644
--- a/lib/help-search.js
+++ b/lib/help-search.js
@@ -70,7 +70,7 @@ function searchFiles (args, files, cb) {
if (nextLine) {
for (a = 0, ll = args.length; a < ll && !match; a++) {
match = nextLine.toLowerCase()
- .indexOf(args[a].toLowerCase()) !== -1
+ .indexOf(args[a].toLowerCase()) !== -1
}
if (match) {
// skip over the next line, and the line after it.
@@ -107,7 +107,7 @@ function searchFiles (args, files, cb) {
lines.forEach(function (line) {
args.forEach(function (arg) {
var hit = (line || '').toLowerCase()
- .split(arg.toLowerCase()).length - 1
+ .split(arg.toLowerCase()).length - 1
if (hit > 0) {
found[arg] = (found[arg] || 0) + hit
totalHits += hit
@@ -144,12 +144,12 @@ function searchFiles (args, files, cb) {
// then by number of matching lines
results = results.sort(function (a, b) {
return a.found.length > b.found.length ? -1
- : a.found.length < b.found.length ? 1
- : a.totalHits > b.totalHits ? -1
- : a.totalHits < b.totalHits ? 1
- : a.lines.length > b.lines.length ? -1
- : a.lines.length < b.lines.length ? 1
- : 0
+ : a.found.length < b.found.length ? 1
+ : a.totalHits > b.totalHits ? -1
+ : a.totalHits < b.totalHits ? 1
+ : a.lines.length > b.lines.length ? -1
+ : a.lines.length < b.lines.length ? 1
+ : 0
})
cb(null, results)
@@ -170,7 +170,7 @@ function formatResults (args, results, cb) {
}).join(' ')
out += ((new Array(Math.max(1, cols - out.length - r.length)))
- .join(' ')) + r
+ .join(' ')) + r
if (!npm.config.get('long')) return out
diff --git a/lib/help.js b/lib/help.js
index 64c80f787..acc1243d2 100644
--- a/lib/help.js
+++ b/lib/help.js
@@ -97,8 +97,8 @@ function pickMan (mans, pref_) {
var an = a.match(nre)[1]
var bn = b.match(nre)[1]
return an === bn ? (a > b ? -1 : 1)
- : pref[an] < pref[bn] ? -1
- : 1
+ : pref[an] < pref[bn] ? -1
+ : 1
})
return mans[0]
}
@@ -168,7 +168,7 @@ function npmUsage (valid, cb) {
'',
'where <command> is one of:',
npm.config.get('long') ? usages()
- : ' ' + wrap(commands),
+ : ' ' + wrap(commands),
'',
'npm <command> -h quick help on <command>',
'npm -l display full usage info',
diff --git a/lib/install.js b/lib/install.js
index 7a7d75c90..4f913e00a 100644
--- a/lib/install.js
+++ b/lib/install.js
@@ -1,4 +1,6 @@
'use strict'
+/* eslint-disable camelcase */
+/* eslint-disable standard/no-callback-literal */
// npm install <pkg> <pkg> <pkg>
//
// See doc/cli/npm-install.md for more description
@@ -181,8 +183,8 @@ function install (where, args, cb) {
var globalTop = path.resolve(npm.globalDir, '..')
if (!where) {
where = npm.config.get('global')
- ? globalTop
- : npm.prefix
+ ? globalTop
+ : npm.prefix
}
validate('SAF', [where, args, cb])
// the /path/to/node_modules/..
diff --git a/lib/install/action/fetch.js b/lib/install/action/fetch.js
index a4d760fe8..5ad34e29d 100644
--- a/lib/install/action/fetch.js
+++ b/lib/install/action/fetch.js
@@ -12,5 +12,5 @@ function fetch (staging, pkg, log, next) {
log.silly('fetch', packageId(pkg))
const opts = pacoteOpts({integrity: pkg.package._integrity})
return finished(pacote.tarball.stream(pkg.package._requested, opts))
- .then(() => next(), next)
+ .then(() => next(), next)
}
diff --git a/lib/install/deps.js b/lib/install/deps.js
index d3b31ac09..2a0fc8d90 100644
--- a/lib/install/deps.js
+++ b/lib/install/deps.js
@@ -66,7 +66,7 @@ function doesChildVersionMatch (child, requested, requestor) {
// You'll see this scenario happen with at least tags and git dependencies.
// Some buggy clients will write spaces into the module name part of a _from.
if (child.package._from) {
- var fromReq = npa.resolve(moduleName(child), child.package._from.replace(new RegExp('^\s*' + moduleName(child) + '\s*@'), ''))
+ var fromReq = npa.resolve(moduleName(child), child.package._from.replace(new RegExp('^\\s*' + moduleName(child) + '\\s*@'), ''))
if (fromReq.rawSpec === requested.rawSpec) return true
if (fromReq.type === requested.type && fromReq.saveSpec && fromReq.saveSpec === requested.saveSpec) return true
}
@@ -105,7 +105,6 @@ function computeMetadata (tree, seen) {
resolveWithExistingModule(child, tree)
return true
}
- return
}
const deps = tree.package.dependencies || {}
@@ -187,15 +186,14 @@ function packageRelativePath (tree) {
var requested = tree.package._requested || {}
var isLocal = requested.type === 'directory' || requested.type === 'file'
return isLocal ? requested.fetchSpec
- : (tree.isLink || tree.isInLink) && !preserveSymlinks() ? tree.realpath
- : tree.path
+ : (tree.isLink || tree.isInLink) && !preserveSymlinks() ? tree.realpath
+ : tree.path
}
function matchingDep (tree, name) {
if (!tree || !tree.package) return
if (tree.package.dependencies && tree.package.dependencies[name]) return tree.package.dependencies[name]
if (tree.package.devDependencies && tree.package.devDependencies[name]) return tree.package.devDependencies[name]
- return
}
exports.getAllMetadata = function (args, tree, where, next) {
diff --git a/lib/install/diff-trees.js b/lib/install/diff-trees.js
index 06e6b77a9..0e9ec7872 100644
--- a/lib/install/diff-trees.js
+++ b/lib/install/diff-trees.js
@@ -50,7 +50,7 @@ function pkgIntegrity (pkg) {
if (Object.keys(integrity).length === 0) return
return integrity
} catch (ex) {
- return
+
}
}
diff --git a/lib/install/read-shrinkwrap.js b/lib/install/read-shrinkwrap.js
index 2d469864f..707467801 100644
--- a/lib/install/read-shrinkwrap.js
+++ b/lib/install/read-shrinkwrap.js
@@ -52,9 +52,9 @@ module.exports.andInflate = function (child, next) {
}
const PARENT_RE = /\|{7,}/g
-const OURS_RE = /\<{7,}/g
-const THEIRS_RE = /\={7,}/g
-const END_RE = /\>{7,}/g
+const OURS_RE = /<{7,}/g
+const THEIRS_RE = /={7,}/g
+const END_RE = />{7,}/g
module.exports._isDiff = isDiff
function isDiff (str) {
diff --git a/lib/link.js b/lib/link.js
index 158d9b064..e05526c40 100644
--- a/lib/link.js
+++ b/lib/link.js
@@ -25,7 +25,7 @@ link.completion = function (opts, cb) {
var dir = npm.globalDir
fs.readdir(dir, function (er, files) {
cb(er, files.filter(function (f) {
- return !f.match(/^[\._-]/)
+ return !f.match(/^[._-]/)
}))
})
}
@@ -37,7 +37,7 @@ function link (args, cb) {
var msg = 'npm link not supported on windows prior to node 0.7.9'
var e = new Error(msg)
e.code = 'ENOTSUP'
- e.errno = require('constants').ENOTSUP
+ e.errno = require('constants').ENOTSUP // eslint-disable-line node/no-deprecated-api
return cb(e)
}
}
@@ -148,8 +148,8 @@ function linkPkg (folder, cb_) {
er = new Error('Package must have a name field to be linked')
return cb(er)
}
- if (npm.config.get('dry-run')) return resultPrinter(path.basename(me), me, target, cb)
var target = path.resolve(npm.globalDir, d.name)
+ if (npm.config.get('dry-run')) return resultPrinter(path.basename(me), me, target, cb)
symlink(me, target, false, true, function (er) {
if (er) return cb(er)
log.verbose('link', 'build target', target)
diff --git a/lib/ls.js b/lib/ls.js
index 7c0ea71e7..bb5e433f7 100644
--- a/lib/ls.js
+++ b/lib/ls.js
@@ -139,9 +139,9 @@ function filterByEnv (data) {
return
}
- if ((dev && inList(devKeys, name)) || // only --dev
- (production && inList(prodKeys, name)) || // only --production
- (!dev && !production)) { // no --production|--dev|--only=xxx
+ if ((dev && inList(devKeys, name)) || // only --dev
+ (production && inList(prodKeys, name)) || // only --production
+ (!dev && !production)) { // no --production|--dev|--only=xxx
dependencies[name] = data.dependencies[name]
}
})
@@ -165,7 +165,7 @@ function alphasort (a, b) {
a = a.toLowerCase()
b = b.toLowerCase()
return a > b ? 1
- : a < b ? -1 : 0
+ : a < b ? -1 : 0
}
function isCruft (data) {
@@ -520,16 +520,16 @@ function makeParseable_ (data, long, dir, depth, parent, d) {
if (data.missing) {
if (depth < npm.config.get('depth')) {
data = npm.config.get('long')
- ? path.resolve(parent.path, 'node_modules', d) +
+ ? path.resolve(parent.path, 'node_modules', d) +
':' + d + '@' + JSON.stringify(data.requiredBy) + ':INVALID:MISSING'
- : ''
+ : ''
} else {
data = path.resolve(dir || '', 'node_modules', d || '') +
(npm.config.get('long')
- ? ':' + d + '@' + JSON.stringify(data.requiredBy) +
+ ? ':' + d + '@' + JSON.stringify(data.requiredBy) +
':' + // no realpath resolved
':MAXDEPTH'
- : '')
+ : '')
}
return data
diff --git a/lib/npm.js b/lib/npm.js
index e58712603..2ff217c24 100644
--- a/lib/npm.js
+++ b/lib/npm.js
@@ -1,6 +1,6 @@
;(function () {
// windows: running 'npm blah' in this folder will invoke WSH, not node.
- /*globals WScript*/
+ /* globals WScript */
if (typeof WScript !== 'undefined') {
WScript.echo(
'npm does not work when run\n' +
@@ -164,11 +164,13 @@
})
return commandCache[a]
- }, enumerable: fullList.indexOf(c) !== -1, configurable: true })
+ },
+ enumerable: fullList.indexOf(c) !== -1,
+ configurable: true })
// make css-case commands callable via camelCase as well
- if (c.match(/\-([a-z])/)) {
- addCommand(c.replace(/\-([a-z])/g, function (a, b) {
+ if (c.match(/-([a-z])/)) {
+ addCommand(c.replace(/-([a-z])/g, function (a, b) {
return b.toUpperCase()
}))
}
@@ -411,8 +413,8 @@
{
get: function () {
return (process.platform !== 'win32')
- ? path.resolve(npm.globalPrefix, 'lib', 'node_modules')
- : path.resolve(npm.globalPrefix, 'node_modules')
+ ? path.resolve(npm.globalPrefix, 'lib', 'node_modules')
+ : path.resolve(npm.globalPrefix, 'node_modules')
},
enumerable: true
})
@@ -455,7 +457,9 @@
}
npm.commands[n](args, cb)
}
- }, enumerable: false, configurable: true })
+ },
+ enumerable: false,
+ configurable: true })
})
if (require.main === module) {
diff --git a/lib/outdated.js b/lib/outdated.js
index 5cae20043..8b0a43d6b 100644
--- a/lib/outdated.js
+++ b/lib/outdated.js
@@ -89,11 +89,11 @@ function outdated (args, silent, cb) {
} else {
var outList = list.map(makePretty)
var outHead = [ 'Package',
- 'Current',
- 'Wanted',
- 'Latest',
- 'Location'
- ]
+ 'Current',
+ 'Wanted',
+ 'Latest',
+ 'Location'
+ ]
if (long) outHead.push('Package Type')
var outTable = [outHead].concat(outList)
@@ -117,25 +117,19 @@ function outdated (args, silent, cb) {
// [[ dir, dep, has, want, latest, type ]]
function makePretty (p) {
- var dep = p[0]
var depname = p[1]
- var dir = dep.path
var has = p[2]
var want = p[3]
var latest = p[4]
var type = p[6]
var deppath = p[7]
- if (!npm.config.get('global')) {
- dir = path.relative(process.cwd(), dir)
- }
-
var columns = [ depname,
- has || 'MISSING',
- want,
- latest,
- deppath
- ]
+ has || 'MISSING',
+ want,
+ latest,
+ deppath
+ ]
if (long) columns[5] = type
if (npm.color) {
@@ -183,10 +177,10 @@ function makeJSON (list) {
dir = path.relative(process.cwd(), dir)
}
out[depname] = { current: has,
- wanted: want,
- latest: latest,
- location: dir
- }
+ wanted: want,
+ latest: latest,
+ location: dir
+ }
if (long) out[depname].type = type
})
return JSON.stringify(out, null, 2)
@@ -317,11 +311,11 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, cb, type) {
// show user that no viable version can be found
if (er) return cb(er)
outdated_(args,
- pkgpath,
- tree,
- has,
- depth + 1,
- cb)
+ pkgpath,
+ tree,
+ has,
+ depth + 1,
+ cb)
}
function doIt (wanted, latest) {
@@ -399,7 +393,7 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, cb, type) {
var cFromUrl = curr && curr.from && url.parse(curr.from).protocol
if (!curr ||
- dFromUrl && cFromUrl && m._from !== curr.from ||
+ (dFromUrl && cFromUrl && m._from !== curr.from) ||
m.version !== curr.version ||
m.version !== l.version) {
doIt(m.version, l.version)
diff --git a/lib/owner.js b/lib/owner.js
index 64d086af7..3c2660ace 100644
--- a/lib/owner.js
+++ b/lib/owner.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
module.exports = owner
var npm = require('./npm.js')
@@ -53,7 +54,7 @@ owner.completion = function (opts, cb) {
})
}
// else fallthrough
- /*eslint no-fallthrough:0*/
+ /* eslint no-fallthrough:0 */
case 'add':
if (argv.length > 3) {
theUser = encodeURIComponent(argv[3])
diff --git a/lib/pack.js b/lib/pack.js
index dbcbf2967..8ad8fefe5 100644
--- a/lib/pack.js
+++ b/lib/pack.js
@@ -63,24 +63,24 @@ function pack_ (pkg, dir) {
return BB.fromNode((cb) => fpm(pkg, dir, cb)).then((mani) => {
let name = mani.name[0] === '@'
// scoped packages get special treatment
- ? mani.name.substr(1).replace(/\//g, '-')
- : mani.name
+ ? mani.name.substr(1).replace(/\//g, '-')
+ : mani.name
const target = `${name}-${mani.version}.tgz`
return pinflight(target, () => {
if (mani._requested.type === 'directory') {
return cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'packing'}, (tmp) => {
const tmpTarget = path.join(tmp, path.basename(target))
return prepareDirectory(mani._resolved)
- .then(() => {
- return packDirectory(mani, mani._resolved, tmpTarget, target, true)
- })
- .tap(() => {
- if (npm.config.get('dry-run')) {
- log.verbose('pack', '--dry-run mode enabled. Skipping write.')
- } else {
- return move(tmpTarget, target, {Promise: BB, fs})
- }
- })
+ .then(() => {
+ return packDirectory(mani, mani._resolved, tmpTarget, target, true)
+ })
+ .tap(() => {
+ if (npm.config.get('dry-run')) {
+ log.verbose('pack', '--dry-run mode enabled. Skipping write.')
+ } else {
+ return move(tmpTarget, target, {Promise: BB, fs})
+ }
+ })
})
} else if (npm.config.get('dry-run')) {
log.verbose('pack', '--dry-run mode enabled. Skipping write.')
@@ -98,12 +98,12 @@ function pack_ (pkg, dir) {
function packFromPackage (arg, target, filename) {
const opts = pacoteOpts()
return pacote.tarball.toFile(arg, target, pacoteOpts())
- .then(() => cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'unpacking'}, (tmp) => {
- const tmpTarget = path.join(tmp, filename)
- return pacote.extract(arg, tmpTarget, opts)
- .then(() => readJson(path.join(tmpTarget, 'package.json')))
- }))
- .then((pkg) => getContents(pkg, target, filename))
+ .then(() => cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'unpacking'}, (tmp) => {
+ const tmpTarget = path.join(tmp, filename)
+ return pacote.extract(arg, tmpTarget, opts)
+ .then(() => readJson(path.join(tmpTarget, 'package.json')))
+ }))
+ .then((pkg) => getContents(pkg, target, filename))
}
module.exports.prepareDirectory = prepareDirectory
@@ -238,19 +238,19 @@ function getContents (pkg, target, filename, silent) {
},
strip: 1
})
- .then(() => BB.fromNode((cb) => fs.stat(target, cb)))
- .then((stat) => ({
- id: pkg._id,
- name: pkg.name,
- version: pkg.version,
- from: pkg._from,
- size: stat.size,
- unpackedSize: totalEntrySize,
- filename,
- files,
- entryCount: totalEntries,
- bundled: Array.from(bundled)
- }))
+ .then(() => BB.fromNode((cb) => fs.stat(target, cb)))
+ .then((stat) => ({
+ id: pkg._id,
+ name: pkg.name,
+ version: pkg.version,
+ from: pkg._from,
+ size: stat.size,
+ unpackedSize: totalEntrySize,
+ filename,
+ files,
+ entryCount: totalEntries,
+ bundled: Array.from(bundled)
+ }))
}
const PASSTHROUGH_OPTS = [
diff --git a/lib/profile.js b/lib/profile.js
index 016e89815..f57123932 100644
--- a/lib/profile.js
+++ b/lib/profile.js
@@ -137,7 +137,6 @@ function get (args) {
output(`${key}\t${info[key]}`)
}
})
- return
} else {
const table = new Table()
Object.keys(cleaned).forEach((k) => table.push({[ansistyles.bright(k)]: cleaned[k]}))
diff --git a/lib/publish.js b/lib/publish.js
index 2f2aa082e..f0616d38d 100644
--- a/lib/publish.js
+++ b/lib/publish.js
@@ -48,15 +48,15 @@ function publish (args, isRetry, cb) {
}
return publish_(args[0])
- .then((tarball) => {
- const silent = log.level === 'silent'
- if (!silent && npm.config.get('json')) {
- output(JSON.stringify(tarball, null, 2))
- } else if (!silent) {
- output(`+ ${tarball.id}`)
- }
- })
- .nodeify(cb)
+ .then((tarball) => {
+ const silent = log.level === 'silent'
+ if (!silent && npm.config.get('json')) {
+ output(JSON.stringify(tarball, null, 2))
+ } else if (!silent) {
+ output(`+ ${tarball.id}`)
+ }
+ })
+ .nodeify(cb)
}
function publish_ (arg) {
@@ -93,9 +93,9 @@ function publishFromDirectory (arg) {
return cacache.tmp.withTmp(npm.tmp, {tmpPrefix: 'fromDir'}, (tmpDir) => {
const target = path.join(tmpDir, 'package.tgz')
return pack.packDirectory(pkg, arg, target, null, true)
- .tap((c) => { contents = c })
- .then((c) => !npm.config.get('json') && pack.logContents(c))
- .then(() => upload(arg, pkg, false, target))
+ .tap((c) => { contents = c })
+ .then((c) => !npm.config.get('json') && pack.logContents(c))
+ .then(() => upload(arg, pkg, false, target))
})
}).then(() => {
return readJson(path.join(arg, 'package.json'))
@@ -104,7 +104,7 @@ function publishFromDirectory (arg) {
}).tap((pkg) => {
return lifecycle(pkg, 'postpublish', arg)
})
- .then(() => contents)
+ .then(() => contents)
}
function publishFromPackage (arg) {
@@ -113,13 +113,13 @@ function publishFromPackage (arg) {
const target = path.join(tmp, 'package.json')
const opts = pacoteOpts()
return pacote.tarball.toFile(arg, target, opts)
- .then(() => pacote.extract(arg, extracted, opts))
- .then(() => readJson(path.join(extracted, 'package.json')))
- .then((pkg) => {
- return BB.resolve(pack.getContents(pkg, target))
- .tap((c) => !npm.config.get('json') && pack.logContents(c))
- .tap(() => upload(arg, pkg, false, target))
- })
+ .then(() => pacote.extract(arg, extracted, opts))
+ .then(() => readJson(path.join(extracted, 'package.json')))
+ .then((pkg) => {
+ return BB.resolve(pack.getContents(pkg, target))
+ .tap((c) => !npm.config.get('json') && pack.logContents(c))
+ .tap(() => upload(arg, pkg, false, target))
+ })
})
}
diff --git a/lib/repo.js b/lib/repo.js
index d7e79d76a..7ad61c97a 100644
--- a/lib/repo.js
+++ b/lib/repo.js
@@ -43,8 +43,8 @@ function unknownHostedUrl (url) {
}
url = url_.parse(url)
var protocol = url.protocol === 'https:'
- ? 'https:'
- : 'http:'
+ ? 'https:'
+ : 'http:'
return protocol + '//' + (url.host || '') +
url.path.replace(/\.git$/, '')
} catch (e) {}
diff --git a/lib/run-script.js b/lib/run-script.js
index fb7781f55..639917441 100644
--- a/lib/run-script.js
+++ b/lib/run-script.js
@@ -32,7 +32,7 @@ runScript.completion = function (opts, cb) {
if (scripts.indexOf(argv[2]) !== -1) return cb()
// ok, try to find out which package it was, then
var pref = npm.config.get('global') ? npm.config.get('prefix')
- : npm.localPrefix
+ : npm.localPrefix
var pkgDir = path.resolve(pref, 'node_modules', argv[2], 'package.json')
readJson(pkgDir, function (er, d) {
if (er && er.code !== 'ENOENT' && er.code !== 'ENOTDIR') return cb(er)
diff --git a/lib/search/format-package-stream.js b/lib/search/format-package-stream.js
index a312e3f48..bb0f552ba 100644
--- a/lib/search/format-package-stream.js
+++ b/lib/search/format-package-stream.js
@@ -50,8 +50,8 @@ function prettify (data, num, opts) {
var pkg = normalizePackage(data, opts)
var columns = opts.description
- ? ['name', 'description', 'author', 'date', 'version', 'keywords']
- : ['name', 'author', 'date', 'version', 'keywords']
+ ? ['name', 'description', 'author', 'date', 'version', 'keywords']
+ : ['name', 'author', 'date', 'version', 'keywords']
if (opts.parseable) {
return columns.map(function (col) {
@@ -157,16 +157,16 @@ function normalizePackage (data, opts) {
return '=' + m.username
}).join(' '),
keywords: Array.isArray(data.keywords)
- ? data.keywords.join(' ')
- : typeof data.keywords === 'string'
- ? data.keywords.replace(/[,\s]+/, ' ')
- : '',
+ ? data.keywords.join(' ')
+ : typeof data.keywords === 'string'
+ ? data.keywords.replace(/[,\s]+/, ' ')
+ : '',
version: data.version,
- date: data.date &&
+ date: (data.date &&
(data.date.toISOString() // remove time
.split('T').join(' ')
.replace(/:[0-9]{2}\.[0-9]{3}Z$/, ''))
- .slice(0, -5) ||
+ .slice(0, -5)) ||
'prehistoric'
}
}
diff --git a/lib/search/package-filter.js b/lib/search/package-filter.js
index ac2950f46..892adb08c 100644
--- a/lib/search/package-filter.js
+++ b/lib/search/package-filter.js
@@ -8,16 +8,16 @@ function filter (data, include, exclude, opts) {
function getWords (data, opts) {
return [ data.name ]
- .concat((opts && opts.description) ? data.description : [])
- .concat((data.maintainers || []).map(function (m) {
- return '=' + m.name
- }))
- .concat(data.versions && data.versions.length && data.url && ('<' + data.url + '>'))
- .concat(data.keywords || [])
- .map(function (f) { return f && f.trim && f.trim() })
- .filter(function (f) { return f })
- .join(' ')
- .toLowerCase()
+ .concat((opts && opts.description) ? data.description : [])
+ .concat((data.maintainers || []).map(function (m) {
+ return '=' + m.name
+ }))
+ .concat(data.versions && data.versions.length && data.url && ('<' + data.url + '>'))
+ .concat(data.keywords || [])
+ .map(function (f) { return f && f.trim && f.trim() })
+ .filter(function (f) { return f })
+ .join(' ')
+ .toLowerCase()
}
function filterWords (data, include, exclude, opts) {
diff --git a/lib/team.js b/lib/team.js
index f99063b27..1e0a09496 100644
--- a/lib/team.js
+++ b/lib/team.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
var mapToRegistry = require('./utils/map-to-registry.js')
var npm = require('./npm')
var output = require('./utils/output.js')
diff --git a/lib/test.js b/lib/test.js
index 06138ac00..05bffed86 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
module.exports = test
const testCmd = require('./utils/lifecycle-cmd.js')('test')
diff --git a/lib/unbuild.js b/lib/unbuild.js
index 78293c9ca..d527778e9 100644
--- a/lib/unbuild.js
+++ b/lib/unbuild.js
@@ -77,7 +77,7 @@ function rmBins (pkg, folder, parent, top, cb) {
asyncMap(Object.keys(pkg.bin), function (b, cb) {
if (process.platform === 'win32') {
chain([ [gentlyRm, path.resolve(binRoot, b) + '.cmd', true, folder],
- [gentlyRm, path.resolve(binRoot, b), true, folder] ], cb)
+ [gentlyRm, path.resolve(binRoot, b), true, folder] ], cb)
} else {
gentlyRm(path.resolve(binRoot, b), true, folder, cb)
}
diff --git a/lib/uninstall.js b/lib/uninstall.js
index 333d3e9d6..c4bd23ea3 100644
--- a/lib/uninstall.js
+++ b/lib/uninstall.js
@@ -29,8 +29,8 @@ function uninstall (args, cb) {
if (args.length === 1 && args[0] === '.') args = []
const where = npm.config.get('global') || !args.length
- ? path.resolve(npm.globalDir, '..')
- : npm.prefix
+ ? path.resolve(npm.globalDir, '..')
+ : npm.prefix
args = args.filter(function (a) {
return path.resolve(a) !== where
diff --git a/lib/unpublish.js b/lib/unpublish.js
index 4ea818702..c2e9edd80 100644
--- a/lib/unpublish.js
+++ b/lib/unpublish.js
@@ -1,3 +1,4 @@
+/* eslint-disable standard/no-callback-literal */
module.exports = unpublish
@@ -100,10 +101,10 @@ function gotProject (project, version, publishConfig, cb_) {
// remove from the cache first
// npm.commands.cache(['clean', project, version], function (er) {
- // if (er) {
- // log.error('unpublish', 'Failed to clean cache')
- // return cb(er)
- // }
+ // if (er) {
+ // log.error('unpublish', 'Failed to clean cache')
+ // return cb(er)
+ // }
mapToRegistry(project, config, function (er, uri, auth) {
if (er) return cb(er)
diff --git a/lib/update.js b/lib/update.js
index efb56f5e4..9b1345f9d 100644
--- a/lib/update.js
+++ b/lib/update.js
@@ -57,7 +57,7 @@ function update_ (args) {
// use the initial installation method (repo, tar, git) for updating
if (url.parse(ww.req).protocol) ww.what = ww.req
- const where = ww.dep.parent && ww.dep.parent.path || ww.dep.path
+ const where = (ww.dep.parent && ww.dep.parent.path) || ww.dep.path
const isTransitive = !(ww.dep.requiredBy || []).some((p) => p.isTop)
const key = where + ':' + String(isTransitive)
if (!toInstall[key]) toInstall[key] = {where: where, opts: {saveOnlyLock: isTransitive}, what: []}
diff --git a/lib/utils/error-handler.js b/lib/utils/error-handler.js
index b2fd45a5f..6631c1074 100644
--- a/lib/utils/error-handler.js
+++ b/lib/utils/error-handler.js
@@ -247,6 +247,6 @@ function writeLogFile () {
log.record.length = 0
wroteLogFile = true
} catch (ex) {
- return
+
}
}
diff --git a/lib/utils/error-message.js b/lib/utils/error-message.js
index cd31d7d71..126b440c8 100644
--- a/lib/utils/error-message.js
+++ b/lib/utils/error-message.js
@@ -299,7 +299,7 @@ function errorMessage (er) {
])
break
} // else passthrough
- /*eslint no-fallthrough:0*/
+ /* eslint no-fallthrough:0 */
case 'ENOSPC':
short.push(['nospc', er.message])
diff --git a/lib/utils/gunzip-maybe.js b/lib/utils/gunzip-maybe.js
index db75f0601..adf7e4402 100644
--- a/lib/utils/gunzip-maybe.js
+++ b/lib/utils/gunzip-maybe.js
@@ -11,8 +11,8 @@ function gunzip () {
var stream = duplex()
var peeker = through(function (chunk, enc, cb) {
var newStream = hasGzipHeader(chunk)
- ? zlib.createGunzip()
- : through()
+ ? zlib.createGunzip()
+ : through()
stream.setReadable(newStream)
stream.setWritable(newStream)
stream.write(chunk)
diff --git a/lib/utils/is-registry.js b/lib/utils/is-registry.js
index 434cdbecb..e5f08e16a 100644
--- a/lib/utils/is-registry.js
+++ b/lib/utils/is-registry.js
@@ -9,4 +9,3 @@ function isRegistry (req) {
if (req.type === 'range' || req.type === 'version' || req.type === 'tag') return true
return false
}
-
diff --git a/lib/utils/metrics-launch.js b/lib/utils/metrics-launch.js
index 821f8bc7e..7e2a8d1cc 100644
--- a/lib/utils/metrics-launch.js
+++ b/lib/utils/metrics-launch.js
@@ -1,4 +1,5 @@
'use strict'
+/* eslint-disable camelcase */
module.exports = launchSendMetrics
var fs = require('graceful-fs')
var child_process = require('child_process')
diff --git a/lib/utils/parse-json.js b/lib/utils/parse-json.js
index c4149d282..c2ebac358 100644
--- a/lib/utils/parse-json.js
+++ b/lib/utils/parse-json.js
@@ -8,7 +8,7 @@ parseJSON.noExceptions = function (content) {
try {
return parseJSON(content)
} catch (ex) {
- return
+
}
}
diff --git a/lib/utils/perf.js b/lib/utils/perf.js
index 042326322..eaef985fa 100644
--- a/lib/utils/perf.js
+++ b/lib/utils/perf.js
@@ -22,6 +22,5 @@ function timeEnd (name) {
delete timings[name]
} else {
log.silly('timing', "Tried to end timer that doesn't exist:", name)
- return
}
}
diff --git a/lib/utils/pick-manifest-from-registry-metadata.js b/lib/utils/pick-manifest-from-registry-metadata.js
index e2c0d2e5a..589cef207 100644
--- a/lib/utils/pick-manifest-from-registry-metadata.js
+++ b/lib/utils/pick-manifest-from-registry-metadata.js
@@ -21,6 +21,6 @@ function pickManifestFromRegistryMetadata (spec, tag, versions, metadata) {
} else if (spec === '*' && versions.length && tagged && metadata.versions[tagged]) {
return {resolvedTo: tag, manifest: metadata.versions[tagged]}
} else {
- return
+
}
}
diff --git a/lib/utils/read-user-info.js b/lib/utils/read-user-info.js
index 359432cf7..81bb44c98 100644
--- a/lib/utils/read-user-info.js
+++ b/lib/utils/read-user-info.js
@@ -63,4 +63,3 @@ function readEmail (msg, email, opts, isRetry) {
return read({prompt: msg, default: email || ''})
.then((username) => readEmail(msg, username, opts, true))
}
-
diff --git a/lib/version.js b/lib/version.js
index 23880b61a..d73d2507e 100644
--- a/lib/version.js
+++ b/lib/version.js
@@ -323,8 +323,8 @@ function stagePackageFiles (localData, options) {
function addLocalFile (file, options, ignoreFailure) {
const p = git.exec(['add', path.join(npm.localPrefix, file)], options)
return ignoreFailure
- ? p.catch(() => {})
- : p
+ ? p.catch(() => {})
+ : p
}
function write (data, file, indent, newline, cb) {
@@ -334,7 +334,7 @@ function write (data, file, indent, newline, cb) {
log.verbose('version.write', 'data', data, 'to', file)
writeFileAtomic(
path.join(npm.localPrefix, file),
- new Buffer(stringifyPackage(data, indent, newline)),
+ stringifyPackage(data, indent, newline),
cb
)
}
diff --git a/lib/view.js b/lib/view.js
index edb600577..0070e2d40 100644
--- a/lib/view.js
+++ b/lib/view.js
@@ -171,8 +171,8 @@ function fetchAndRead (nv, args, silent, cb) {
) {
data.version = version
BB.all(results.map((v) => prettyView(data, v[Object.keys(v)[0]][''])))
- .nodeify(cb)
- .then(() => retval)
+ .nodeify(cb)
+ .then(() => retval)
} else {
printData(retval, data._id, cb.bind(null, error, retval))
}
@@ -471,8 +471,8 @@ function cleanup (data) {
if (keys.length <= 3 &&
data.name &&
(keys.length === 1 ||
- keys.length === 3 && data.email && data.url ||
- keys.length === 2 && (data.email || data.url))) {
+ (keys.length === 3 && data.email && data.url) ||
+ (keys.length === 2 && (data.email || data.url)))) {
data = unparsePerson(data)
}
return data