Skip to content

Commit

Permalink
Make code changes according to the linter's suggestions. (#26)
Browse files Browse the repository at this point in the history
* Apply linter fix to all TS files

* Added  script to run linter on save
  • Loading branch information
nandan-bhat authored Jan 16, 2025
1 parent cd8101c commit 41086b4
Show file tree
Hide file tree
Showing 62 changed files with 659 additions and 275 deletions.
370 changes: 370 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/auth0-acul-js/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"@typescript-eslint/explicit-function-return-type": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-misused-promises": "error",
// TODO: enable all the following "off"
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/strict-boolean-expressions": "error",
"@typescript-eslint/no-unsafe-member-access": "error",
Expand All @@ -42,7 +41,8 @@
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal"],
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"],
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
Expand Down
2 changes: 1 addition & 1 deletion packages/auth0-acul-js/interfaces/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export interface CustomOptions {
[key: string]: string | number | boolean;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export type { OrganizationMembers } from '../models/organization';
export type { ScreenMembers } from '../models/screen';
export type { TenantMembers } from '../models/tenant';
export type { TransactionMembers } from '../models/transaction';
export type { UntrustedDataMembers } from '../models/untrusted-data';
export type { UntrustedDataMembers } from '../models/untrusted-data';
6 changes: 0 additions & 6 deletions packages/auth0-acul-js/interfaces/export/common.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
export type { CaptchaContext } from '../models/screen';
export type { Connection, EnterpriseConnection, PasswordPolicy, UsernamePolicy, Error } from '../models/transaction';
export type { BrandingSettings, BrandingThemes } from '../models/branding';






7 changes: 5 additions & 2 deletions packages/auth0-acul-js/interfaces/export/extended-types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
export type { ScreenMembersOnLoginId, TransactionMembersOnLoginId } from '../screens/login-id';
export type { ScreenMembersOnLoginPassword, TransactionMembersOnLoginPassword } from '../screens/login-password';
export type { ScreenMembersOnLoginPasswordlessEmailCode, TransactionMembersOnLoginPasswordlessEmailCode } from '../screens/login-passwordless-email-code';
export type {
ScreenMembersOnLoginPasswordlessEmailCode,
TransactionMembersOnLoginPasswordlessEmailCode,
} from '../screens/login-passwordless-email-code';
export type { ScreenMembersOnLoginPasswordlessSmsOtp, TransactionMembersOnLoginPasswordlessSmsOtp } from '../screens/login-passwordless-sms-otp';
export type { ScreenMembersOnPasskeyEnrollment } from '../screens/passkey-enrollment';
export type { ScreenMembersOnPasskeyEnrollmentLocal } from '../screens/passkey-enrollment-local';
export type { ScreenMembersOnEmailIdentifierChallenge } from '../screens/email-identifier-challenge';
export type { ScreenMembersOnPhoneIdentifierChallenge } from '../screens/phone-identifier-challenge';
export type { ScreenMembersOnPhoneIdentifierEnrollment } from '../screens/phone-identifier-enrollment';
export type { ScreenMembersOnSignupId, TransactionMembersOnSignupId } from '../screens/signup-id';
export type { ScreenMembersOnSignupPassword, TransactionMembersOnSignupPassword} from '../screens/signup-password';
export type { ScreenMembersOnSignupPassword, TransactionMembersOnSignupPassword } from '../screens/signup-password';
2 changes: 1 addition & 1 deletion packages/auth0-acul-js/interfaces/export/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export type { PhoneChallengeOptions } from '../screens/phone-identifier-challeng
export type { PhoneEnrollmentOptions } from '../screens/phone-identifier-enrollment';
export type { SignupOptions, SocialSignupOptions } from '../screens/signup-id';
export type { SignupPasswordOptions } from '../screens/signup-password';
export type { CustomOptions } from '../common';
export type { CustomOptions } from '../common';
2 changes: 1 addition & 1 deletion packages/auth0-acul-js/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * as Base from './export/base-properties';
export * as Screen from './export/screen-properties';
export * as Payload from './export/options';
export * as Extended from './export/extended-types';
export * as Common from './export/common';
export * as Common from './export/common';
37 changes: 20 additions & 17 deletions packages/auth0-acul-js/interfaces/models/branding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ export interface BrandingContext {
settings?: {
colors?: {
primary?: string;
page_background?: string | {
type: string;
start: string;
end: string;
angle_deg: number;
};
page_background?:
| string
| {
type: string;
start: string;
end: string;
angle_deg: number;
};
};
favicon_url?: string;
logo_url?: string;
Expand All @@ -25,24 +27,26 @@ export interface BrandingContext {
widget: Record<string, string | number>;
};
};
};
}

