Skip to content

Commit 370b9bc

Browse files
Copilotlimonte
andauthored
fix: ESLint warnings for @typescript-eslint/no-explicit-any (#296)
* Initial plan * Initial analysis: ESLint warnings identified Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> * Fix all ESLint warnings Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> * Use ReturnType for setInterval return type Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> * Fix bug in isArrayOptions type guard Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> * Revert package-lock.json and yarn.lock changes Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> * Remove package-lock.json from .gitignore Co-authored-by: limonte <6059356+limonte@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: limonte <6059356+limonte@users.noreply.github.com>
1 parent 5fac487 commit 370b9bc

File tree

8 files changed

+11
-6
lines changed

8 files changed

+11
-6
lines changed

projects/ngx-sweetalert2-demo/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class AppComponent {
1717

1818
private readonly dynamicTextChunks = "This dynamic content is controlled by Angular".split(" ");
1919

20-
private dynamicTextChunksIntervalHandle?: any;
20+
private dynamicTextChunksIntervalHandle?: ReturnType<typeof setInterval>;
2121

2222
private currentTextChunkOffset = 0;
2323

projects/ngx-sweetalert2-demo/src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "zone.js/testing";
44
import { getTestBed } from "@angular/core/testing";
55
import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing";
66

7-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
7+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Ambient declaration for require
88
declare const require: any;
99

1010
//=> First, initialize the Angular testing environment

projects/ngx-sweetalert2/src/lib/swal-portal.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ import { CommonModule } from "@angular/common";
1515
})
1616
export class SwalPortalComponent {
1717
@Input()
18-
public template: TemplateRef<any> | null = null;
18+
public template: TemplateRef<unknown> | null = null;
1919
}

projects/ngx-sweetalert2/src/lib/swal-portal.directive.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class SwalPortalDirective implements OnInit, OnDestroy {
4444
private readonly resolver = inject(ComponentFactoryResolver);
4545
private readonly injector = inject(Injector);
4646
private readonly app = inject(ApplicationRef);
47-
private readonly templateRef = inject<TemplateRef<any>>(TemplateRef);
47+
private readonly templateRef = inject<TemplateRef<unknown>>(TemplateRef);
4848
private readonly sweetAlert2Loader = inject(SweetAlert2LoaderService);
4949
private readonly swalTargets = inject(SwalPortalTargets);
5050
private readonly swalComponent = inject(SwalComponent, { host: true });

projects/ngx-sweetalert2/src/lib/swal.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ export class SwalComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
243243
* }
244244
*/
245245
@Output()
246+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- EventEmitter can emit various types depending on input/preConfirm configuration
246247
public readonly confirm = new EventEmitter<any>();
247248

248249
/**
@@ -403,6 +404,7 @@ export class SwalComponent implements OnInit, AfterViewInit, OnChanges, OnDestro
403404

404405
return result;
405406

407+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Generic hook function that accepts any function signature
406408
function composeHook<T extends (...args: any[]) => void>(
407409
userHook: T | undefined,
408410
libHook: T,

projects/ngx-sweetalert2/src/lib/swal.directive.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ export class SwalDirective implements OnInit, OnDestroy {
5555
this.swalOptions = options;
5656
}
5757

58+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Type guard function needs to accept any type to check if it's an array
5859
function isArrayOptions(value: any): value is SweetAlertArrayOptions {
59-
return Array.isArray(options);
60+
return Array.isArray(value);
6061
}
6162
}
6263

@@ -75,6 +76,7 @@ export class SwalDirective implements OnInit, OnDestroy {
7576
* }
7677
*/
7778
@Output()
79+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- EventEmitter can emit various types depending on input/preConfirm configuration
7880
public readonly confirm = new EventEmitter<any>();
7981

8082
/**

projects/ngx-sweetalert2/src/lib/sweetalert2-loader.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class SweetAlert2LoaderService {
3030
this.swalPromiseCache = libPromise.then((value) => (isDefaultExport(value) ? value : value.default));
3131

3232
function isLoader(value: SwalProvider): value is SwalModuleLoader {
33+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Checking for version property that doesn't exist in the type definition
3334
return typeof value === "function" && (value as any).version === undefined;
3435
}
3536

projects/ngx-sweetalert2/src/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { getTestBed } from "@angular/core/testing";
55
import { platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing";
66
import { BrowserDynamicTestingModule } from "@angular/platform-browser-dynamic/testing";
77

8-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
8+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any -- Ambient declaration for require
99
declare const require: any;
1010

1111
//=> First, initialize the Angular testing environment

0 commit comments

Comments
 (0)