@@ -49,12 +49,8 @@ class Diff extends BaseCommand {
4949
5050 async exec ( args ) {
5151 const specs = this . npm . config . get ( 'diff' ) . filter ( d => d )
52- if ( specs . length > 2 ) {
53- throw new TypeError (
54- 'Can\'t use more than two --diff arguments.\n\n' +
55- `Usage:\n${ this . usage } `
56- )
57- }
52+ if ( specs . length > 2 )
53+ throw this . usageError ( `Can't use more than two --diff arguments.` )
5854
5955 // execWorkspaces may have set this already
6056 if ( ! this . prefix )
@@ -101,7 +97,7 @@ class Diff extends BaseCommand {
10197 }
10298
10399 if ( ! name )
104- throw this . usageError ( 'Needs multiple arguments to compare or run from a project dir.\n ' )
100+ throw this . usageError ( 'Needs multiple arguments to compare or run from a project dir.' )
105101
106102 return name
107103 }
@@ -133,7 +129,7 @@ class Diff extends BaseCommand {
133129 noPackageJson = true
134130 }
135131
136- const missingPackageJson = this . usageError ( 'Needs multiple arguments to compare or run from a project dir.\n ' )
132+ const missingPackageJson = this . usageError ( 'Needs multiple arguments to compare or run from a project dir.' )
137133
138134 // using a valid semver range, that means it should just diff
139135 // the cwd against a published version to the registry using the
@@ -222,7 +218,7 @@ class Diff extends BaseCommand {
222218 `file:${ this . prefix } ` ,
223219 ]
224220 } else
225- throw this . usageError ( `Spec type ${ spec . type } not supported.\n ` )
221+ throw this . usageError ( `Spec type ${ spec . type } not supported.` )
226222 }
227223
228224 async convertVersionsToSpecs ( [ a , b ] ) {
@@ -239,7 +235,7 @@ class Diff extends BaseCommand {
239235 }
240236
241237 if ( ! pkgName )
242- throw this . usageError ( 'Needs to be run from a project dir in order to diff two versions.\n ' )
238+ throw this . usageError ( 'Needs to be run from a project dir in order to diff two versions.' )
243239
244240 return [ `${ pkgName } @${ a } ` , `${ pkgName } @${ b } ` ]
245241 }
0 commit comments