export interface BrandingSettings {
colors?: {
primary?: string;
pageBackground?: string | {
type: string;
start: string;
end: string;
angleDeg: number;
};
pageBackground?:
| string
| {
type: string;
start: string;
end: string;
angleDeg: number;
};
};
faviconUrl?: string;
logoUrl?: string;
fontUrl?: string;
};
}

export interface BrandingThemes{
export interface BrandingThemes {
default: {
borders: Record<string, string | boolean | number>;
colors: Record<string, string>;
Expand All @@ -51,8 +55,7 @@ export interface BrandingThemes{
pageBackground: Record<string, string>;
widget: Record<string, string | number>;
};
};

}

/* @namespace Client */
export interface BrandingMembers {
Expand Down
16 changes: 7 additions & 9 deletions packages/auth0-acul-js/interfaces/models/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ export interface OrganizationMembers {
name: string | null;
usage: string | null;
displayName: string | null;
branding:
| {
logoUrl?: string | undefined;
colors?: {
primary?: string | undefined;
pageBackground?: string;
};
}
| null;
branding: {
logoUrl?: string | undefined;
colors?: {
primary?: string | undefined;
pageBackground?: string;
};
} | null;
metadata: { [key: string]: string } | null;
}
22 changes: 12 additions & 10 deletions packages/auth0-acul-js/interfaces/models/screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ export interface CaptchaContext {
provider: string;
image?: string;
siteKey?: string;
};
}

export interface PasskeyRead {
public_key: {
challenge: string;
};
};
}

export interface PasskeyCreate {
public_key: {
Expand All @@ -22,16 +22,18 @@ export interface PasskeyCreate {
name: string;
};
challenge: string;
pubKeyCredParams: [{
type: string,
alg: number
}];
pubKeyCredParams: [
{
type: string;
alg: number;
},
];
authenticatorSelection: {
residentKey: string;
userVerification: string;
};
};
};
}

export interface ScreenData {
[key: string]: string | PasskeyRead | PasskeyCreate | undefined;
Expand All @@ -41,9 +43,9 @@ export interface ScreenContext {
name: string;
links?: Record<string, string>;
captcha?: CaptchaContext;
data?: ScreenData
data?: ScreenData;
texts?: Record<string, string>;
};
}

export interface ScreenMembers {
name: string;
Expand All @@ -55,4 +57,4 @@ export interface ScreenMembers {
links: Record<string, string> | null;
texts: Record<string, string> | null;
captcha: CaptchaContext | null;
}
}
28 changes: 15 additions & 13 deletions packages/auth0-acul-js/interfaces/models/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export interface Passkey {
enabled: boolean;
}

export interface PasskeyLogin extends Passkey{
export interface PasskeyLogin extends Passkey {
public_key: {
challenge: ArrayBuffer;
};
};
}

export interface PasskeyEnroll extends Passkey {
public_key: {
Expand All @@ -26,29 +26,31 @@ export interface PasskeyEnroll extends Passkey {
name: string;
};
challenge: ArrayBuffer;
pubKeyCredParams: [{
type: string,
alg: Number
}];
pubKeyCredParams: [
{
type: string;
alg: number;
},
];
authenticatorSelection: {
residentKey: string;
userVerification: string;
};
};
};
}

interface CountryCode {
code: string;
prefix: string;
};
}

export interface UsernamePolicy {
maxLength: number;
minLength: number;
allowedFormats: {
usernameInEmailFormat: boolean;
usernameInPhoneFormat: boolean;
}
};
}

