Skip to content

Commit af817b6

Browse files
committed
fix: review comments
1 parent 1f46577 commit af817b6

File tree

5 files changed

+55
-43
lines changed

5 files changed

+55
-43
lines changed

.eslintrc

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,51 @@
1-
{
1+
{
22
"extends": [
3-
"oclif",
4-
"oclif-typescript"
5-
],
6-
"rules": {
3+
// "oclif",
4+
"oclif-typescript",
5+
"plugin:@typescript-eslint/recommended"
6+
],
7+
"rules": {
8+
"@typescript-eslint/no-unused-vars": [
9+
"error",
10+
{
11+
"args": "none"
12+
}
13+
],
14+
"@typescript-eslint/prefer-namespace-keyword": "error",
15+
"@typescript-eslint/quotes": [
16+
"error",
17+
"single",
18+
{
19+
"avoidEscape": true,
20+
"allowTemplateLiterals": true
21+
}
22+
],
23+
"semi": "off",
24+
"@typescript-eslint/type-annotation-spacing": "error",
25+
"@typescript-eslint/no-redeclare": "off",
26+
"eqeqeq": [
27+
"error",
28+
"smart"
29+
],
30+
"id-match": "error",
31+
"no-eval": "error",
32+
"no-var": "error",
33+
"quotes": "off",
34+
"indent": "off",
35+
"camelcase": "off",
36+
"comma-dangle": "off",
37+
"arrow-parens": "off",
38+
"operator-linebreak": "off",
39+
"object-curly-spacing": "off",
40+
"node/no-missing-import": "off",
41+
"padding-line-between-statements": "off",
42+
"@typescript-eslint/ban-ts-ignore": "off",
743
"unicorn/no-abusive-eslint-disable": "off",
44+
"unicorn/consistent-function-scoping": "off",
845
"@typescript-eslint/no-use-before-define": "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"
36-
}
37-
}
46+
"@typescript-eslint/camelcase": "off",
47+
"no-process-exit":"off",
48+
"unicorn/no-process-exit": "off",
49+
"@typescript-eslint/no-var-requires": "off"
50+
}
51+
}

package-lock.json

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
"dependencies": {
88
"@contentstack/cli-command": "^1.2.8",
99
"@contentstack/cli-utilities": "^1.4.4",
10-
"@oclif/command": "^1.8.0",
11-
"@oclif/config": "^1.17.0",
1210
"@types/diff2html": "^3.0.0",
1311
"@types/git-diff": "^2.0.2",
1412
"@types/hogan.js": "^3.0.0",

src/core/content-type/compare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as Diff2html from 'diff2html'
55
import gitDiff from 'git-diff'
66
import {BuildOutput} from '../../types'
77

8-
export default async function buildOutput(contentTypeName: string, previous: any, current: any): Promise<BuildOutput> {
8+
export default async function buildOutput(contentTypeName: string, previous: any, current: any): Promise<BuildOutput> {
99
const diffString = buildDiffString(previous, current)
1010
const diffTree = Diff2html.parse(diffString)
1111
const diffHtml = Diff2html.html(diffTree, {

src/utils/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ export async function getStack(managementSdk: any, apiKey: string, spinner: any)
2020
}
2121

2222
export async function getUsers(managementSdk: any, apiKey: string, spinner: any) {
23-
return await managementSdk
23+
const users = await managementSdk
2424
.stack({ api_key: apiKey })
2525
.users()
2626
.then((data: any) => data)
2727
.catch((error: any) => {
2828
handleErrorMsg(error, spinner)
2929
})
30+
return users
3031
}
3132

3233
export async function getContentTypes(
@@ -49,7 +50,7 @@ export async function getContentTypes(
4950
if (ct?.items?.length > 0) {
5051
contentTypes = [...contentTypes, ...ct.items]
5152
skip += config.limit
52-
if (skip < ct.count) return await getContentTypes(managementSdk, apiKey, spinner, skip, contentTypes)
53+
if (skip < ct.count) return getContentTypes(managementSdk, apiKey, spinner, skip, contentTypes)
5354
}
5455
return contentTypes
5556
}
@@ -74,7 +75,7 @@ export async function getGlobalFields(
7475
if (gf?.items?.length > 0) {
7576
globalFields = [...globalFields, ...gf.items]
7677
skip += config.limit
77-
if (skip < gf.count) return await getGlobalFields(managementSdk, apiKey, spinner, skip, globalFields)
78+
if (skip < gf.count) return getGlobalFields(managementSdk, apiKey, spinner, skip, globalFields)
7879
}
7980
return globalFields
8081
}
@@ -88,14 +89,15 @@ export async function getContentType(params: {
8889
}) {
8990
const { managementSdk, apiKey, ctVersion, spinner, uid } = params
9091
const param = ctVersion ? { version: ctVersion } : {}
91-
return await managementSdk
92+
const ct = await managementSdk
9293
.stack({ api_key: apiKey })
9394
.contentType(uid)
9495
.fetch(param)
9596
.then((data: any) => data)
9697
.catch((error: any) => {
9798
handleErrorMsg(error, spinner)
9899
})
100+
return ct
99101
}
100102

101103
function handleErrorMsg(err: any, spinner: any) {

0 commit comments

Comments
 (0)