fix lint errors
This commit is contained in:
+1
-1
@@ -16,7 +16,7 @@ async function from_file(path: string): Promise<Ok<string>> {
|
||||
log.debug('Read a key from a file')
|
||||
log.trace('Path :', path)
|
||||
|
||||
let content = await get_file_content(path)
|
||||
const content = await get_file_content(path)
|
||||
if (!content.ok) return content
|
||||
|
||||
content.data = content.data.trim()
|
||||
|
||||
+4
-4
@@ -19,12 +19,12 @@ export async function object<S extends yup.Maybe<yup.AnyObject>>(
|
||||
for (const key in schema.fields) {
|
||||
const sub_key = base_name + key.toUpperCase()
|
||||
|
||||
const sub_scheme = schema.fields[key]
|
||||
const sub_scheme = schema.fields[key] as yup.AnySchema
|
||||
let value: Ok<unknown>
|
||||
|
||||
// TODO : If array, add a transform
|
||||
if (sub_scheme.describe().type === 'object') {
|
||||
value = await object(sub_scheme, sub_key)
|
||||
const type = sub_scheme.describe().type
|
||||
if (type === 'object') {
|
||||
value = await object(sub_scheme as yup.ObjectSchema<yup.Maybe<yup.AnyObject>>, sub_key)
|
||||
} else {
|
||||
value = await generic(sub_scheme, sub_key)
|
||||
}
|
||||
|
||||
+3
-3
@@ -8,7 +8,7 @@ import {parse} from '../src'
|
||||
|
||||
beforeEach(() => process.env = {})
|
||||
|
||||
async function testing(value: string | undefined, scheme: yup.AnySchema, should_be_successful: boolean, data?: any) {
|
||||
async function testing(value: string | undefined, scheme: yup.AnySchema, should_be_successful: boolean, data?: unknown) {
|
||||
const key = 'DB_PORT'
|
||||
if (value !== undefined) process.env[key] = value
|
||||
|
||||
@@ -126,7 +126,7 @@ describe('from_file', () => {
|
||||
file = undefined
|
||||
})
|
||||
|
||||
async function testing(value: string | undefined, scheme: yup.AnySchema, should_be_successful: boolean, data?: any) {
|
||||
async function testing(value: string | undefined, scheme: yup.AnySchema, should_be_successful: boolean, data?: unknown) {
|
||||
file = fileSync()
|
||||
|
||||
const name = file.name
|
||||
@@ -182,7 +182,7 @@ describe('boolean', () => {
|
||||
|
||||
// Read specific types
|
||||
describe('Date', () => {
|
||||
async function testing(value: string | undefined, scheme: yup.DateSchema, should_be_successful: boolean, data?: any) {
|
||||
async function testing(value: string | undefined, scheme: yup.DateSchema, should_be_successful: boolean, data?: unknown) {
|
||||
const key = 'DB_PORT'
|
||||
if (value !== undefined) process.env[key] = value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user