Skip to content

Commit 9920970

Browse files
committed
Disable unicorn/prevent-abbreviations in generated TS files
The eslint rule was renaming generated type names (e.g. ComplexArg → ComplexArgument), causing lint:fix && git diff --exit-code to fail in CI.
1 parent a17eddf commit 9920970

2 files changed

Lines changed: 15 additions & 26 deletions

File tree

src/packages/nexus-rpc-gen-core/src/language-typescript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class TypeScriptRenderAdapter extends RenderAdapter<TypeScriptRenderAccessible>
120120

121121
// Generated comment
122122
this.render.emitLine("// Generated by nexus-rpc-gen. DO NOT EDIT!");
123+
this.render.emitLine("/* eslint-disable unicorn/prevent-abbreviations */");
123124
this.render.ensureBlankLine();
124125

125126
// Import Nexus

src/packages/nexus-rpc-gen-tests/languages/ts/src/services/kitchen-sink.ts

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Generated by nexus-rpc-gen. DO NOT EDIT!
2+
/* eslint-disable unicorn/prevent-abbreviations */
23

34
import * as nexus from "nexus-rpc";
45
import { type MyExistingType } from "./types.js";
@@ -11,44 +12,31 @@ export const kitchenSinkService = nexus.service("KitchenSinkService", {
1112
/**
1213
* Counts the characters in the string
1314
*/
14-
scalarArgScalarResult: nexus.operation<
15-
KitchenSinkServiceScalarArgScalarResultInput,
16-
KitchenSinkServiceScalarArgScalarResultOutput
17-
>(),
15+
scalarArgScalarResult: nexus.operation<KitchenSinkServiceScalarArgScalarResultInput, KitchenSinkServiceScalarArgScalarResultOutput>(),
1816

1917
/**
2018
* Counts the characters in a string
2119
*/
22-
complexArgComplexResultInline: nexus.operation<
23-
KitchenSinkServiceComplexArgComplexResultInlineInput,
24-
KitchenSinkServiceComplexArgComplexResultInlineOutput
25-
>(),
20+
complexArgComplexResultInline: nexus.operation<KitchenSinkServiceComplexArgComplexResultInlineInput, KitchenSinkServiceComplexArgComplexResultInlineOutput>(),
2621

2722
scalarArgScalarResultExternal: nexus.operation<ScalarInput, ScalarOutput>(),
2823

29-
complexArgComplexResultExternal: nexus.operation<
30-
ComplexInput,
31-
ComplexOutput
32-
>(),
24+
complexArgComplexResultExternal: nexus.operation<ComplexInput, ComplexOutput>(),
3325

3426
/**
3527
* Tests required collections marshal correctly
3628
*/
37-
requiredCollections: nexus.operation<
38-
RequiredCollectionsInput,
39-
RequiredCollectionsOutput
40-
>(),
29+
requiredCollections: nexus.operation<RequiredCollectionsInput, RequiredCollectionsOutput>(),
4130
});
4231

4332
export const strangeItem = nexus.service("Strange{Item}", {
44-
strangeItem: nexus.operation<StrangeItem, PurpleStrangeItem>({
45-
name: "Strange{Item}",
46-
}),
33+
strangeItem: nexus.operation<StrangeItem, PurpleStrangeItem>({ name: "Strange{Item}" }),
4734

4835
strangeItem2: nexus.operation<void, void>({ name: "StrangeItem" }),
4936
});
5037

51-
export const strangeItem2 = nexus.service("StrangeItem", {});
38+
export const strangeItem2 = nexus.service("StrangeItem", {
39+
});
5240

5341
export const reservedWordService = nexus.service("ReservedWordService", {
5442
toStringOperation: nexus.operation<void, void>({ name: "ToString" }),
@@ -105,7 +93,7 @@ export interface KitchenSinkServiceComplexArgComplexResultInlineOutput {
10593
}
10694

10795
export interface ComplexInput {
108-
selfRef?: ComplexInput;
96+
selfRef?: ComplexInput;
10997
someSharedObj?: SharedObject;
11098
}
11199

@@ -114,14 +102,14 @@ export interface SharedObject {
114102
}
115103

116104
export interface ComplexOutput {
117-
selfRef?: ComplexOutput;
105+
selfRef?: ComplexOutput;
118106
someSharedObj?: SharedObject;
119107
}
120108

121109
export interface RequiredCollectionsInput {
122-
metadata: { [key: string]: string };
110+
metadata: { [key: string]: string };
123111
optionalList?: number[];
124-
tags: string[];
112+
tags: string[];
125113
}
126114

127115
export interface RequiredCollectionsOutput {
@@ -137,8 +125,8 @@ export interface PurpleStrangeItem {
137125
}
138126

139127
export interface DateInput {
140-
date?: Date;
128+
date?: Date;
141129
dateTime?: Date;
142-
time?: string;
130+
time?: string;
143131
[property: string]: any;
144132
}

0 commit comments

Comments
 (0)