diff --git a/.prettierrc b/.prettierrc index f58b81d..2e48c76 100644 --- a/.prettierrc +++ b/.prettierrc @@ -2,5 +2,6 @@ "bracketSpacing": false, "singleQuote": true, "printWidth": 80, - "trailingComma": "all" + "trailingComma": "all", + "arrowParens": "avoid" } diff --git a/src/providers/client-authentication.provider.ts b/src/providers/client-authentication.provider.ts index 7e6f7fb..a78f808 100644 --- a/src/providers/client-authentication.provider.ts +++ b/src/providers/client-authentication.provider.ts @@ -18,7 +18,7 @@ export class ClientAuthenticateActionProvider ) {} value(): AuthenticateFn { - return (request) => this.action(request); + return request => this.action(request); } async action(request: Request): Promise { diff --git a/src/release_notes/post-processing.js b/src/release_notes/post-processing.js index deefd64..efa8475 100644 --- a/src/release_notes/post-processing.js +++ b/src/release_notes/post-processing.js @@ -10,17 +10,17 @@ module.exports = async function (data, callback) { const commitTitle = commit.title; commit.title = commitTitle.substring(0, commitTitle.indexOf('#') - 1); - commit.messageLines = commit.messageLines.filter((message) => { + commit.messageLines = commit.messageLines.filter(message => { if (message.indexOf('efs/remotes/origin') === -1) return message; }); - commit.messageLines.forEach((message) => { + commit.messageLines.forEach(message => { commit.issueno = message.includes('GH-') ? message.replace('GH-', '').trim() : null; }); - const issueDesc = await getIssueDesc(commit.issueno).then((res) => { + const issueDesc = await getIssueDesc(commit.issueno).then(res => { return res; }); commit.issueTitle = issueDesc; @@ -48,9 +48,9 @@ function getIssueDesc(issueNo) { `https://github.com/sourcefuse/loopback4-authentication/issues/${encodeURIComponent( issueNo, )}`, - (res) => { + res => { res.setEncoding('utf8'); - res.on('data', (chunk) => { + res.on('data', chunk => { result = result + chunk; }); res.on('end', () => { @@ -69,7 +69,7 @@ function getIssueDesc(issueNo) { }); }, ); - req.on('error', (e) => { + req.on('error', e => { reject(e); }); req.end(); diff --git a/src/release_notes/release-notes.js b/src/release_notes/release-notes.js index 0296146..e573f93 100644 --- a/src/release_notes/release-notes.js +++ b/src/release_notes/release-notes.js @@ -53,7 +53,7 @@ async function addAndCommit() { await git.push('origin', 'master'); } -generateReleaseNotes().catch((ex) => { +generateReleaseNotes().catch(ex => { console.error(ex); process.exit(1); }); diff --git a/src/strategies/passport/passport-client-password/client-password-strategy-factory-provider.ts b/src/strategies/passport/passport-client-password/client-password-strategy-factory-provider.ts index 7a9b942..d856e2f 100644 --- a/src/strategies/passport/passport-client-password/client-password-strategy-factory-provider.ts +++ b/src/strategies/passport/passport-client-password/client-password-strategy-factory-provider.ts @@ -50,11 +50,11 @@ export class ClientPasswordStrategyFactoryProvider req: Request | undefined, ) => { verifyFn(clientId, clientSecret, req) - .then((client) => { + .then(client => { this.clientPasswordVerifierHelper(client, clientSecret); cb(null, client); }) - .catch((err) => { + .catch(err => { cb(err); }); }, @@ -68,11 +68,11 @@ export class ClientPasswordStrategyFactoryProvider cb: (err: Error | null, client?: IAuthClient | null) => void, ) => { verifyFn(clientId, clientSecret) - .then((client) => { + .then(client => { this.clientPasswordVerifierHelper(client, clientSecret); cb(null, client); }) - .catch((err) => { + .catch(err => { cb(err); }); }, diff --git a/src/strategies/passport/passport-client-password/secure-client-password-strategy-factory-provider.ts b/src/strategies/passport/passport-client-password/secure-client-password-strategy-factory-provider.ts index 7469f3b..7011527 100644 --- a/src/strategies/passport/passport-client-password/secure-client-password-strategy-factory-provider.ts +++ b/src/strategies/passport/passport-client-password/secure-client-password-strategy-factory-provider.ts @@ -54,11 +54,11 @@ export class SecureClientPasswordStrategyFactoryProvider req: Request | undefined, ) => { verifyFn(clientId, clientSecret, req) - .then((client) => { + .then(client => { this.secureClientPasswordVerifierHelper(client, clientSecret); cb(null, client); }) - .catch((err) => { + .catch(err => { cb(err); }); }, @@ -72,11 +72,11 @@ export class SecureClientPasswordStrategyFactoryProvider cb: (err: Error | null, client?: IAuthSecureClient | null) => void, ) => { verifyFn(clientId, clientSecret) - .then((client) => { + .then(client => { this.secureClientPasswordVerifierHelper(client, clientSecret); cb(null, client); }) - .catch((err) => { + .catch(err => { cb(err); }); }, diff --git a/src/strategies/passport/passport-otp/otp-strategy-factory.provider.ts b/src/strategies/passport/passport-otp/otp-strategy-factory.provider.ts index b43d315..12bf5ee 100644 --- a/src/strategies/passport/passport-otp/otp-strategy-factory.provider.ts +++ b/src/strategies/passport/passport-otp/otp-strategy-factory.provider.ts @@ -32,7 +32,7 @@ export class PassportOtpStrategyFactoryProvider options, (key: string, otp: string, cb: Otp.VerifyCallback) => { verifyFn(key, otp) - .then((user) => { + .then(user => { if (!user) { throw new HttpErrors.Unauthorized( AuthErrorKeys.InvalidCredentials, @@ -40,7 +40,7 @@ export class PassportOtpStrategyFactoryProvider } cb(null, user); }) - .catch((err) => { + .catch(err => { cb(err); }); }, diff --git a/src/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.ts b/src/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.ts index 2873027..c06d832 100644 --- a/src/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.ts +++ b/src/strategies/passport/passport-resource-owner-password/resource-owner-strategy-factory-provider.ts @@ -62,13 +62,13 @@ export class ResourceOwnerPasswordStrategyFactoryProvider ) => void, ) => { verifyFn(clientId, clientSecret, username, password, req) - .then((userInfo) => { + .then(userInfo => { if (!userInfo || isEmpty(userInfo)) { throw new HttpErrors.Unauthorized(AuthErrorKeys.InvalidCredentials); } cb(null, userInfo.client, userInfo.user); }) - .catch((err) => { + .catch(err => { cb(err); }); }; @@ -89,13 +89,13 @@ export class ResourceOwnerPasswordStrategyFactoryProvider ) => void, ) => { verifyFn(clientId, clientSecret, username, password) - .then((userInfo) => { + .then(userInfo => { if (!userInfo || isEmpty(userInfo)) { throw new HttpErrors.Unauthorized(AuthErrorKeys.InvalidCredentials); } cb(null, userInfo.client, userInfo.user); }) - .catch((err) => { + .catch(err => { cb(err); }); }; diff --git a/src/strategies/types/types.ts b/src/strategies/types/types.ts index 4fe38f7..4753b68 100644 --- a/src/strategies/types/types.ts +++ b/src/strategies/types/types.ts @@ -138,5 +138,5 @@ export namespace VerifyFunction { ): Promise; } // eslint-disable-next-line @typescript-eslint/no-explicit-any - export type GenericAuthFn = (...params: any) => Promise; + export type GenericAuthFn = (...params: any) => Promise; // NOSONAR } diff --git a/vendor/passport-apple/src/strategy.js b/vendor/passport-apple/src/strategy.js index c9bcfea..f632e31 100644 --- a/vendor/passport-apple/src/strategy.js +++ b/vendor/passport-apple/src/strategy.js @@ -77,7 +77,7 @@ function Strategy(options, verify) { // Generate the client_secret using the library _tokenGenerator .generate() - .then((client_secret) => { + .then(client_secret => { params = params || {}; const codeParam = params.grant_type === 'refresh_token' ? 'refresh_token' : 'code'; @@ -107,7 +107,7 @@ function Strategy(options, verify) { }, ); }) - .catch((error) => { + .catch(error => { callback(error); }); }; diff --git a/vendor/passport-apple/src/token.js b/vendor/passport-apple/src/token.js index dec729a..46ff691 100644 --- a/vendor/passport-apple/src/token.js +++ b/vendor/passport-apple/src/token.js @@ -88,10 +88,10 @@ class AppleClientSecret { exp, this._config.key_id, ) - .then((token) => { + .then(token => { resolve(token); }) - .catch((err) => { + .catch(err => { reject(err); }); });