Skip to content

Commit dce7c8f

Browse files
committed
fix: lint issues
1 parent 7e22666 commit dce7c8f

File tree

14 files changed

+413
-455
lines changed

14 files changed

+413
-455
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/lib

.eslintrc

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1-
{
2-
"extends": [
1+
{
2+
"extends": [
33
"oclif",
44
"oclif-typescript"
55
],
66
"rules": {
77
"unicorn/no-abusive-eslint-disable": "off",
88
"@typescript-eslint/no-use-before-define": "off",
9-
"@typescript-eslint/ban-ts-ignore": "off"
9+
"@typescript-eslint/ban-ts-ignore": "off",
10+
"object-curly-spacing": "off",
11+
"no-useless-constructor": "off",
12+
"@typescript-eslint/no-unused-vars": [
13+
"error",
14+
{
15+
"args": "none"
16+
}
17+
],
18+
"@typescript-eslint/prefer-namespace-keyword": "error",
19+
"@typescript-eslint/quotes": [
20+
"error",
21+
"single",
22+
{
23+
"avoidEscape": true,
24+
"allowTemplateLiterals": true
25+
}
26+
],
27+
"semi": "off",
28+
"indent": "off",
29+
"comma-dangle": "off",
30+
"unicorn/consistent-function-scoping": "off",
31+
"max-params": "off",
32+
"no-return-await":"off",
33+
"no-process-exit":"off",
34+
"no-trailing-spaces":"off",
35+
"unicorn/no-process-exit":"off"
1036
}
1137
}

README.md

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ Display recent changes to a Content Type
6868

6969
```
7070
USAGE
71-
$ csdx content-type:audit -c <value> [-k <value> | -a <value>]
71+
$ csdx content-type:audit -c <value> [-s <value> | -a <value> | -a <value>] [-k <value> | | ]
7272
7373
FLAGS
74-
-a, --token-alias=<value> Management token alias
75-
-c, --content-type=<value> (required) Content Type UID
76-
-k, --stack=<value> Stack API Key
74+
-a, --alias=<value> Alias of the management token
75+
-a, --token-alias=<value> Management token alias
76+
-c, --content-type=<value> (required) Content Type UID
77+
-k, --stack-api-key=<value> Stack API Key
78+
-s, --stack=<value> Stack UID
7779
7880
DESCRIPTION
7981
Display recent changes to a Content Type
@@ -92,14 +94,16 @@ Compare two Content Type versions
9294

9395
```
9496
USAGE
95-
$ csdx content-type:compare -c <value> [-k <value> | -a <value>] [-l <value> -r <value>]
97+
$ csdx content-type:compare -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-l <value> -r <value>]
9698
9799
FLAGS
98-
-a, --token-alias=<value> Management token alias
99-
-c, --content-type=<value> (required) Content Type UID
100-
-k, --stack=<value> Stack API Key
101-
-l, --left=<value> Content Type version, i.e. prev version
102-
-r, --right=<value> Content Type version, i.e. later version
100+
-a, --alias=<value> Alias of the management token
101+
-a, --token-alias=<value> Management token alias
102+
-c, --content-type=<value> (required) Content Type UID
103+
-k, --stack-api-key=<value> Stack API Key
104+
-l, --left=<value> Content Type version, i.e. prev version
105+
-r, --right=<value> Content Type version, i.e. later version
106+
-s, --stack=<value> Stack UID
103107
104108
DESCRIPTION
105109
Compare two Content Type versions
@@ -142,13 +146,15 @@ Display Content Type details
142146

143147
```
144148
USAGE
145-
$ csdx content-type:details -c <value> [-k <value> | -a <value>] [-p]
149+
$ csdx content-type:details -c <value> [-s <value> | -a <value>] [-k <value> | ] [-a <value>] [-p]
146150
147151
FLAGS
148-
-a, --token-alias=<value> Management token alias
149-
-c, --content-type=<value> (required) Content Type UID
150-
-k, --stack=<value> Stack API Key
151-
-p, --[no-]path show path column
152+
-a, --alias=<value> Alias of the management token
153+
-a, --token-alias=<value> Management token alias
154+
-c, --content-type=<value> (required) Content Type UID
155+
-k, --stack-api-key=<value> Stack API Key
156+
-p, --[no-]path show path column
157+
-s, --stack=<value> Stack UID
152158
153159
DESCRIPTION
154160
Display Content Type details
@@ -169,16 +175,19 @@ Create a visual diagram of a Stack's Content Types
169175

170176
```
171177
USAGE
172-
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-k <value> | -a <value>]
178+
$ csdx content-type:diagram -o <value> -d portrait|landscape -t svg|dot [-s <value> | -a <value> | -a <value>] [-k
179+
<value> | | ]
173180
174181
FLAGS
175-
-a, --token-alias=<value> Management token alias
176-
-d, --direction=<option> (required) [default: portrait] graph orientation
177-
<options: portrait|landscape>
178-
-k, --stack=<value> Stack API Key
179-
-o, --output=<value> (required) full path to output
180-
-t, --type=<option> (required) [default: svg] graph output file type
181-
<options: svg|dot>
182+
-a, --alias=<value> Alias of the management token
183+
-a, --token-alias=<value> Management token alias
184+
-d, --direction=<option> (required) [default: portrait] graph orientation
185+
<options: portrait|landscape>
186+
-k, --stack-api-key=<value> Stack API Key
187+
-o, --output=<value> (required) full path to output
188+
-s, --stack=<value> Stack UID
189+
-t, --type=<option> (required) [default: svg] graph output file type
190+
<options: svg|dot>
182191
183192
DESCRIPTION
184193
Create a visual diagram of a Stack's Content Types
@@ -201,13 +210,15 @@ List all Content Types in a Stack
201210

