Skip to content

Commit 43428f9

Browse files
committed
style: fix lint issues
1 parent 3f11e1c commit 43428f9

2 files changed

Lines changed: 29 additions & 18 deletions

File tree

src/lib/buildCustomTypeType.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { CustomTypeModel } from "@prismicio/client";
22
import { source } from "common-tags";
3-
import QuickLRU from "quick-lru";
3+
import type QuickLRU from "quick-lru";
44

55
import { CUSTOM_TYPES_DOCUMENTATION_URL } from "../constants";
66
import type { AuxiliaryType, FieldConfigs } from "../types";
@@ -27,7 +27,7 @@ type BuildCustomTypeTypeReturnValue = {
2727
};
2828

2929
export function buildCustomTypeType(
30-
args: BuildCustomTypeTypesArgs,
30+
args: BuildCustomTypeTypesArgs
3131
): BuildCustomTypeTypeReturnValue {
3232
if (args.cache) {
3333
const key = getCacheKey(args.model);
@@ -79,10 +79,10 @@ export function buildCustomTypeType(
7979
* @typeParam Lang - Language API ID of the document.
8080
*/
8181
export type ${name}<Lang extends string = ${langDefault}> = prismic.${baseDocumentType}<Simplify<${
82-
dataType.name
83-
}>, "${args.model.id}", Lang>;
82+
dataType.name
83+
}>, "${args.model.id}", Lang>;
8484
`,
85-
code,
85+
code
8686
);
8787

8888
const result = {

src/lib/buildSharedSliceType.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { SharedSliceModel } from "@prismicio/client";
22
import { source, stripIndent } from "common-tags";
3-
import QuickLRU from "quick-lru";
3+
import type QuickLRU from "quick-lru";
44

55
import { SHARED_SLICES_DOCUMENTATION_URL } from "../constants";
66
import type { AuxiliaryType, FieldConfigs, FieldPath } from "../types";
@@ -27,7 +27,7 @@ type BuildSharedSliceTypeReturnValue = {
2727
};
2828

2929
export function buildSharedSliceType(
30-
args: BuildSharedSliceTypeArgs,
30+
args: BuildSharedSliceTypeArgs
3131
): BuildSharedSliceTypeReturnValue {
3232
if (args.cache) {
3333
const key = getCacheKey([args.model, args.fieldConfigs]);
@@ -54,7 +54,10 @@ export function buildSharedSliceType(
5454
const variationName = buildTypeName(name, variationModel.id);
5555

5656
let primaryInterfaceName: string | undefined;
57-
if (variationModel.primary && Object.keys(variationModel.primary).length > 0) {
57+
if (
58+
variationModel.primary &&
59+
Object.keys(variationModel.primary).length > 0
60+
) {
5861
primaryInterfaceName = buildTypeName(variationName, "Primary");
5962

6063
const path: FieldPath = [
@@ -101,7 +104,7 @@ export function buildSharedSliceType(
101104
${docs}
102105
export interface ${primaryInterfaceName} {}
103106
`,
104-
code,
107+
code
105108
);
106109
}
107110

@@ -149,7 +152,7 @@ export function buildSharedSliceType(
149152
${docs}
150153
export interface ${itemInterfaceName} {}
151154
`,
152-
code,
155+
code
153156
);
154157
}
155158

@@ -162,11 +165,15 @@ export function buildSharedSliceType(
162165
* - **Description**: ${variationModel.description || "*None*"}
163166
* - **Documentation**: ${SHARED_SLICES_DOCUMENTATION_URL}
164167
*/
165-
export type ${variationName} = prismic.SharedSliceVariation<"${variationModel.id}", ${
166-
primaryInterfaceName ? `Simplify<${primaryInterfaceName}>` : `Record<string, never>`
167-
}, ${itemInterfaceName ? `Simplify<${itemInterfaceName}>` : `never`}>;
168+
export type ${variationName} = prismic.SharedSliceVariation<"${
169+
variationModel.id
170+
}", ${
171+
primaryInterfaceName
172+
? `Simplify<${primaryInterfaceName}>`
173+
: `Record<string, never>`
174+
}, ${itemInterfaceName ? `Simplify<${itemInterfaceName}>` : `never`}>;
168175
`,
169-
code,
176+
code
170177
);
171178

172179
variationNames.push(variationName);
@@ -183,9 +190,11 @@ export function buildSharedSliceType(
183190
/**
184191
* Slice variation for *${humanReadableName}*
185192
*/
186-
type ${variationUnionName} = ${variationNames.length > 0 ? variationsUnion : "never"}
193+
type ${variationUnionName} = ${
194+
variationNames.length > 0 ? variationsUnion : "never"
195+
}
187196
`,
188-
code,
197+
code
189198
);
190199

191200
code = addSection(
@@ -197,9 +206,11 @@ export function buildSharedSliceType(
197206
* - **Description**: ${args.model.description || "*None*"}
198207
* - **Documentation**: ${SHARED_SLICES_DOCUMENTATION_URL}
199208
*/
200-
export type ${name} = prismic.SharedSlice<"${args.model.id}", ${variationUnionName}>;
209+
export type ${name} = prismic.SharedSlice<"${
210+
args.model.id
211+
}", ${variationUnionName}>;
201212
`,
202-
code,
213+
code
203214
);
204215

205216
const result = {

0 commit comments

Comments
 (0)