diff options
author | Gar <gar+gh@danger.computer> | 2021-11-04 20:21:00 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-11-05 00:45:18 +0300 |
commit | 225645420cf3d13bc0b0d591f7f7bf21a9c24e47 (patch) | |
tree | 107797bef3206793cda93d7dad97f3ab54ef3cd8 /lib/cli.js | |
parent | de45f90eebbf51205748ed3f09fbeab6cc000b3e (diff) |
chore: update to latest eslint and linting rules
This brings us in line with the rest of the linting rules we are wanting
to use on the npm cli repos.
There were several hundred over-length lines and instead of editing them
all by hand I piped the failing file through `prettier` and back through
`eslint` just to save some time and energy. This means there may be
some quirks in the linting those files have, but we can fix those if we
see them and they bother us.
Other than that there were about 50 lines that are legitimately
over-length, all are now explicitly overridden. Many are tests that
could be snapshots.
PR-URL: https://github.com/npm/cli/pull/3995
Credit: @wraithgar
Close: #3995
Reviewed-by: @lukekarrys
Diffstat (limited to 'lib/cli.js')
-rw-r--r-- | lib/cli.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/cli.js b/lib/cli.js index 0e6301517..9dcd9d04d 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -1,13 +1,10 @@ // Separated out for easier unit testing -module.exports = async (process) => { +module.exports = async process => { // set it here so that regardless of what happens later, we don't // leak any private CLI configs to other programs process.title = 'npm' - const { - checkForBrokenNode, - checkForUnsupportedNode, - } = require('../lib/utils/unsupported.js') + const { checkForBrokenNode, checkForUnsupportedNode } = require('../lib/utils/unsupported.js') checkForBrokenNode() @@ -25,8 +22,9 @@ module.exports = async (process) => { // if npm is called as "npmg" or "npm_g", then // run in global mode. - if (process.argv[1][process.argv[1].length - 1] === 'g') + if (process.argv[1][process.argv[1].length - 1] === 'g') { process.argv.splice(1, 1, 'npm', '-g') + } const replaceInfo = require('../lib/utils/replace-info.js') log.verbose('cli', replaceInfo(process.argv)) @@ -70,7 +68,8 @@ module.exports = async (process) => { if (err.code === 'EUNKNOWNCOMMAND') { const didYouMean = require('./utils/did-you-mean.js') const suggestions = await didYouMean(npm, npm.localPrefix, cmd) - npm.output(`Unknown command: "${cmd}"${suggestions}\n\nTo see a list of supported npm commands, run:\n npm help`) + npm.output(`Unknown command: "${cmd}"${suggestions}\n`) + npm.output('To see a list of supported npm commands, run:\n npm help') process.exitCode = 1 return exitHandler() } |