Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump prettier and eslint-plugin-prettier #20181

Merged
merged 3 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
tabWidth: 2
trailingComma: all
Jolg42 marked this conversation as resolved.
Show resolved Hide resolved
singleQuote: true
semi: false
printWidth: 120
7 changes: 3 additions & 4 deletions helpers/blaze/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ pipe.async = pipeAsync
export declare type PipeMultiSync = {
<R0, P extends any[]>(...fns: [F.Function<P, R0>]): F.Function<P, R0>
<R0, R1, P extends any[]>(...fns: [F.Function<P, R0>, F.Function<[R0], R1>]): F.Function<P, R1>
<R0, R1, R2, P extends any[]>(...fns: [F.Function<P, R0>, F.Function<[R0], R1>, F.Function<[R1], R2>]): F.Function<
P,
R2
>
<R0, R1, R2, P extends any[]>(
...fns: [F.Function<P, R0>, F.Function<[R0], R1>, F.Function<[R1], R2>]
): F.Function<P, R2>
<R0, R1, R2, R3, P extends any[]>(
...fns: [F.Function<P, R0>, F.Function<[R0], R1>, F.Function<[R1], R2>, F.Function<[R2], R3>]
): F.Function<P, R3>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jest": "27.2.2",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-simple-import-sort": "10.0.0",
"eventemitter3": "5.0.1",
"execa": "5.1.1",
Expand All @@ -68,7 +68,7 @@
"p-reduce": "2.1.0",
"p-retry": "4.6.2",
"path-browserify": "1.0.1",
"prettier": "2.8.8",
"prettier": "3.0.0",
"redis": "3.1.2",
"redis-lock": "0.1.4",
"regenerator-runtime": "0.13.11",
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/src/CLI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export class CLI implements Command {
static new(cmds: Commands, ensureBinaries: string[]): CLI {
return new CLI(cmds, ensureBinaries)
}
private constructor(private readonly cmds: Commands, private readonly ensureBinaries: string[]) {}
private constructor(
private readonly cmds: Commands,
private readonly ensureBinaries: string[],
) {}

async parse(argv: string[]): Promise<string | Error> {
const args = arg(argv, {
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/TSClient/Enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import { TAB_SIZE } from './constants'
import type { Generatable } from './Generatable'

export class Enum implements Generatable {
constructor(protected readonly type: DMMF.SchemaEnum, protected readonly useNamespace: boolean) {}
constructor(
protected readonly type: DMMF.SchemaEnum,
protected readonly useNamespace: boolean,
) {}

private isObjectEnum(): boolean {
return this.useNamespace && objectEnumNames.includes(this.type.name)
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/TSClient/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ function xorTypes(types: ts.TypeBuilder[]) {
}

export class InputType implements Generatable {
constructor(protected readonly type: DMMF.InputType, protected readonly genericsInfo: GenericArgsInfo) {}
constructor(
protected readonly type: DMMF.InputType,
protected readonly genericsInfo: GenericArgsInfo,
) {}

public toTS(): string {
const { type } = this
Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/generation/TSClient/Model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@ ${
availableActions.includes(DMMF.ModelAction.aggregate)
? `${indent(getMethodJSDoc(DMMF.ModelAction.aggregate, mapping, modelOrType), TAB_SIZE)}
aggregate<T extends ${getAggregateArgsName(name)}>(args: Subset<T, ${getAggregateArgsName(
name,
)}>): Prisma.PrismaPromise<${getAggregateGetName(name)}<T>>
name,
)}>): Prisma.PrismaPromise<${getAggregateGetName(name)}<T>>
`
: ''
}
Expand Down Expand Up @@ -511,8 +511,8 @@ ${
: \`Error: Field "$\{P}" in "orderBy" needs to be provided in "by"\`
}[OrderFields]
>(args: SubsetIntersection<T, ${groupByArgsName}, OrderByArg> & InputErrors): {} extends InputErrors ? ${getGroupByPayloadName(
name,
)}<T> : Prisma.PrismaPromise<InputErrors>`
name,
)}<T> : Prisma.PrismaPromise<InputErrors>`
: ''
}
/**
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/TSClient/ModelFieldRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { getFieldRefsTypeName, getRefAllowedTypeName } from '../utils'
import { Generatable } from './Generatable'

export class ModelFieldRefs implements Generatable {
constructor(protected generator: GeneratorConfig | undefined, protected outputType: DMMF.OutputType) {}
constructor(
protected generator: GeneratorConfig | undefined,
protected outputType: DMMF.OutputType,
) {}
toTS() {
const { name } = this.outputType
return `
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/TSClient/Output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ export class OutputField implements Generatable {
export class OutputType implements Generatable {
public name: string
public fields: DMMF.SchemaField[]
constructor(protected readonly dmmf: DMMFHelper, protected readonly type: DMMF.OutputType) {
constructor(
protected readonly dmmf: DMMFHelper,
protected readonly type: DMMF.OutputType,
) {
this.name = type.name
this.fields = type.fields
}
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/ts-builders/KeyType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { TypeBuilder } from './TypeBuilder'
import { Writer } from './Writer'

export class KeyType extends TypeBuilder {
constructor(public baseType: TypeBuilder, public key: string) {
constructor(
public baseType: TypeBuilder,
public key: string,
) {
super()
}
write(writer: Writer): void {
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/ts-builders/Parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { Writer } from './Writer'

export class Parameter implements BasicBuilder {
private isOptional = false
constructor(private name: string, private type: TypeBuilder) {}
constructor(
private name: string,
private type: TypeBuilder,
) {}

optional(): this {
this.isOptional = true
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/ts-builders/Property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export class Property implements BasicBuilder {
private isReadonly = false
private docComment?: DocComment

constructor(private name: string, private type: TypeBuilder) {}
constructor(
private name: string,
private type: TypeBuilder,
) {}

optional(): this {
this.isOptional = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ export class TypeDeclaration<InnerType extends TypeBuilder = TypeBuilder> implem
private genericParameters: GenericParameter[] = []
private docComment?: DocComment

constructor(readonly name: string, readonly type: InnerType) {}
constructor(
readonly name: string,
readonly type: InnerType,
) {}

addGenericParameter(param: GenericParameter): this {
this.genericParameters.push(param)
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/generation/ts-builders/Writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export class Writer<ContextType = undefined> {
private marginSymbol?: string
private afterNextNewLineCallback?: () => void

constructor(startingIndent = 0, readonly context: ContextType) {
constructor(
startingIndent = 0,
readonly context: ContextType,
) {
this.currentIndent = startingIndent
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { Value } from './Value'
const separator = ': '
export class ObjectField implements ErrorBasicBuilder {
private hasError = false
constructor(readonly name: string, readonly value: Value) {}
constructor(
readonly name: string,
readonly value: Value,
) {}

markAsError() {
this.hasError = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { SuggestionObjectValue } from './SuggestionObjectValue'

export class ObjectFieldSuggestion implements ErrorBasicBuilder {
public isRequired = false
constructor(readonly name: string, readonly value: string | SuggestionObjectValue) {}
constructor(
readonly name: string,
readonly value: string | SuggestionObjectValue,
) {}

makeRequired() {
this.isRequired = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ class MergedExtensionsListNode {
return previous.concat(newCb)
})

constructor(public extension: Args, public previous?: MergedExtensionsListNode) {}
constructor(
public extension: Args,
public previous?: MergedExtensionsListNode,
) {}

getAllComputedFields(dmmfModelName: string): ComputedFieldsMap | undefined {
return this.computedFieldsCache.getOrCreate(dmmfModelName, () => {
Expand Down
11 changes: 9 additions & 2 deletions packages/generator-helper/src/GeneratorProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ type GeneratorProcessOptions = {
export class GeneratorError extends Error {
name = 'GeneratorError'

constructor(message: string, public code?: number, public data?: any) {
constructor(
message: string,
public code?: number,
public data?: any,
) {
super(message)
if (data?.stack) {
this.stack = data.stack
Expand All @@ -44,7 +48,10 @@ export class GeneratorProcess {
private errorLogs = ''
private pendingError: Error | undefined

constructor(private pathOrCommand: string, { isNode = false }: GeneratorProcessOptions = {}) {
constructor(
private pathOrCommand: string,
{ isNode = false }: GeneratorProcessOptions = {},
) {
this.isNode = isNode
}

Expand Down
16 changes: 8 additions & 8 deletions packages/get-platform/src/getPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'musl',
familyDistro: originalDistro,
originalDistro,
} as const),
}) as const,
)
.with(
{ id: 'raspbian' },
Expand All @@ -142,7 +142,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'arm',
familyDistro: 'debian',
originalDistro,
} as const),
}) as const,
)
.with(
{ id: 'nixos' },
Expand All @@ -151,7 +151,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'nixos',
originalDistro,
familyDistro: 'nixos',
} as const),
}) as const,
)
.with(
{ id: 'debian' },
Expand All @@ -161,7 +161,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'debian',
familyDistro: 'debian',
originalDistro,
} as const),
}) as const,
)
.with(
{ id: 'rhel' },
Expand All @@ -172,7 +172,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'rhel',
familyDistro: 'rhel',
originalDistro,
} as const),
}) as const,
)
.when(
({ idLike }) => idLike.includes('debian') || idLike.includes('ubuntu'),
Expand All @@ -181,7 +181,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'debian',
familyDistro: 'debian',
originalDistro,
} as const),
}) as const,
)
.when(
({ idLike }) => id === 'arch' || idLike.includes('arch'),
Expand All @@ -190,7 +190,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'debian',
familyDistro: 'arch',
originalDistro,
} as const),
}) as const,
)
.when(
({ idLike }) =>
Expand All @@ -200,7 +200,7 @@ export function parseDistro(osReleaseInput: string): DistroInfo {
targetDistro: 'rhel',
familyDistro: 'rhel',
originalDistro,
} as const),
}) as const,
)
.otherwise(({ id: originalDistro }) => {
/* Generic distro info fallback */
Expand Down
4 changes: 2 additions & 2 deletions packages/internals/src/engine-commands/getDmmf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document> {
reason: 'Error while trying to read the datamodel path',
error: e as Error,
datamodelPath: options.datamodelPath,
} as const),
}) as const,
),
TE.chainW((datamodel) => {
return pipe(
Expand All @@ -103,7 +103,7 @@ export async function getDMMF(options: GetDMMFOptions): Promise<DMMF.Document> {
type: 'wasm-error' as const,
reason: '(get-dmmf wasm)',
error: e as Error | WasmPanic,
} as const),
}) as const,
),
E.map((result) => ({ result })),
E.chainW(({ result }) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/internals/src/engine-commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function validate(options: ValidateOptions): void {
type: 'wasm-error' as const,
reason: '(validate wasm)',
error: e as Error | WasmPanic,
} as const),
}) as const,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Command, detect, getCommand } from '@antfu/ni'
* @returns
*/
export async function getPackageCmd(cwd: string, cmd: Command, ...args: string[]) {
const agent = await detect({ autoInstall: false, cwd, programmatic: true})
const agent = await detect({ autoInstall: false, cwd, programmatic: true })

return getCommand(agent ?? 'npm', cmd, args)
}
2 changes: 1 addition & 1 deletion packages/internals/src/utils/fs-functional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ function createTaggedSystemError<Tag extends string, Meta extends Record<string,
type,
error: e as Error & { code: string },
meta,
} as const)
}) as const
}
15 changes: 9 additions & 6 deletions packages/internals/src/utils/pick.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
export function pick<T extends object, U extends keyof T>(obj: T, keys: U[]): Pick<T, U> {
return Object.entries(obj).reduce<Pick<T, U>>((acc, [key, value]) => {
if (keys.includes(key as U)) {
acc[key] = value
}
return acc
}, {} as Pick<T, U>)
return Object.entries(obj).reduce<Pick<T, U>>(
(acc, [key, value]) => {
if (keys.includes(key as U)) {
acc[key] = value
}
return acc
},
{} as Pick<T, U>,
)
}
Loading
Loading