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

refactor(chore): fix any types sonar code smells #208

Merged
merged 1 commit into from
Jan 9, 2024
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
12 changes: 7 additions & 5 deletions src/strategies/types/cognito.types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {AnyObject} from '@loopback/repository';

export namespace Cognito {
export interface StrategyOptions {
callbackURL: string;
Expand All @@ -16,14 +18,14 @@ export namespace Cognito {
// eslint-disable-next-line @typescript-eslint/naming-convention
phone_number?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
[key: string]: any; // NOSONAR
}

export type VerifyCallback = (
err?: string | Error,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
user?: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
info?: any,

user?: AnyObject,

info?: AnyObject,
) => void;
}
13 changes: 8 additions & 5 deletions src/strategies/types/keycloak.types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import {AnyObject} from '@loopback/repository';
import {IAuthUser} from '../../types';

export namespace Keycloak {
export interface StrategyOptions {
host: string;
Expand All @@ -20,14 +23,14 @@ export namespace Keycloak {
avatar: string;
realm: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
[key: string]: any; // NOSONAR
}

export type VerifyCallback = (
err?: string | Error,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
user?: any,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
info?: any,

user?: IAuthUser,

info?: AnyObject,
) => void;
}
17 changes: 9 additions & 8 deletions src/strategies/types/types.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
/* eslint-disable @typescript-eslint/naming-convention */
import {AnyObject} from '@loopback/repository';
import {Request} from '@loopback/rest';
import * as GoogleStrategy from 'passport-google-oauth20';
import * as AzureADStrategy from 'passport-azure-ad';
import * as InstagramStrategy from 'passport-instagram';
import * as FacebookStrategy from 'passport-facebook';
import * as AppleStrategy from 'passport-apple';
import * as SamlStrategy from '@node-saml/passport-saml';
import * as AppleStrategy from 'passport-apple';
import {DecodedIdToken} from 'passport-apple';
import * as AzureADStrategy from 'passport-azure-ad';
import * as FacebookStrategy from 'passport-facebook';
import * as GoogleStrategy from 'passport-google-oauth20';
import * as InstagramStrategy from 'passport-instagram';
import {Cognito, IAuthClient, IAuthSecureClient, IAuthUser} from '../../types';
import {Keycloak} from './keycloak.types';
import {Otp} from '../passport';
import {Keycloak} from './keycloak.types';

export type VerifyCallback = (
err?: string | Error | null,
user?: Express.User,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
info?: any,

info?: AnyObject,
) => void;

export namespace VerifyFunction {
Expand Down
4 changes: 2 additions & 2 deletions src/strategy-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Node module: @loopback/authentication
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
import {AnyObject} from '@loopback/repository';
import {HttpErrors, Request, Response} from '@loopback/rest';
import {Strategy} from 'passport';

Expand Down Expand Up @@ -37,8 +38,7 @@ export class StrategyAdapter<T> {
return new Promise<T | void>((resolve, reject) => {
// mix-in passport additions like req.logIn and req.logOut
for (const key in passportRequestMixin) {
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
(request as any)[key] = passportRequestMixin[key];
(request as AnyObject)[key] = passportRequestMixin[key];
yeshamavani marked this conversation as resolved.
Show resolved Hide resolved
}

// create a prototype chain of an instance of a passport strategy
Expand Down