Skip to content

Commit

Permalink
fix(renderFieldsOnly): use prettier config (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Petryk <steven.petryk@intercom.io>
  • Loading branch information
zernie and Steven Petryk authored Apr 16, 2020
1 parent 0a13f48 commit 683de80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/renderers/renderFieldsOnly.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ContentType } from "contentful"

import { format } from "prettier"
import { format, resolveConfig } from "prettier"

import renderContentType from "./contentful-fields-only/renderContentType"

Expand All @@ -9,7 +9,9 @@ export default async function renderFieldsOnly(contentTypes: ContentType[]) {

const source = renderAllContentTypes(sortedContentTypes)

return format(source, { parser: "typescript" })
const prettierConfig = await resolveConfig(process.cwd())

return format(source, { ...prettierConfig, parser: "typescript" })
}

function renderAllContentTypes(contentTypes: ContentType[]): string {
Expand Down
6 changes: 3 additions & 3 deletions test/renderers/renderFieldsOnly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ describe("renderFieldsOnly()", () => {
"export interface IMyContentType {
fields: {
/** Array field */
arrayField: (\\"one\\" | \\"of\\" | \\"the\\" | \\"above\\")[];
};
[otherKeys: string]: any;
arrayField: (\\"one\\" | \\"of\\" | \\"the\\" | \\"above\\")[]
}
[otherKeys: string]: any
}
"
`)
Expand Down

0 comments on commit 683de80

Please sign in to comment.