export interface PasswordPolicy {
Expand Down Expand Up @@ -91,7 +93,7 @@ export interface DBConnection extends Connection {
};
};
};
};
}

export interface PasswordlessConnection extends Connection {
options: {
Expand All @@ -105,15 +107,15 @@ export interface EnterpriseConnectionContext extends Connection {
display_name?: string;
show_as_button: boolean;
};
};
}

export interface EnterpriseConnection extends Connection {
options: {
iconUrl?: string;
displayName?: string;
showAsButton: boolean;
};
};
}

export interface SocialConnection extends Connection {}

Expand All @@ -128,7 +130,7 @@ export interface TransactionContext {
locale: string;
errors?: Error[];
country_code?: CountryCode;
connection: DBConnection | PasswordlessConnection;
connection?: DBConnection | PasswordlessConnection;
alternate_connections?: (Connection | EnterpriseConnectionContext)[];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/auth0-acul-js/interfaces/models/untrusted-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface UntrustedDataContext {
}

export interface UntrustedDataMembers {
submittedFormData: { [key: string]: any } | null;
submittedFormData: { [key: string]: string | number | boolean | undefined } | null;
authorizationParams: {
login_hint?: string;
screen_hint?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CustomOptions } from '../common';
import type { CustomOptions } from '../common';
import type { BaseMembers } from '../models/base-context';
import { ScreenMembers } from '../models/screen';
import type { ScreenMembers } from '../models/screen';

export interface EmailChallengeOptions {
code: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/auth0-acul-js/interfaces/screens/login-id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomOptions } from '../common';
import type { CustomOptions } from '../common';
import type { BaseContext, BaseMembers } from '../models/base-context';
import type { ScreenContext, ScreenMembers, PasskeyRead } from '../models/screen';
import type { TransactionMembers, UsernamePolicy } from '../models/transaction';
Expand All @@ -12,7 +12,7 @@ export interface ExtendedScreenContext extends ScreenContext {

data?: {
passkey?: PasskeyRead;
}
};
}

export interface ExtendedUntrustedDataContext extends UntrustedDataContext {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { CustomOptions } from '../common';
import type { TransactionMembers } from '../../interfaces/models';
import type { BaseMembers } from '../../interfaces/models/base-context';
import type { ScreenMembers } from '../../interfaces/models/screen';
import { BaseMembers } from '../../interfaces/models/base-context';
import { TransactionMembers } from '../../interfaces/models';

import type { CustomOptions } from '../common';

export interface ScreenMembersOnLoginPasswordlessEmailCode extends ScreenMembers {
editIdentifierLink: string | null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CustomOptions } from '../common';
import type { TransactionMembers } from '../../interfaces/models/transaction';
import type { CustomOptions } from '../common';
import type { ScreenMembers, ScreenContext } from '../models/screen';
import { TransactionMembers } from '../../interfaces/models/transaction';

export interface ScreenContextOnLoginPasswordlessSmsOtp extends ScreenContext {
links: {
Expand All @@ -15,7 +15,7 @@ export interface ScreenMembersOnLoginPasswordlessSmsOtp extends ScreenMembers {
backLink: string | null;
data: {
username: string;
}
};
}

export interface TransactionMembersOnLoginPasswordlessSmsOtp extends TransactionMembers {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CustomOptions } from '../common';
import type { CustomOptions } from '../common';
import type { BaseContext, BaseMembers } from '../models/base-context';
import type { ScreenContext, PasskeyCreate, ScreenMembers } from '../models/screen';

Expand All @@ -9,7 +9,7 @@ export interface ExtendedScreenContext extends ScreenContext {

payload: {
passkeys: PasskeyCreate;
}
};
}

export interface PasskeyEnrollmentLocal extends BaseContext {
Expand All @@ -29,4 +29,4 @@ export interface PasskeyEnrollmentLocalMembers extends BaseMembers {
screen: ScreenMembersOnPasskeyEnrollmentLocal;
continuePasskeyEnrollment(payload?: CustomOptions): Promise<void>;
abortPasskeyEnrollment(payload: AbortEnrollmentOptions): Promise<void>;
}
}
Loading

0 comments on commit 41086b4

Please sign in to comment.