diff --git a/lib/src/generators/openapi2/openapi2-parameter-util.ts b/lib/src/generators/openapi2/openapi2-parameter-util.ts index 7e833a13f..05803983e 100644 --- a/lib/src/generators/openapi2/openapi2-parameter-util.ts +++ b/lib/src/generators/openapi2/openapi2-parameter-util.ts @@ -234,8 +234,10 @@ function integerParameterObject( }; } -const pathParamArrayTypeToParameterArrayTypeObject = arrayTypeToParameterArrayTypeObject; -const headerArrayTypeToParameterArrayTypeObject = arrayTypeToParameterArrayTypeObject; +const pathParamArrayTypeToParameterArrayTypeObject = + arrayTypeToParameterArrayTypeObject; +const headerArrayTypeToParameterArrayTypeObject = + arrayTypeToParameterArrayTypeObject; const queryParamArrayTypeToParameterArrayTypeObject = ( type: ArrayType, typeTable: TypeTable, diff --git a/lib/src/generators/openapi3/openapi3.ts b/lib/src/generators/openapi3/openapi3.ts index 4f2daf8e7..e09c8cdec 100644 --- a/lib/src/generators/openapi3/openapi3.ts +++ b/lib/src/generators/openapi3/openapi3.ts @@ -374,9 +374,8 @@ function contractToOa3ServerObject( ? server.oa3ServerVariables.reduce<{ [serverVariable: string]: ServerVariableObject; }>((acc, serverVariable) => { - acc[ - serverVariable.parameterName - ] = oa3ServerVariableToServerVariableObject(serverVariable); + acc[serverVariable.parameterName] = + oa3ServerVariableToServerVariableObject(serverVariable); return acc; }, {}) : undefined; diff --git a/lib/src/linting/rules.ts b/lib/src/linting/rules.ts index c6d5a66e6..cae102b0f 100644 --- a/lib/src/linting/rules.ts +++ b/lib/src/linting/rules.ts @@ -15,8 +15,10 @@ export const availableRules: LintingRules = { "has-response": hasResponse, "no-inline-objects-within-unions": noInlineObjectsWithinUnions, "no-nullable-arrays": noNullableArrays, - "no-nullable-fields-within-request-bodies": noNullableFieldsWithinRequestBodies, - "no-omittable-fields-within-response-bodies": noOmittableFieldsWithinResponseBodies + "no-nullable-fields-within-request-bodies": + noNullableFieldsWithinRequestBodies, + "no-omittable-fields-within-response-bodies": + noOmittableFieldsWithinResponseBodies }; interface LintingRules { diff --git a/lib/src/linting/rules/__spec-examples__/no-inline-objects-within-unions/contract-inline-object-union-violations-in-each-query-param-and-body-component.ts b/lib/src/linting/rules/__spec-examples__/no-inline-objects-within-unions/contract-inline-object-union-violations-in-each-query-param-and-body-component.ts index 7c6640ce3..cf5f5123e 100644 --- a/lib/src/linting/rules/__spec-examples__/no-inline-objects-within-unions/contract-inline-object-union-violations-in-each-query-param-and-body-component.ts +++ b/lib/src/linting/rules/__spec-examples__/no-inline-objects-within-unions/contract-inline-object-union-violations-in-each-query-param-and-body-component.ts @@ -38,4 +38,4 @@ interface Body { field: InlineObjectUnion; } -type InlineObjectUnion = /* prettier-ignore */ { name: String } | { title: String }; +type InlineObjectUnion = { name: String } | { title: String }; diff --git a/lib/src/parsers/config-parser.ts b/lib/src/parsers/config-parser.ts index 02a71f6fe..60ad675e9 100644 --- a/lib/src/parsers/config-parser.ts +++ b/lib/src/parsers/config-parser.ts @@ -37,9 +37,8 @@ export function parseConfig( >(queryStratLiteral, "array"); if (queryArrayStratProp) { - const queryArrayStratValue = getPropValueAsStringOrThrow( - queryArrayStratProp - ).getLiteralText(); + const queryArrayStratValue = + getPropValueAsStringOrThrow(queryArrayStratProp).getLiteralText(); if (!isQueryParamArrayStrategy(queryArrayStratValue)) { throw new Error( `expected a QueryParamArrayStrategy, got ${queryArrayStratValue}` diff --git a/lib/src/parsers/headers-parser.ts b/lib/src/parsers/headers-parser.ts index f8799c47a..35abec67e 100644 --- a/lib/src/parsers/headers-parser.ts +++ b/lib/src/parsers/headers-parser.ts @@ -30,9 +30,8 @@ export function parseHeaders( ); } - const headerPropertySignatures = getParameterPropertySignaturesOrThrow( - parameter - ); + const headerPropertySignatures = + getParameterPropertySignaturesOrThrow(parameter); const headers: Array
= []; for (const propertySignature of headerPropertySignatures) { diff --git a/lib/src/parsers/oa3server-parser.ts b/lib/src/parsers/oa3server-parser.ts index 884f06fdc..6d812cf5e 100644 --- a/lib/src/parsers/oa3server-parser.ts +++ b/lib/src/parsers/oa3server-parser.ts @@ -94,9 +94,8 @@ function parseOa3Variables( ); } - const queryParamPropertySignatures = getParameterPropertySignaturesOrThrow( - parameter - ); + const queryParamPropertySignatures = + getParameterPropertySignaturesOrThrow(parameter); const oa3ServerVariableParams: Array = []; diff --git a/lib/src/parsers/path-params-parser.ts b/lib/src/parsers/path-params-parser.ts index ce0dbdf1e..390c6e8eb 100644 --- a/lib/src/parsers/path-params-parser.ts +++ b/lib/src/parsers/path-params-parser.ts @@ -28,9 +28,8 @@ export function parsePathParams( }) ); } - const pathParamPropertySignatures = getParameterPropertySignaturesOrThrow( - parameter - ); + const pathParamPropertySignatures = + getParameterPropertySignaturesOrThrow(parameter); const pathParams = []; for (const propertySignature of pathParamPropertySignatures) { diff --git a/lib/src/parsers/query-params-parser.ts b/lib/src/parsers/query-params-parser.ts index ddfe1b31f..d1ae46509 100644 --- a/lib/src/parsers/query-params-parser.ts +++ b/lib/src/parsers/query-params-parser.ts @@ -28,9 +28,8 @@ export function parseQueryParams( }) ); } - const queryParamPropertySignatures = getParameterPropertySignaturesOrThrow( - parameter - ); + const queryParamPropertySignatures = + getParameterPropertySignaturesOrThrow(parameter); const queryParams: Array = []; for (const propertySignature of queryParamPropertySignatures) { diff --git a/lib/src/parsers/type-parser.spec.ts b/lib/src/parsers/type-parser.spec.ts index e2cfbc71e..1aaab5653 100644 --- a/lib/src/parsers/type-parser.spec.ts +++ b/lib/src/parsers/type-parser.spec.ts @@ -537,9 +537,9 @@ describe("type parser", () => { .getPropertyOrThrow("indexedAccess") .getTypeNodeOrThrow(); - expect( - parseType(type, typeTable, lociTable).unwrapOrThrow() - ).toStrictEqual({ kind: "boolean", schemaProps: undefined }); + expect(parseType(type, typeTable, lociTable).unwrapOrThrow()).toStrictEqual( + { kind: "boolean", schemaProps: undefined } + ); }); test("parses nested indexed accessing", () => { @@ -547,9 +547,9 @@ describe("type parser", () => { .getPropertyOrThrow("indexedAccessNested") .getTypeNodeOrThrow(); - expect( - parseType(type, typeTable, lociTable).unwrapOrThrow() - ).toStrictEqual({ kind: "boolean", schemaProps: undefined }); + expect(parseType(type, typeTable, lociTable).unwrapOrThrow()).toStrictEqual( + { kind: "boolean", schemaProps: undefined } + ); }); test("parses indexed indexed accessing", () => { @@ -557,9 +557,9 @@ describe("type parser", () => { .getPropertyOrThrow("indexedIndexedAccess") .getTypeNodeOrThrow(); - expect( - parseType(type, typeTable, lociTable).unwrapOrThrow() - ).toStrictEqual({ kind: "boolean", schemaProps: undefined }); + expect(parseType(type, typeTable, lociTable).unwrapOrThrow()).toStrictEqual( + { kind: "boolean", schemaProps: undefined } + ); }); test("parses intersection type", () => { diff --git a/lib/src/parsers/type-parser.ts b/lib/src/parsers/type-parser.ts index c23e88fd3..b3fafeb81 100644 --- a/lib/src/parsers/type-parser.ts +++ b/lib/src/parsers/type-parser.ts @@ -556,9 +556,8 @@ function parseIndexedAccessType( typeTable: TypeTable, lociTable: LociTable ): Result { - const propertyAccessChainResult = resolveIndexAccessPropertyAccessChain( - typeNode - ); + const propertyAccessChainResult = + resolveIndexAccessPropertyAccessChain(typeNode); if (propertyAccessChainResult.isErr()) return propertyAccessChainResult; const rootReferenceResult = resolveIndexedAccessRootReference(typeNode); diff --git a/lib/src/spec-helpers/helper.ts b/lib/src/spec-helpers/helper.ts index 98d885526..803d85428 100644 --- a/lib/src/spec-helpers/helper.ts +++ b/lib/src/spec-helpers/helper.ts @@ -61,9 +61,10 @@ export function createProject(): Project { }); } -export function createProjectFromExistingSourceFile( - filePath: string -): { project: Project; file: SourceFile } { +export function createProjectFromExistingSourceFile(filePath: string): { + project: Project; + file: SourceFile; +} { const project = createProject(); const file = project.addSourceFileAtPath(filePath); project.resolveSourceFileDependencies(); diff --git a/lib/src/validation-server/verifications/contract-mismatcher.ts b/lib/src/validation-server/verifications/contract-mismatcher.ts index 9a8997f1d..0a8e378e1 100644 --- a/lib/src/validation-server/verifications/contract-mismatcher.ts +++ b/lib/src/validation-server/verifications/contract-mismatcher.ts @@ -228,9 +228,9 @@ export class ContractMismatcher { case MismatchKind.BODY_TYPE_DISPARITY: violations.push( responseBodyTypeDisparityViolation( - `Response body type disparity:\n${ - m.data - }\n${m.typeDisparities.map(disp => `- ${disp}`).join("\n")}`, + `Response body type disparity:\n${m.data}\n${m.typeDisparities + .map(disp => `- ${disp}`) + .join("\n")}`, m.typeDisparities ) ); diff --git a/package.json b/package.json index af7df6644..b1586fb48 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "mini-css-extract-plugin": "^1.6.0", "mobx": "^6.3.0", "nock": "^13.0.11", - "prettier": "^2.2.1", + "prettier": "^2.3.0", "react": "^16.14.0", "react-dom": "^16.14.0", "redoc": "^2.0.0-rc.53", diff --git a/yarn.lock b/yarn.lock index a50b613c3..a21635d4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6487,10 +6487,10 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= -prettier@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== +prettier@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.0.tgz#b6a5bf1284026ae640f17f7ff5658a7567fc0d18" + integrity sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w== pretty-error@^2.1.1: version "2.1.2"