Skip to content
Merged
2 changes: 1 addition & 1 deletion lib/base-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class BaseCommand {
}

if (config.get('workspaces') === false && config.get('workspace').length) {
throw new Error('Can not use --no-workspaces and --workspace at the same time')
throw new Error('Cannot use --no-workspaces and --workspace at the same time')
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/cli/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = async (process, validateEngines) => {
log.info('using', 'npm@%s', npm.version)
log.info('using', 'node@%s', process.version)

// At this point we've required a few files and can be pretty sure we dont contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers.
// At this point we've required a few files and can be pretty sure we don't contain invalid syntax for this version of node. It's possible a lazy require would, but that's unlikely enough that it's not worth catching anymore and we attach the more important exit handlers.
validateEngines.off()
exitHandler.registerUncaughtHandlers()

Expand Down Expand Up @@ -57,7 +57,7 @@ module.exports = async (process, validateEngines) => {

const execPromise = npm.exec(command, args)

// this is async but we dont await it, since its ok if it doesnt
// this is async but we don't await it, since its ok if it doesnt
// finish before the command finishes running. it uses command and argv
// so it must be initiated here, after the command name is set
const updateNotifier = require('./update-notifier.js')
Expand Down
8 changes: 4 additions & 4 deletions lib/cli/exit-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ExitHandler {

constructor ({ process }) {
this.#process = process
this.#process.on('exit', this.#handleProcesExitAndReset)
this.#process.on('exit', this.#handleProcessExitAndReset)
}

registerUncaughtHandlers () {
Expand All @@ -49,12 +49,12 @@ class ExitHandler {
this.#handleExit(err)
}

#handleProcesExitAndReset = (code) => {
#handleProcessExitAndReset = (code) => {
this.#handleProcessExit(code)

// Reset all the state. This is only relevant for tests since
// in reality the process fully exits here.
this.#process.off('exit', this.#handleProcesExitAndReset)
this.#process.off('exit', this.#handleProcessExitAndReset)
this.#process.off('uncaughtException', this.#handleExit)
this.#process.off('unhandledRejection', this.#handleExit)
if (this.#loaded) {
Expand Down Expand Up @@ -158,7 +158,7 @@ class ExitHandler {
this.#exitErrorMessage = err?.suppressError === true ? false : !!err

// Prefer the exit code of the error, then the current process exit code,
// then set it to 1 if we still have an error. Otherwise we call process.exit
// then set it to 1 if we still have an error. Otherwise, we call process.exit
// with undefined so that it can determine the final exit code
const exitCode = err?.exitCode ?? this.#process.exitCode ?? (err ? 1 : undefined)

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Audit extends ArboristWorkspaceCmd {
async auditAdvisories (args) {
const fix = args[0] === 'fix'
if (this.npm.config.get('package-lock') === false && fix) {
throw this.usageError('fix can not be used without a package-lock')
throw this.usageError('fix cannot be used without a package-lock')
}
const reporter = this.npm.config.get('json') ? 'json' : 'detail'
const Arborist = require('@npmcli/arborist')
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/completion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// zsh or bash when calling a function for completion, based on the cursor
// position and the command line thus far. These are:
// COMP_CWORD: the index of the "word" in the command line being completed
// COMP_LINE: the full command line thusfar as a string
// COMP_LINE: the full command line thus far as a string
// COMP_POINT: the cursor index at the point of triggering completion
//
// We parse the command line with nopt, like npm does, and then create an
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { redact } = require('@npmcli/redact')
// validate valid configs during "npm config set", and folks may have old
// invalid entries lying around in a config file that we still want to protect
// when running "npm config list"
// This is a more general list of values to consider protected. You can not
// This is a more general list of values to consider protected. You cannot
// "npm config get" them, and they will not display during "npm config list"
const protected = [
'auth',
Expand Down Expand Up @@ -176,7 +176,7 @@ class Config extends BaseCommand {
const deprecated = this.npm.config.definitions[baseKey]?.deprecated
if (deprecated) {
throw new Error(
`The \`${baseKey}\` option is deprecated, and can not be set in this way${deprecated}`
`The \`${baseKey}\` option is deprecated, and cannot be set in this way${deprecated}`
)
}

Expand All @@ -203,7 +203,7 @@ class Config extends BaseCommand {
for (const key of keys) {
const val = this.npm.config.get(key)
if (isPrivate(key, val)) {
throw new Error(`The ${key} option is protected, and can not be retrieved in this way`)
throw new Error(`The ${key} option is protected, and cannot be retrieved in this way`)
}

const pref = keys.length > 1 ? `${key}=` : ''
Expand Down
4 changes: 2 additions & 2 deletions lib/commands/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ class Diff extends BaseCommand {

const aSpec = `file:${node.realpath}`

// finds what version of the package to compare against, if a exact
// version or tag was passed than it should use that, otherwise
// finds what version of the package to compare against, if an exact
// version or tag was passed than it should use that; otherwise,
// work from the top of the arborist tree to find the original semver
// range declared in the package that depends on the package.
let bSpec
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/dist-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class DistTag extends BaseCommand {
}

// anything else is just a regular dist-tag command
// so we fallback to the non-workspaces implementation
// so we fall back to the non-workspaces implementation
log.warn('dist-tag', 'Ignoring workspaces for specified package')
return this.exec([cmdName, pkg, tag])
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Exec extends BaseCommand {
// when we try to install a missing package, we won't actually install it
packageLockOnly: false,
// what the user asked to run args[0] is run by default
args: [...args], // copy args so they dont get mutated
args: [...args], // copy args so they don't get mutated
// specify a custom command to be run instead of args[0]
call,
chalk,
Expand Down
8 changes: 4 additions & 4 deletions lib/commands/help-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ class HelpSearch extends BaseCommand {
return
}

const hilitLine = []
const highlightLine = []
for (const arg of args) {
const finder = line.toLowerCase().split(arg.toLowerCase())
let p = 0
for (const f of finder) {
hilitLine.push(line.slice(p, p + f.length))
highlightLine.push(line.slice(p, p + f.length))
const word = line.slice(p + f.length, p + f.length + arg.length)
hilitLine.push(this.npm.chalk.blue(word))
highlightLine.push(this.npm.chalk.blue(word))
p += f.length + arg.length
}
}
out.push(hilitLine.join('') + '\n')
out.push(highlightLine.join('') + '\n')
})

return out.join('')
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const globify = pattern => pattern.split('\\').join('/')
// We don't currently compress our man pages but if we ever did this would
// seamlessly continue supporting it
const manNumberRegex = /\.(\d+)(\.[^/\\]*)?$/
// hardcoded names for mansections
// hardcoded names for man sections
// XXX: these are used in the docs workspace and should be exported
// from npm so section names can changed more easily
const manSectionNames = {
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/outdated.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class Outdated extends ArboristWorkspaceCmd {
dependedByLocation: d.dependedByLocation } : {},
}
acc[d.name] = acc[d.name]
// If this item alread has an outdated dep then we turn it into an array
// If this item already has an outdated dep then we turn it into an array
? (Array.isArray(acc[d.name]) ? acc[d.name] : [acc[d.name]]).concat(dep)
: dep
return acc
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class Publish extends BaseCommand {
await otplease(this.npm, opts, o => libpub(manifest, tarballData, o))
}

// In json mode we dont log until the publish has completed as this will
// In json mode we don't log until the publish has completed as this will
// add it to the output only if completes successfully
if (json) {
logPkg()
Expand Down
2 changes: 1 addition & 1 deletion lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Npm {
process.env.COLOR = this.color ? '1' : '0'

// npm -v
// return from here early so we dont create any caches/logfiles/timers etc
// return from here early so we don't create any caches/logfiles/timers etc
if (this.config.get('version', 'cli')) {
output.standard(this.version)
return { exec: false }
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ class Display {
// Silent mode and some specific commands always hide run script banners
break
} else if (this.#json) {
// In json mode, change output to stderr since we dont want to break json
// In json mode, change output to stderr since we don't want to break json
// parsing on stdout if the user is piping to jq or something.
// XXX: in a future (breaking?) change it might make sense for run-script to
// always output these banners with proc-log.output.error if we think they
Expand Down Expand Up @@ -480,7 +480,7 @@ class Progress {
this.#render()
}

// If we are currenting rendering the spinner we clear it
// If we are currently rendering the spinner we clear it
// before writing our line and then re-render the spinner after.
// If not then all we need to do is write the line
write (write) {
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/log-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class LogFiles {
}

if (this.#isBuffered) {
// Cant do anything but buffer the output if we dont
// Cant do anything but buffer the output if we don't
// have a file stream yet
this.#logStream.push([level, ...args])
return
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/queryable.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const getter = ({ data, key }, { unwrapSingleItemArrays = true } = {}) => {

// extra logic to take into account printing array, along with its
// special syntax in which using a dot-sep property name after an
// arry will expand it's results, e.g:
// array will expand it's results, e.g:
// arr.name -> arr[0].name=value, arr[1].name=value, ...
const maybeIndex = Number(k)
if (Array.isArray(_data) && !Number.isInteger(maybeIndex)) {
Expand Down Expand Up @@ -206,7 +206,7 @@ const setter = ({ data, key, value, force }) => {
}

// sets items from the parsed array of keys as objects, recurses to
// setKeys in case there are still items to be handled, otherwise it
// setKeys in case there are still items to be handled; otherwise, it
// just sets the original value set by the user
if (keys.length) {
_data[_key] = setKeys(next(), keys.shift())
Expand Down Expand Up @@ -270,7 +270,7 @@ class Queryable {
}
}

// return the value for a single query if found, otherwise returns undefined
// return the value for a single query if found; otherwise, returns undefined
get (query) {
const obj = this.query(query)
if (obj) {
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/verify-signatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class VerifySignatures {
}
})

// If keys not found in Sigstore TUF repo, fallback to registry keys API
// If keys not found in Sigstore TUF repo, fall back to registry keys API
if (!keys) {
log.warn(`Fetching verification keys using TUF failed. Fetching directly from ${registry}.`)
keys = await npmFetch.json('/-/npm/v1/keys', {
Expand Down Expand Up @@ -264,7 +264,7 @@ class VerifySignatures {
const { version } = node.package || {}

if (node.isWorkspace || // Skip local workspaces packages
!version || // Skip packages that don't have a installed version, e.g. optonal dependencies
!version || // Skip packages that don't have an installed version, e.g. optional dependencies
!spec.registry) { // Skip if not from registry, e.g. git package
return
}
Expand Down
2 changes: 1 addition & 1 deletion test/lib/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ t.test('npm.load', async t => {
})
await t.rejects(
npm.exec('run', []),
/Can not use --no-workspaces and --workspace at the same time/
/Cannot use --no-workspaces and --workspace at the same time/
)
})

Expand Down
Loading