Skip to content

Commit 0d698e2

Browse files
committed
Disable linting on empty interface any
Signed-off-by: Spike Curtis <spike@coder.com>
1 parent a2189e0 commit 0d698e2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

scripts/apitypings/main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,14 @@ func (g *Generator) typescriptType(ty types.Type) (TypescriptType, error) {
381381
return TypescriptType{}, xerrors.Errorf("map key: %w", err)
382382
}
383383

384+
aboveTypeLine := keyType.AboveTypeLine
385+
if aboveTypeLine != "" && valueType.AboveTypeLine != "" {
386+
aboveTypeLine = aboveTypeLine + "\n"
387+
}
388+
aboveTypeLine = aboveTypeLine + valueType.AboveTypeLine
384389
return TypescriptType{
385-
ValueType: fmt.Sprintf("Record<%s, %s>", keyType.ValueType, valueType.ValueType),
390+
ValueType: fmt.Sprintf("Record<%s, %s>", keyType.ValueType, valueType.ValueType),
391+
AboveTypeLine: aboveTypeLine,
386392
}, nil
387393
case *types.Slice, *types.Array:
388394
// Slice/Arrays are pretty much the same.
@@ -461,7 +467,8 @@ func (g *Generator) typescriptType(ty types.Type) (TypescriptType, error) {
461467
// only handle the empty interface for now
462468
intf := ty
463469
if intf.Empty() {
464-
return TypescriptType{ValueType: "any"}, nil
470+
return TypescriptType{ValueType: "any",
471+
AboveTypeLine: indentedComment("eslint-disable-next-line")}, nil
465472
}
466473
return TypescriptType{}, xerrors.New("only empty interface types are supported")
467474
}

site/src/api/typesGenerated.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export interface GoogleInstanceIdentityToken {
176176
export interface License {
177177
readonly id: number
178178
readonly uploaded_at: string
179+
// eslint-disable-next-line
179180
readonly claims: Record<string, any>
180181
}
181182

0 commit comments

Comments
 (0)