From 95218d3327d2eb12a4dc5d0c8c74e840b1be7015 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Fri, 23 Feb 2024 16:28:48 +0000 Subject: [PATCH] fix: minor linting issues (#2383) --- lib/compile/resolve.ts | 8 ++++---- lib/runtime/parseJson.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/compile/resolve.ts b/lib/compile/resolve.ts index 4360eab06..be283866c 100644 --- a/lib/compile/resolve.ts +++ b/lib/compile/resolve.ts @@ -102,16 +102,16 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { if (parentJsonPtr === undefined) return const fullPath = pathPrefix + jsonPtr - let baseId = baseIds[parentJsonPtr] - if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId]) + let innerBaseId = baseIds[parentJsonPtr] + if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId]) addAnchor.call(this, sch.$anchor) addAnchor.call(this, sch.$dynamicAnchor) - baseIds[jsonPtr] = baseId + baseIds[jsonPtr] = innerBaseId function addRef(this: Ajv, ref: string): string { // eslint-disable-next-line @typescript-eslint/unbound-method const _resolve = this.opts.uriResolver.resolve - ref = normalizeId(baseId ? _resolve(baseId, ref) : ref) + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref) if (schemaRefs.has(ref)) throw ambiguos(ref) schemaRefs.add(ref) let schOrRef = this.refs[ref] diff --git a/lib/runtime/parseJson.ts b/lib/runtime/parseJson.ts index c26b2793b..472e5e507 100644 --- a/lib/runtime/parseJson.ts +++ b/lib/runtime/parseJson.ts @@ -129,6 +129,7 @@ export function parseJsonString(s: string, pos: number): string | undefined { while (count--) { code <<= 4 c = s[pos] + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (c === undefined) { errorMessage("unexpected end") return undefined