202211
```
203212
USAGE
204-
$ csdx content-type:list [-k <value> | -a <value>] [-o title|modified]
213+
$ csdx content-type:list [-s <value> | -a <value> | -a <value>] [-k <value> | | ] [-o title|modified]
205214
206215
FLAGS
207-
-a, --token-alias=<value> Management token alias
208-
-k, --stack=<value> Stack API Key
209-
-o, --order=<option> [default: title] order by column
210-
<options: title|modified>
216+
-a, --alias=<value> Alias of the management token
217+
-a, --token-alias=<value> Management token alias
218+
-k, --stack-api-key=<value> Stack API Key
219+
-o, --order=<option> [default: title] order by column
220+
<options: title|modified>
221+
-s, --stack=<value> Stack UID
211222
212223
DESCRIPTION
213224
List all Content Types in a Stack

src/commands/content-type/audit.ts

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,70 @@
1-
import Command from "../../core/command";
2-
import {
3-
flags,
4-
FlagInput,
5-
managementSDKClient,
6-
cliux,
7-
printFlagDeprecation
8-
} from "@contentstack/cli-utilities";
9-
import buildOutput from "../../core/content-type/audit";
10-
import { getStack, getUsers } from "../../utils/index";
1+
import Command from '../../core/command'
2+
import { flags, FlagInput, managementSDKClient, cliux, printFlagDeprecation } from '@contentstack/cli-utilities'
3+
import buildOutput from '../../core/content-type/audit'
4+
import { getStack, getUsers } from '../../utils'
115

126
export default class AuditCommand extends Command {
13-
static description = "Display recent changes to a Content Type";
7+
static description = 'Display recent changes to a Content Type'
148

159
static examples = [
1610
'$ csdx content-type:audit -k "xxxxxxxxxxxxxxxxxxx" -c "home_page"',
17-
'$ csdx content-type:audit -a "management token" -c "home_page"',
18-
];
11+
'$ csdx content-type:audit -a "management token" -c "home_page"'
12+
]
1913

2014
static flags: FlagInput = {
2115
stack: flags.string({
22-
char: "s",
23-
description: "Stack UID",
24-
exclusive: ["token-alias", "alias"],
25-
parse: printFlagDeprecation(['-s', '--stack'], ['-k', '--stack-api-key']),
16+
char: 's',
17+
description: 'Stack UID',
18+
exclusive: ['token-alias', 'alias'],
19+
parse: printFlagDeprecation(['-s', '--stack'], ['-k', '--stack-api-key'])
2620
}),
2721

28-
"stack-api-key": flags.string({
29-
char: "k",
30-
description: "Stack API Key",
31-
exclusive: ["token-alias", "alias"]
22+
'stack-api-key': flags.string({
23+
char: 'k',
24+
description: 'Stack API Key',
25+
exclusive: ['token-alias', 'alias']
3226
}),
3327

34-
"token-alias": flags.string({
35-
char: "a",
36-
description: "Management token alias",
37-
parse: printFlagDeprecation(['--token-alias'], ['-a', '--alias']),
28+
'token-alias': flags.string({
29+
char: 'a',
30+
description: 'Management token alias',
31+
parse: printFlagDeprecation(['--token-alias'], ['-a', '--alias'])
3832
}),
3933

4034
alias: flags.string({
4135
char: 'a',
42-
description: 'Alias of the management token',
36+
description: 'Alias of the management token'
4337
}),
4438

45-
"content-type": flags.string({
46-
char: "c",
47-
description: "Content Type UID",
48-
required: true,
49-
}),
50-
};
39+
'content-type': flags.string({
40+
char: 'c',
41+
description: 'Content Type UID',
42+
required: true
43+
})
44+
}
5145

5246
async run() {
5347
try {
54-
const { flags } = await this.parse(AuditCommand);
55-
this.setup(flags);
48+
const { flags } = await this.parse(AuditCommand)
49+
this.setup(flags)
5650
this.contentTypeManagementClient = await managementSDKClient({
57-
host: this.cmaHost,
58-
});
51+
host: this.cmaHost
52+
})
5953

60-
const spinner = cliux.loaderV2(Command.RequestDataMessage);
54+
const spinner = cliux.loaderV2(Command.RequestDataMessage)
6155

6256
const [stack, audit, users] = await Promise.all([
6357
getStack(this.contentTypeManagementClient, this.apiKey, spinner),
64-
this.client.getContentTypeAuditLogs(this.apiKey, flags["content-type"], spinner),
65-
getUsers(this.contentTypeManagementClient, this.apiKey, spinner),
66-
]);
58+
this.client.getContentTypeAuditLogs(this.apiKey, flags['content-type'], spinner),
59+
getUsers(this.contentTypeManagementClient, this.apiKey, spinner)
60+
])
6761

68-
cliux.loaderV2("", spinner);
62+
cliux.loaderV2('', spinner)
6963

70-
const output = buildOutput(audit.logs, users);
71-
this.printOutput(output, "Audit Logs", flags["content-type"], stack.name);
64+
const output = buildOutput(audit.logs, users)
65+
this.printOutput(output, 'Audit Logs', flags['content-type'], stack.name)
7266
} catch (error: any) {
73-
this.error(error, { exit: 1, suggestions: error.suggestions });
67+
this.error(error, { exit: 1, suggestions: error.suggestions })
7468
}
7569
}
7670
}

0 commit comments

Comments
 (0)