Skip to content

Commit

Permalink
remove unneeded config, more targed ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
BlaineHeffron committed Jun 17, 2024
1 parent e489abc commit e53d907
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 1 addition & 4 deletions config/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@
"outDir": "../lib",
"target": "es6"
},
"include": [
"../src",
"../src/.eslintrc.js"
]
"include": ["../src"]
}
11 changes: 8 additions & 3 deletions src/contract/spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-fallthrough */
/* eslint-disable default-case */
import type { JSONSchema7, JSONSchema7Definition } from "json-schema";
import {
ScIntType,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -297,6 +296,7 @@ function typeRef(typeDef: xdr.ScSpecTypeDef): JSONSchema7 {
}
return { $ref: `#/definitions/${ref}` };
}
/* eslint-enable default-case */

type Func = { input: JSONSchema7; output: JSONSchema7 };

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -431,7 +432,7 @@ function unionToJsonSchema(udt: xdr.ScSpecUdtUnionV0): any {
}
return res;
}

/* eslint-enable default-case */


/**
Expand Down Expand Up @@ -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.<type>.value form here because it's faster
// than string comparisons and the underlying constants never need to be
// updated
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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 },
Expand Down

0 comments on commit e53d907

Please sign in to comment.