Skip to content

Commit 6bdd183

Browse files
committed
chore: switch to true static attributes
now that we're off of node10 we can clean this up
1 parent 203fedf commit 6bdd183

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+607
-1429
lines changed

lib/arborist-cmd.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ class ArboristCmd extends BaseCommand {
88
return true
99
}
1010

11-
/* istanbul ignore next - see test/lib/load-all-commands.js */
12-
static get params () {
13-
return [
14-
'workspace',
15-
'workspaces',
16-
'include-workspace-root',
17-
]
18-
}
11+
static params = [
12+
'workspace',
13+
'workspaces',
14+
'include-workspace-root',
15+
]
1916

2017
async execWorkspaces (args, filters) {
2118
await this.setWorkspaces(filters)

lib/commands/access.js

+18-29
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,24 @@ const subcommands = [
2020
]
2121

2222
class Access extends BaseCommand {
23-
static get description () {
24-
return 'Set access level on published packages'
25-
}
26-
27-
static get name () {
28-
return 'access'
29-
}
30-
31-
/* istanbul ignore next - see test/lib/load-all-commands.js */
32-
static get params () {
33-
return [
34-
'registry',
35-
'otp',
36-
]
37-
}
38-
39-
static get usage () {
40-
return [
41-
'public [<package>]',
42-
'restricted [<package>]',
43-
'grant <read-only|read-write> <scope:team> [<package>]',
44-
'revoke <scope:team> [<package>]',
45-
'2fa-required [<package>]',
46-
'2fa-not-required [<package>]',
47-
'ls-packages [<user>|<scope>|<scope:team>]',
48-
'ls-collaborators [<package> [<user>]]',
49-
'edit [<package>]',
50-
]
51-
}
23+
static description = 'Set access level on published packages'
24+
static name = 'access'
25+
static params = [
26+
'registry',
27+
'otp',
28+
]
29+
30+
static usage = [
31+
'public [<package>]',
32+
'restricted [<package>]',
33+
'grant <read-only|read-write> <scope:team> [<package>]',
34+
'revoke <scope:team> [<package>]',
35+
'2fa-required [<package>]',
36+
'2fa-not-required [<package>]',
37+
'ls-packages [<user>|<scope>|<scope:team>]',
38+
'ls-collaborators [<package> [<user>]]',
39+
'edit [<package>]',
40+
]
5241

5342
async completion (opts) {
5443
const argv = opts.conf.argv.remain

lib/commands/adduser.js

+6-14
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,12 @@ const authTypes = {
99
}
1010

1111
class AddUser extends BaseCommand {
12-
static get description () {
13-
return 'Add a registry user account'
14-
}
15-
16-
static get name () {
17-
return 'adduser'
18-
}
19-
20-
static get params () {
21-
return [
22-
'registry',
23-
'scope',
24-
]
25-
}
12+
static description = 'Add a registry user account'
13+
static name = 'adduser'
14+
static params = [
15+
'registry',
16+
'scope',
17+
]
2618

2719
async exec (args) {
2820
const { scope } = this.npm.flatOptions

lib/commands/audit.js

+13-27
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,19 @@ const auditError = require('../utils/audit-error.js')
55
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
66

77
class Audit extends ArboristWorkspaceCmd {
8-
/* istanbul ignore next - see test/lib/load-all-commands.js */
9-
static get description () {
10-
return 'Run a security audit'
11-
}
12-
13-
/* istanbul ignore next - see test/lib/load-all-commands.js */
14-
static get name () {
15-
return 'audit'
16-
}
17-
18-
/* istanbul ignore next - see test/lib/load-all-commands.js */
19-
static get params () {
20-
return [
21-
'audit-level',
22-
'dry-run',
23-
'force',
24-
'json',
25-
'package-lock-only',
26-
'omit',
27-
...super.params,
28-
]
29-
}
30-
31-
/* istanbul ignore next - see test/lib/load-all-commands.js */
32-
static get usage () {
33-
return ['[fix]']
34-
}
8+
static description = 'Run a security audit'
9+
static name = 'audit'
10+
static params = [
11+
'audit-level',
12+
'dry-run',
13+
'force',
14+
'json',
15+
'package-lock-only',
16+
'omit',
17+
...super.params,
18+
]
19+
20+
static usage = ['[fix]']
3521

3622
async completion (opts) {
3723
const argv = opts.conf.argv.remain

lib/commands/bin.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@ const envPath = require('../utils/path.js')
22
const BaseCommand = require('../base-command.js')
33

44
class Bin extends BaseCommand {
5-
static get description () {
6-
return 'Display npm bin folder'
7-
}
8-
9-
static get name () {
10-
return 'bin'
11-
}
12-
13-
static get params () {
14-
return ['global']
15-
}
5+
static description = 'Display npm bin folder'
6+
static name = 'bin'
7+
static params = ['global']
168

179
async exec (args) {
1810
const b = this.npm.bin

lib/commands/birthday.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const BaseCommand = require('../base-command.js')
22

33
class Birthday extends BaseCommand {
4+
static name = 'birthday'
45
async exec () {
56
this.npm.config.set('package', ['@npmcli/npm-birthday'])
67
this.npm.config.set('yes', true)

lib/commands/bugs.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,10 @@ const hostedFromMani = require('../utils/hosted-git-info-from-manifest.js')
55
const BaseCommand = require('../base-command.js')
66

77
class Bugs extends BaseCommand {
8-
static get description () {
9-
return 'Report bugs for a package in a web browser'
10-
}
11-
12-
static get name () {
13-
return 'bugs'
14-
}
15-
16-
static get usage () {
17-
return ['[<pkgname>]']
18-
}
19-
20-
/* istanbul ignore next - see test/lib/load-all-commands.js */
21-
static get params () {
22-
return ['browser', 'registry']
23-
}
8+
static description = 'Report bugs for a package in a web browser'
9+
static name = 'bugs'
10+
static usage = ['[<pkgname>]']
11+
static params = ['browser', 'registry']
2412

2513
async exec (args) {
2614
if (!args || !args.length) {

lib/commands/cache.js

+13-27
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,19 @@ const searchCachePackage = async (path, spec, cacheKeys) => {
6767
}
6868

6969
class Cache extends BaseCommand {
70-
static get description () {
71-
return 'Manipulates packages cache'
72-
}
73-
74-
/* istanbul ignore next - see test/lib/load-all-commands.js */
75-
static get name () {
76-
return 'cache'
77-
}
78-
79-
/* istanbul ignore next - see test/lib/load-all-commands.js */
80-
static get params () {
81-
return ['cache']
82-
}
83-
84-
/* istanbul ignore next - see test/lib/load-all-commands.js */
85-
static get usage () {
86-
return [
87-
'add <tarball file>',
88-
'add <folder>',
89-
'add <tarball url>',
90-
'add <git url>',
91-
'add <name>@<version>',
92-
'clean [<key>]',
93-
'ls [<name>@<version>]',
94-
'verify',
95-
]
96-
}
70+
static description = 'Manipulates packages cache'
71+
static name = 'cache'
72+
static params = ['cache']
73+
static usage = [
74+
'add <tarball file>',
75+
'add <folder>',
76+
'add <tarball url>',
77+
'add <git url>',
78+
'add <name>@<version>',
79+
'clean [<key>]',
80+
'ls [<name>@<version>]',
81+
'verify',
82+
]
9783

9884
async completion (opts) {
9985
const argv = opts.conf.argv.remain

lib/commands/ci.js

+7-18
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,13 @@ const removeNodeModules = async where => {
2020
const ArboristWorkspaceCmd = require('../arborist-cmd.js')
2121

2222
class CI extends ArboristWorkspaceCmd {
23-
/* istanbul ignore next - see test/lib/load-all-commands.js */
24-
static get description () {
25-
return 'Install a project with a clean slate'
26-
}
27-
28-
/* istanbul ignore next - see test/lib/load-all-commands.js */
29-
static get name () {
30-
return 'ci'
31-
}
32-
33-
/* istanbul ignore next - see test/lib/load-all-commands.js */
34-
static get params () {
35-
return [
36-
'audit',
37-
'ignore-scripts',
38-
'script-shell',
39-
]
40-
}
23+
static description = 'Install a project with a clean slate'
24+
static name = 'ci'
25+
static params = [
26+
'audit',
27+
'ignore-scripts',
28+
'script-shell',
29+
]
4130

4231
async exec () {
4332
if (this.npm.config.get('global')) {

lib/commands/completion.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,8 @@ const { promisify } = require('util')
4545
const BaseCommand = require('../base-command.js')
4646

4747
class Completion extends BaseCommand {
48-
/* istanbul ignore next - see test/lib/load-all-commands.js */
49-
static get description () {
50-
return 'Tab Completion for npm'
51-
}
52-
53-
/* istanbul ignore next - see test/lib/load-all-commands.js */
54-
static get name () {
55-
return 'completion'
56-
}
48+
static description = 'Tab Completion for npm'
49+
static name = 'completion'
5750

5851
// completion for the completion command
5952
async completion (opts) {

lib/commands/config.js

+17-30
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,23 @@ const publicVar = k => !/^(\/\/[^:]+:)?_/.test(k)
3131

3232
const BaseCommand = require('../base-command.js')
3333
class Config extends BaseCommand {
34-
static get description () {
35-
return 'Manage the npm configuration files'
36-
}
37-
38-
/* istanbul ignore next - see test/lib/load-all-commands.js */
39-
static get name () {
40-
return 'config'
41-
}
42-
43-
/* istanbul ignore next - see test/lib/load-all-commands.js */
44-
static get usage () {
45-
return [
46-
'set <key>=<value> [<key>=<value> ...]',
47-
'get [<key> [<key> ...]]',
48-
'delete <key> [<key> ...]',
49-
'list [--json]',
50-
'edit',
51-
]
52-
}
53-
54-
/* istanbul ignore next - see test/lib/load-all-commands.js */
55-
static get params () {
56-
return [
57-
'json',
58-
'global',
59-
'editor',
60-
'location',
61-
'long',
62-
]
63-
}
34+
static description = 'Manage the npm configuration files'
35+
static name = 'config'
36+
static usage = [
37+
'set <key>=<value> [<key>=<value> ...]',
38+
'get [<key> [<key> ...]]',
39+
'delete <key> [<key> ...]',
40+
'list [--json]',
41+
'edit',
42+
]
43+
44+
static params = [
45+
'json',
46+
'global',
47+
'editor',
48+
'location',
49+
'long',
50+
]
6451

6552
async completion (opts) {
6653
const argv = opts.conf.argv.remain

0 commit comments

Comments
 (0)