Skip to content

Commit

Permalink
fix: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aman19K committed Jun 19, 2023
1 parent 1f46577 commit af817b6
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 43 deletions.
82 changes: 48 additions & 34 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
{
{
"extends": [
"oclif",
"oclif-typescript"
],
"rules": {
// "oclif",
"oclif-typescript",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": "off",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/no-redeclare": "off",
"eqeqeq": [
"error",
"smart"
],
"id-match": "error",
"no-eval": "error",
"no-var": "error",
"quotes": "off",
"indent": "off",
"camelcase": "off",
"comma-dangle": "off",
"arrow-parens": "off",
"operator-linebreak": "off",
"object-curly-spacing": "off",
"node/no-missing-import": "off",
"padding-line-between-statements": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"unicorn/no-abusive-eslint-disable": "off",
"unicorn/consistent-function-scoping": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"object-curly-spacing": "off",
"no-useless-constructor": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "none"
}
],
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": "off",
"indent": "off",
"comma-dangle": "off",
"unicorn/consistent-function-scoping": "off",
"max-params": "off",
"no-return-await":"off",
"no-process-exit":"off",
"no-trailing-spaces":"off",
"unicorn/no-process-exit":"off"
}
}
"@typescript-eslint/camelcase": "off",
"no-process-exit":"off",
"unicorn/no-process-exit": "off",
"@typescript-eslint/no-var-requires": "off"
}
}
2 changes: 0 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"dependencies": {
"@contentstack/cli-command": "^1.2.8",
"@contentstack/cli-utilities": "^1.4.4",
"@oclif/command": "^1.8.0",
"@oclif/config": "^1.17.0",
"@types/diff2html": "^3.0.0",
"@types/git-diff": "^2.0.2",
"@types/hogan.js": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/core/content-type/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as Diff2html from 'diff2html'
import gitDiff from 'git-diff'
import {BuildOutput} from '../../types'

export default async function buildOutput(contentTypeName: string, previous: any, current: any): Promise<BuildOutput> {
export default async function buildOutput(contentTypeName: string, previous: any, current: any): Promise<BuildOutput> {
const diffString = buildDiffString(previous, current)
const diffTree = Diff2html.parse(diffString)
const diffHtml = Diff2html.html(diffTree, {
Expand Down
10 changes: 6 additions & 4 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ export async function getStack(managementSdk: any, apiKey: string, spinner: any)
}

export async function getUsers(managementSdk: any, apiKey: string, spinner: any) {
return await managementSdk
const users = await managementSdk
.stack({ api_key: apiKey })
.users()
.then((data: any) => data)
.catch((error: any) => {
handleErrorMsg(error, spinner)
})
return users
}

export async function getContentTypes(
Expand All @@ -49,7 +50,7 @@ export async function getContentTypes(
if (ct?.items?.length > 0) {
contentTypes = [...contentTypes, ...ct.items]
skip += config.limit
if (skip < ct.count) return await getContentTypes(managementSdk, apiKey, spinner, skip, contentTypes)
if (skip < ct.count) return getContentTypes(managementSdk, apiKey, spinner, skip, contentTypes)
}
return contentTypes
}
Expand All @@ -74,7 +75,7 @@ export async function getGlobalFields(
if (gf?.items?.length > 0) {
globalFields = [...globalFields, ...gf.items]
skip += config.limit
if (skip < gf.count) return await getGlobalFields(managementSdk, apiKey, spinner, skip, globalFields)
if (skip < gf.count) return getGlobalFields(managementSdk, apiKey, spinner, skip, globalFields)
}
return globalFields
}
Expand All @@ -88,14 +89,15 @@ export async function getContentType(params: {
}) {
const { managementSdk, apiKey, ctVersion, spinner, uid } = params
const param = ctVersion ? { version: ctVersion } : {}
return await managementSdk
const ct = await managementSdk
.stack({ api_key: apiKey })
.contentType(uid)
.fetch(param)
.then((data: any) => data)
.catch((error: any) => {
handleErrorMsg(error, spinner)
})
return ct
}

function handleErrorMsg(err: any, spinner: any) {
Expand Down

0 comments on commit af817b6

Please sign in to comment.