Skip to content

Commit 685ffb9

Browse files
authored
Merge pull request #549 from flamewow/chore/eslint__no_explicit_any
eliminated any in safe places
2 parents 6729ec9 + 830abe4 commit 685ffb9

13 files changed

+26
-27
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@typescript-eslint/interface-name-prefix": "off",
2727
"@typescript-eslint/explicit-function-return-type": "off",
2828
"@typescript-eslint/explicit-module-boundary-types": "off",
29-
"@typescript-eslint/no-explicit-any": "off",
29+
"@typescript-eslint/no-explicit-any": "warn",
3030
"@typescript-eslint/no-use-before-define": "warn",
3131
"@typescript-eslint/no-unused-vars": [
3232
"error", {

lib/interface/asyncapi-common.interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export interface OAuthFlowObject {
156156
scopes: ScopesObject;
157157
}
158158

159-
export type ScopesObject = Record<string, any>;
159+
export type ScopesObject = Record<string, unknown>;
160160

161161
export type ParameterObject = BaseParameterObject;
162162

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export interface AsyncApiOperationHeaders {
22
[key: string]: {
33
description: string;
4-
[key: string]: any;
4+
[key: string]: unknown;
55
};
66
}

lib/interface/asyncapi-operation-options-raw.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface RawAsyncApiMessage {
1212
[key: string]: {
1313
description: string;
1414
type: 'string';
15-
[key: string]: any;
15+
[key: string]: unknown;
1616
};
1717
};
1818
};

lib/interface/generator-options.interface.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AsyncApiDocument } from './asyncapi-common.interfaces';
12
import { AsyncApiTemplateOptions } from './asyncapi-template-options.interface';
23

34
export interface GeneratorOptions {
@@ -10,11 +11,11 @@ export interface GeneratorOptions {
1011
forceWrite: boolean;
1112
debug: boolean;
1213
install: boolean;
13-
templateConfig: Record<string, any>;
14-
hooks: Record<string, any>;
14+
templateConfig: Record<string, unknown>;
15+
hooks: Record<string, unknown>;
1516
templateParams: AsyncApiTemplateOptions;
16-
generate: (document: any) => Promise<void>;
17+
generate: (document: AsyncApiDocument) => Promise<void>;
1718
generateFromURL: (url: string) => Promise<void>;
1819
generateFromFile: (path: string) => Promise<void>;
19-
generateFromString: (yaml: string, args?: any) => Promise<string>;
20+
generateFromString: (yaml: string, args?: unknown) => Promise<string>;
2021
}

lib/services/asyncapi.explorer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class AsyncApiExplorer {
2121
controllerKey ? `${controllerKey}_${methodKey}` : methodKey;
2222

2323
public explorerAsyncapiServices(
24-
wrapper: InstanceWrapper<any>,
24+
wrapper: InstanceWrapper,
2525
modulePath?: string,
2626
globalPrefix?: string,
2727
operationIdFactory?: (controllerKey: string, methodKey: string) => string,
@@ -77,7 +77,7 @@ export class AsyncApiExplorer {
7777
_globalPrefix?: string,
7878
): DenormalizedDoc[] {
7979
const denormalizedAsyncapiServices = this.metadataScanner.scanFromPrototype<
80-
any,
80+
unknown,
8181
DenormalizedDoc[]
8282
>(instance, prototype, (name) => {
8383
const targetCallback = prototype[name];

sample/felines/class/feline.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export abstract class Feline {
2323

2424
birthDatetime: Date;
2525

26-
constructor(initializer: Record<string, any>) {
26+
constructor(initializer: Record<string, unknown>) {
2727
Object.assign(this, initializer);
2828
}
2929
}

sample/felines/class/message.class.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export abstract class Message<T extends Record<string, any>> {
1111

1212
abstract payload: T;
1313

14-
constructor(partialData: Record<string, any>) {
14+
constructor(partialData: Partial<Message<T>>) {
1515
Object.assign(this, partialData);
1616
}
1717
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { ApiProperty, getSchemaPath } from '@nestjs/swagger';
2-
import { Cat, Lion, Message, Tiger } from '../class';
2+
import { Cat, Feline, Lion, Message, Tiger } from '../class';
33

4-
type AllFelines = Cat | Lion | Tiger;
5-
6-
export class CreateFelineDto extends Message<AllFelines> {
4+
export class CreateFelineDto extends Message<Feline> {
75
@ApiProperty({
86
oneOf: [
97
{ $ref: getSchemaPath(Cat) },
108
{ $ref: getSchemaPath(Lion) },
119
{ $ref: getSchemaPath(Tiger) },
1210
],
1311
})
14-
payload: Cat | Lion | Tiger;
12+
payload: Feline;
1513
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Message } from '../class';
22

3-
export class JournalingDataDto extends Message<Record<string, any>> {
4-
payload: Record<string, any>;
3+
export class JournalingDataDto extends Message<Record<string, unknown>> {
4+
payload: Record<string, unknown>;
55
}

0 commit comments

Comments
 (0)