From e53d9078df700b4083ad7dac40c299aa2b30efa5 Mon Sep 17 00:00:00 2001 From: Blaine Heffron Date: Mon, 17 Jun 2024 15:26:52 -0400 Subject: [PATCH] remove unneeded config, more targed ignores --- config/tsconfig.json | 5 +---- src/contract/spec.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/config/tsconfig.json b/config/tsconfig.json index 12b4ea6b7..76fdf22b3 100644 --- a/config/tsconfig.json +++ b/config/tsconfig.json @@ -11,8 +11,5 @@ "outDir": "../lib", "target": "es6" }, - "include": [ - "../src", - "../src/.eslintrc.js" - ] + "include": ["../src"] } \ No newline at end of file diff --git a/src/contract/spec.ts b/src/contract/spec.ts index 01f8f841d..863fbac1d 100644 --- a/src/contract/spec.ts +++ b/src/contract/spec.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-fallthrough */ -/* eslint-disable default-case */ import type { JSONSchema7, JSONSchema7Definition } from "json-schema"; import { ScIntType, @@ -165,6 +163,7 @@ const PRIMITIVE_DEFINITONS: { [key: string]: JSONSchema7Definition } = { }, }; +/* eslint-disable default-case */ /** * @param typeDef type to convert to json schema reference * @returns {JSONSchema7} a schema describing the type @@ -297,6 +296,7 @@ function typeRef(typeDef: xdr.ScSpecTypeDef): JSONSchema7 { } return { $ref: `#/definitions/${ref}` }; } +/* eslint-enable default-case */ type Func = { input: JSONSchema7; output: JSONSchema7 }; @@ -383,6 +383,7 @@ function functionToJsonSchema(func: xdr.ScSpecFunctionV0): Func { }; } +/* eslint-disable default-case */ function unionToJsonSchema(udt: xdr.ScSpecUdtUnionV0): any { const description = udt.doc().toString(); const cases = udt.cases(); @@ -431,7 +432,7 @@ function unionToJsonSchema(udt: xdr.ScSpecUdtUnionV0): any { } return res; } - +/* eslint-enable default-case */ /** @@ -918,6 +919,7 @@ export class Spec { if (value === xdr.ScSpecType.scSpecTypeUdt().value) { return this.scValUdtToNative(scv, typeDef.udt()); } + /* eslint-disable no-fallthrough*/ // we use the verbose xdr.ScValType..value form here because it's faster // than string comparisons and the underlying constants never need to be // updated @@ -1013,6 +1015,7 @@ export class Spec { )} to native type from type ${t.name}`, ); } + /* eslint-enable no-fallthrough*/ } private scValUdtToNative(scv: xdr.ScVal, udt: xdr.ScSpecTypeUdt): any { @@ -1119,6 +1122,7 @@ export class Spec { */ jsonSchema(funcName?: string): JSONSchema7 { const definitions: { [key: string]: JSONSchema7Definition } = {}; + /* eslint-disable default-case */ this.entries.forEach(entry => { switch (entry.switch().value) { case xdr.ScSpecEntryKind.scSpecEntryUdtEnumV0().value: { @@ -1149,6 +1153,7 @@ export class Spec { } } }); + /* eslint-enable default-case */ const res: JSONSchema7 = { $schema: "http://json-schema.org/draft-07/schema#", definitions: { ...PRIMITIVE_DEFINITONS, ...definitions },