Skip to content

Commit

Permalink
# linting
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Apr 30, 2024
1 parent d278a20 commit fbdf6be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fs from 'fs'
import YAML from 'yaml'
import _ from 'lodash'

export function resolveRef (ref: string, root: Record<string, any>): Record<string, any> | undefined{
export function resolveRef (ref: string, root: Record<string, any>): Record<string, any> | undefined {
const paths = ref.replace('#/', '').split('/')
for (const p of paths) {
root = root[p]
Expand All @@ -11,13 +11,13 @@ export function resolveRef (ref: string, root: Record<string, any>): Record<stri
return root
}

export function resolveObj(obj: Record<string, any> | undefined, root: Record<string, any>) {
export function resolveObj (obj: Record<string, any> | undefined, root: Record<string, any>) {

Check warning on line 14 in tools/helpers.ts

View workflow job for this annotation

GitHub Actions / tools-tests

Missing return type on function
if (obj === undefined) return undefined
if (obj.$ref) return resolveRef(obj.$ref, root)

Check warning on line 16 in tools/helpers.ts

View workflow job for this annotation

GitHub Actions / tools-tests

Unexpected any value in conditional. An explicit comparison or type cast is required

Check warning on line 16 in tools/helpers.ts

View workflow job for this annotation

GitHub Actions / tools-tests

Unsafe argument of type `any` assigned to a parameter of type `string`
return obj
}

export function dig(obj: Record<string, any>, path: string[], root: Record<string, any>): any {
export function dig (obj: Record<string, any>, path: string[], root: Record<string, any>): any {
let value = obj
for (const p of path) {
value = resolveObj(value, root)?.[p]
Expand Down

0 comments on commit fbdf6be

Please sign in to comment.