0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore: upgrade configs (#4132)

* chore: upgrade configs

* chore: fix lint errors
This commit is contained in:
Gao Sun 2023-07-08 01:17:21 +08:00 committed by GitHub
parent cabbd6ffe8
commit 947de83173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 845 additions and 795 deletions

View file

@ -33,18 +33,18 @@
"prepack": "pnpm build"
},
"devDependencies": {
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config-react": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config-react": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/eslint-config-react": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@silverhand/ts-config-react": "4.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/react": "^18.0.31",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"history": "^5.3.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"react": "^18.0.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0"

View file

@ -73,8 +73,8 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/inquirer": "^9.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
@ -82,10 +82,10 @@
"@types/sinon": "^10.0.13",
"@types/tar": "^6.1.2",
"@types/yargs": "^17.0.13",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"sinon": "^15.0.0",
"typescript": "^5.0.0"
},

View file

@ -155,9 +155,9 @@ export const addConnectorsToPath = async (cwd: string, packageNames: string[]) =
}
const { filename, name, version } = result[0];
const escapedFilename = filename.replace(/\//g, '-').replace(/@/g, '');
const escapedFilename = filename.replaceAll('/', '-').replaceAll('@', '');
const tarPath = path.join(cwd, escapedFilename);
const packageDirectory = path.join(cwd, name.replace(/\//g, '-'));
const packageDirectory = path.join(cwd, name.replaceAll('/', '-'));
await fs.rm(packageDirectory, { force: true, recursive: true });
await fs.mkdir(packageDirectory, { recursive: true });

View file

@ -25,7 +25,7 @@ const importAlterationScript = async (filePath: string): Promise<AlterationScrip
export const getLatestAlterationTimestamp = async () => {
const files = await getAlterationFiles();
const lastFile = files[files.length - 1];
const lastFile = files.at(-1);
if (!lastFile) {
return 0;

View file

@ -92,7 +92,7 @@ export const validateDatabase = async () => {
const pgOutput = safeExecSync('postgres --version') ?? '';
// Filter out all brackets in the output since Homebrew will append `(Homebrew)`.
const pgArray = pgOutput.split(' ').filter((value) => !value.startsWith('('));
const pgCurrent = semver.coerce(pgArray[pgArray.length - 1]);
const pgCurrent = semver.coerce(pgArray.at(-1));
return !pgCurrent || pgCurrent.compare(pgRequired) < 0;
},

View file

@ -53,7 +53,7 @@ const sendMessage =
Subject: template.subject,
HtmlBody:
typeof payload.code === 'string'
? template.content.replace(/{{code}}/g, payload.code)
? template.content.replaceAll('{{code}}', payload.code)
: template.content,
},
accessKeySecret

View file

@ -8,13 +8,13 @@ import type { PublicParameters } from './types.js';
// https://help.aliyun.com/document_detail/29442.html
const escaper = (string_: string) =>
encodeURIComponent(string_)
.replace(/!/g, '%21')
.replace(/"/g, '%22')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/\+/g, '%2B');
.replaceAll('!', '%21')
.replaceAll('"', '%22')
.replaceAll("'", '%27')
.replaceAll('(', '%28')
.replaceAll(')', '%29')
.replaceAll('*', '%2A')
.replaceAll('+', '%2B');
// Format date string to 'YYYY-MM-DDThh:mm:ssZ' format.
const formatDateString = (date: Date) => {

View file

@ -7,13 +7,13 @@ import type { PublicParameters } from './types.js';
// https://help.aliyun.com/document_detail/29442.html
const escaper = (string_: string) =>
encodeURIComponent(string_)
.replace(/!/g, '%21')
.replace(/"/g, '%22')
.replace(/'/g, '%27')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/\*/g, '%2A')
.replace(/\+/g, '%2B');
.replaceAll('!', '%21')
.replaceAll('"', '%22')
.replaceAll("'", '%27')
.replaceAll('(', '%28')
.replaceAll(')', '%29')
.replaceAll('*', '%2A')
.replaceAll('+', '%2B');
// Format date string to 'YYYY-MM-DDThh:mm:ssZ' format.
const formatDateString = (date: Date) => {

View file

@ -25,7 +25,7 @@ export const makeEmailContent = (template: Template, payload: Payload): EmailCon
Html: {
Data:
typeof payload.code === 'string'
? template.content.replace(/{{code}}/g, payload.code)
? template.content.replaceAll('{{code}}', payload.code)
: template.content,
},
},

View file

@ -50,7 +50,7 @@ const sendMessage =
type: template.type,
value:
typeof payload.code === 'string'
? template.content.replace(/{{code}}/g, payload.code)
? template.content.replaceAll('{{code}}', payload.code)
: template.content,
};
const { subject } = template;

View file

@ -40,7 +40,7 @@ function sendMessage(getConfig: GetConnectorConfig): SendMessageFunction {
const parameters: PublicParameters = {
number: to,
sign: senderName,
text: template.content.replace(/{{code}}/g, payload.code),
text: template.content.replaceAll('{{code}}', payload.code),
};
const auth = Buffer.from(`${email}:${apiKey}`).toString('base64');

View file

@ -41,7 +41,7 @@ const sendMessage =
const contentsObject = parseContents(
typeof payload.code === 'string'
? template.content.replace(/{{\s*code\s*}}/g, payload.code)
? template.content.replaceAll(/{{\s*code\s*}}/g, payload.code)
: template.content,
template.contentType
);
@ -50,7 +50,7 @@ const sendMessage =
to,
from: config.fromEmail,
replyTo: config.replyTo,
subject: template.subject.replace(/{{\s*code\s*}}/g, payload.code),
subject: template.subject.replaceAll(/{{\s*code\s*}}/g, payload.code),
...contentsObject,
};

View file

@ -40,12 +40,12 @@ const sendMessage =
MessagingServiceSid: fromMessagingServiceSID,
Body:
typeof payload.code === 'string'
? template.content.replace(/{{code}}/g, payload.code)
? template.content.replaceAll('{{code}}', payload.code)
: template.content,
};
try {
return await got.post(endpoint.replace(/{{accountSID}}/g, accountSID), {
return await got.post(endpoint.replaceAll('{{accountSID}}', accountSID), {
headers: {
Authorization:
'Basic ' + Buffer.from([accountSID, authToken].join(':')).toString('base64'),

View file

@ -34,17 +34,17 @@
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^11.0.0",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/supertest": "^2.0.11",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"jest-matcher-specific-error": "^1.0.0",
"lint-staged": "^13.0.0",
"nock": "^13.2.2",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"rollup": "^3.8.0",
"rollup-plugin-summary": "^2.0.0",
"supertest": "^6.2.2",

View file

@ -42,11 +42,11 @@
"@parcel/transformer-mdx": "2.9.3",
"@parcel/transformer-sass": "2.9.3",
"@parcel/transformer-svg-react": "2.9.3",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config-react": "3.0.1",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/eslint-config-react": "4.0.1",
"@silverhand/essentials": "^2.5.0",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config-react": "3.0.0",
"@silverhand/ts-config": "4.0.0",
"@silverhand/ts-config-react": "4.0.0",
"@swc/core": "^1.3.52",
"@swc/jest": "^0.2.26",
"@testing-library/react": "^14.0.0",
@ -71,7 +71,7 @@
"deep-object-diff": "^1.1.9",
"deepmerge": "^4.2.2",
"dnd-core": "^16.0.0",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"history": "^5.3.0",
"i18next": "^22.4.15",
"i18next-browser-languagedetector": "^7.0.1",
@ -90,7 +90,7 @@
"parcel": "2.9.3",
"postcss": "^8.4.6",
"postcss-modules": "^4.3.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"process": "^0.11.10",
"prop-types": "^15.8.1",
"react": "^18.0.0",

View file

@ -18,7 +18,7 @@ type CreateButtonProps = {
type Props<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
title: CardTitleProps;
pageMeta?: PageMetaProps;
@ -31,7 +31,7 @@ type Props<
function ListPage<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
title,
pageMeta,

View file

@ -33,8 +33,8 @@ function Markdown({ className, children }: Props) {
const initialKebabCaseString = text
// Remove all symbols and punctuations except for dash and underscore. https://javascript.info/regexp-unicode
.replace(/\p{S}|\p{Pi}|\p{Pf}|\p{Ps}|\p{Pe}|\p{Po}/gu, '')
.replace(/\s+/g, '-')
.replaceAll(/\p{S}|\p{Pi}|\p{Pf}|\p{Ps}|\p{Pe}|\p{Po}/gu, '')
.replaceAll(/\s+/g, '-')
.toLowerCase();
return resolveIdCollision(initialKebabCaseString);

View file

@ -99,7 +99,7 @@ function UserAccountInformation({
<div className={styles.infoLine}>
<div>{passwordLabel ?? t('user_details.created_password')}</div>
<div className={styles.infoContent}>
{passwordVisible ? password : password.replace(/./g, '*')}
{passwordVisible ? password : password.replaceAll(/./g, '*')}
</div>
<div className={styles.operation}>
<IconButton

View file

@ -29,7 +29,7 @@ function AppDataProvider({ children }: Props) {
() =>
({
userEndpoint,
} satisfies AppData),
}) satisfies AppData,
[userEndpoint]
);

View file

@ -17,7 +17,7 @@ import type { Column, RowGroup } from './types';
export type Props<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
> = {
rowGroups: Array<RowGroup<TFieldValues>>;
columns: Array<Column<TFieldValues>>;
@ -39,7 +39,7 @@ export type Props<
function Table<
TFieldValues extends FieldValues = FieldValues,
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
>({
rowGroups,
columns,

View file

@ -13,7 +13,10 @@ import { TenantsContext } from '@/contexts/TenantsProvider';
import { useConfirmModal } from './use-confirm-modal';
export class RequestError extends Error {
constructor(public readonly status: number, public readonly body?: RequestErrorBody) {
constructor(
public readonly status: number,
public readonly body?: RequestErrorBody
) {
super('Request error occurred.');
}
}

View file

@ -8,7 +8,7 @@ type UseSearchParametersWatcherReturn<T extends Parameters = Parameters> = [
{
[K in keyof T]: T[K];
},
(parameters: Partial<T>) => void
(parameters: Partial<T>) => void,
];
/**

View file

@ -58,10 +58,7 @@ function Tabs({ className, children }: Props): JSX.Element {
case 'ArrowLeft': {
const previousTab = tabReferences.current.indexOf(event.currentTarget) - 1;
// eslint-disable-next-line @silverhand/fp/no-mutation
focusElement =
tabReferences.current[previousTab] ??
tabReferences.current[tabReferences.current.length - 1] ??
null;
focusElement = tabReferences.current[previousTab] ?? tabReferences.current.at(-1) ?? null;
break;
}

View file

@ -7,7 +7,7 @@ export const reservationLink = buildUrl('https://calendly.com/logto/30min', {
});
export const emailUsLink = buildUrl(contactEmailLink, {
subject: 'Cloud pricing and special offer',
}).replace(/\+/g, '%20');
}).replaceAll('+', '%20');
export const aboutCloudPreviewLink = 'https://docs.logto.io/about/cloud-preview?utm_source=console';

View file

@ -4,7 +4,7 @@ import { ConnectorType } from '@logto/schemas';
import type { ConnectorGroup } from '@/types/connector';
export const getConnectorGroups = <
T extends ConnectorResponse | ConnectorFactoryResponse = ConnectorResponse
T extends ConnectorResponse | ConnectorFactoryResponse = ConnectorResponse,
>(
connectors: T[]
) => {

View file

@ -1,2 +1,2 @@
export const formatNumberWithComma = (value: number): string =>
value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
value.toString().replaceAll(/\B(?=(\d{3})+(?!\d))/g, ',');

View file

@ -82,8 +82,8 @@
},
"devDependencies": {
"@logto/cloud": "0.2.5-1a68662",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/debug": "^4.1.7",
"@types/etag": "^1.8.1",
"@types/jest": "^29.4.0",
@ -100,7 +100,7 @@
"@types/sinon": "^10.0.13",
"@types/supertest": "^2.0.11",
"copyfiles": "^2.4.1",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"jest-matcher-specific-error": "^1.0.0",
"lint-staged": "^13.0.0",
@ -108,7 +108,7 @@
"node-mocks-http": "^1.12.1",
"nodemon": "^2.0.19",
"openapi-types": "^12.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"sinon": "^15.0.0",
"supertest": "^6.2.2",
"typescript": "^5.0.0"

View file

@ -30,7 +30,7 @@ type WellKnownCacheType = keyof WellKnownMap;
type CacheKeyConfig<
Args extends unknown[],
Type = WellKnownCacheType,
CacheKey = (...args: Args) => string
CacheKey = (...args: Args) => string,
> = [Type] | [Type, CacheKey];
// Cannot use generic type here, but direct type works.
@ -76,7 +76,10 @@ export class WellKnownCache {
* @param tenantId The tenant ID this cache is intended for.
* @param cacheStore The storage to use as the cache.
*/
constructor(public tenantId: string, protected cacheStore: CacheStore) {}
constructor(
public tenantId: string,
protected cacheStore: CacheStore
) {}
/**
* Get value from the inner cache store for the given type and key.

View file

@ -68,9 +68,9 @@ export const buildInsertIntoWithPool =
rows: [entry],
} = await pool.query<Schema>(sql`
insert into ${table} (${sql.join(
insertingKeys.map((key) => fields[key]),
sql`, `
)})
insertingKeys.map((key) => fields[key]),
sql`, `
)})
values (${sql.join(
insertingKeys.map((key) => convertToPrimitiveOrSql(key, data[key] ?? null)),
sql`, `

View file

@ -42,7 +42,10 @@ export class EnvSet {
#pool: Optional<DatabasePool>;
#oidc: Optional<Awaited<ReturnType<typeof loadOidcValues>>>;
constructor(public readonly tenantId: string, public readonly databaseUrl: string) {}
constructor(
public readonly tenantId: string,
public readonly databaseUrl: string
) {}
get pool() {
if (!this.#pool) {

View file

@ -10,7 +10,10 @@ export default class ServerError extends Error {
}
export class StatusCodeError extends ServerError {
constructor(public readonly expect: number | number[], public readonly received: number) {
constructor(
public readonly expect: number | number[],
public readonly received: number
) {
super(
`Guard response status failed: Expected ${
Array.isArray(expect) ? expect.join(', ') : expect

View file

@ -3,14 +3,17 @@ import type { OmitAutoSetFields, UpdateWhereData } from '@logto/shared';
import { SlonikError } from 'slonik';
export class DeletionError extends SlonikError {
public constructor(public readonly table?: string, public readonly id?: string) {
public constructor(
public readonly table?: string,
public readonly id?: string
) {
super('Resource not found.');
}
}
export class UpdateError<
CreateSchema extends SchemaLike,
Schema extends CreateSchema
Schema extends CreateSchema,
> extends SlonikError {
public constructor(
public readonly schema: GeneratedSchema<CreateSchema, Schema>,
@ -22,7 +25,7 @@ export class UpdateError<
export class InsertionError<
CreateSchema extends SchemaLike,
Schema extends CreateSchema
Schema extends CreateSchema,
> extends SlonikError {
public constructor(
public readonly schema: GeneratedSchema<CreateSchema, Schema>,

View file

@ -1,7 +1,7 @@
// Cannot import from "@silverhand/essentials" in this file.
// See https://www.karltarvas.com/2021/03/11/typescript-array-filter-boolean.html
type Falsy = false | 0 | '' | undefined | undefined;
type Falsy = false | 0 | '' | undefined;
interface Array<T> {
filter<S extends T>(predicate: BooleanConstructor, thisArg?: unknown): Array<Exclude<S, Falsy>>;

View file

@ -5,7 +5,7 @@ declare module 'koa-body' {
declare function koaBody<
StateT = Record<string, unknown>,
ContextT = Record<string, unknown>,
ResponseBodyT = unknown
ResponseBodyT = unknown,
>(options?: IKoaBodyOptions): MiddlewareType<StateT, ContextT, ResponseBodyT>;
export = koaBody;

View file

@ -67,7 +67,7 @@ declare module 'koa-router' {
export type RouterContext<
StateT = unknown,
CustomT = Record<string, unknown>
CustomT = Record<string, unknown>,
> = Koa.ParameterizedContext<StateT, CustomT & IRouterParamContext<StateT, CustomT>>;
// For backward compatibility IRouterContext needs to be an interface

View file

@ -8,7 +8,7 @@ declare module 'koa' {
StateT = DefaultState,
ContextT = DefaultContext,
ResponseBodyT = unknown,
NextT = void
NextT = void,
> = KoaMiddleware<ParameterizedContext<StateT, ContextT, ResponseBodyT>, NextT>;
interface Request extends BaseRequest {

View file

@ -9,7 +9,7 @@ import type Queries from '#src/tenants/Queries.js';
export default function koaConsoleRedirectProxy<
StateT,
ContextT extends IRouterParamContext,
ResponseBodyT
ResponseBodyT,
>(queries: Queries): MiddlewareType<StateT, ContextT, ResponseBodyT> {
const { hasActiveUsers } = queries.users;

View file

@ -68,7 +68,7 @@ export type WithGuardedRequestContext<
GuardQueryT,
GuardBodyT,
GuardParametersT,
GuardFilesT
GuardFilesT,
> = ContextT & {
guard: GuardedRequest<GuardQueryT, GuardBodyT, GuardParametersT, GuardFilesT>;
};
@ -79,7 +79,7 @@ export type WithGuardConfig<
GuardBodyT = unknown,
GuardParametersT = unknown,
GuardResponseT = unknown,
GuardFilesT = undefined
GuardFilesT = undefined,
> = Type & {
config: GuardConfig<GuardQueryT, GuardBodyT, GuardParametersT, GuardResponseT, GuardFilesT>;
};
@ -108,7 +108,7 @@ export default function koaGuard<
GuardBodyT = undefined,
GuardParametersT = undefined,
GuardResponseT = unknown,
GuardFilesT = undefined
GuardFilesT = undefined,
>({
query,
body,

View file

@ -23,7 +23,7 @@ export type WithI18nContext<ContextT extends IRouterParamContext = IRouterParamC
export default function koaI18next<
StateT,
ContextT extends IRouterParamContext,
ResponseBodyT
ResponseBodyT,
>(): MiddlewareType<StateT, WithI18nContext<ContextT>, ResponseBodyT> {
return async (ctx, next) => {
const languages = detectLanguage(ctx);

View file

@ -22,7 +22,7 @@ export const guardedPath = [
export default function koaSpaSessionGuard<
StateT,
ContextT extends IRouterParamContext,
ResponseBodyT
ResponseBodyT,
>(provider: Provider, queries: Queries): MiddlewareType<StateT, ContextT, ResponseBodyT> {
return async (ctx, next) => {
const requestPath = ctx.request.path;

View file

@ -23,8 +23,8 @@ export const createApplicationsRolesQueries = (pool: CommonQueryMethods) => {
const insertApplicationsRoles = async (applicationsRoles: CreateApplicationsRole[]) =>
pool.query(sql`
insert into ${table} (${insertFields.id}, ${insertFields.applicationId}, ${
insertFields.roleId
}) values
insertFields.roleId
}) values
${sql.join(
applicationsRoles.map(
({ id, applicationId, roleId }) => sql`(${id}, ${applicationId}, ${roleId})`

View file

@ -73,7 +73,7 @@ export const createOidcModelInstanceQueries = (pool: CommonQueryMethods) => {
const findPayloadByPayloadField = async <
T extends ValueExpression,
Field extends keyof OidcModelInstancePayload
Field extends keyof OidcModelInstancePayload,
>(
modelName: string,
field: Field,

View file

@ -24,7 +24,7 @@ const mockedQueries = {
password: false,
verify: false,
},
} as SignInExperience)
}) as SignInExperience
),
},
users: {

View file

@ -91,7 +91,7 @@ const getLatestUserProfileFromSocial = async (
{ getLogtoConnectorById }: ConnectorLibrary,
authIdentifiers: Identifier[]
) => {
const socialIdentifier = filterSocialIdentifiers(authIdentifiers).slice(-1)[0];
const socialIdentifier = filterSocialIdentifiers(authIdentifiers).at(-1);
if (!socialIdentifier) {
return;

View file

@ -3,7 +3,7 @@ import { type IRouterParamContext } from 'koa-router';
import type Provider from 'oidc-provider';
export type WithInteractionDetailsContext<
ContextT extends IRouterParamContext = IRouterParamContext
ContextT extends IRouterParamContext = IRouterParamContext,
> = ContextT & {
interactionDetails: Awaited<ReturnType<Provider['interactionDetails']>>;
};
@ -11,7 +11,7 @@ export type WithInteractionDetailsContext<
export default function koaInteractionDetails<
StateT,
ContextT extends IRouterParamContext,
ResponseT
ResponseT,
>(provider: Provider): MiddlewareType<StateT, WithInteractionDetailsContext<ContextT>, ResponseT> {
return async (ctx, next) => {
ctx.interactionDetails = await provider.interactionDetails(ctx.req, ctx.res);

View file

@ -15,7 +15,7 @@ import type { WithInteractionDetailsContext } from './koa-interaction-details.js
type AssignInteractionHookResult = (result: InteractionHookResult) => void;
export type WithInteractionHooksContext<
ContextT extends IRouterParamContext = IRouterParamContext
ContextT extends IRouterParamContext = IRouterParamContext,
> = ContextT & { assignInteractionHookResult: AssignInteractionHookResult };
/**
@ -26,7 +26,7 @@ export type WithInteractionHooksContext<
export default function koaInteractionHooks<
StateT,
ContextT extends WithInteractionDetailsContext,
ResponseT
ResponseT,
>({
hooks: { triggerInteractionHooks },
}: Libraries): MiddlewareType<StateT, WithInteractionHooksContext<ContextT>, ResponseT> {

View file

@ -26,21 +26,21 @@
"@logto/schemas": "workspace:^1.2.3",
"@parcel/core": "2.9.3",
"@parcel/transformer-sass": "2.9.3",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config-react": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config-react": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/eslint-config-react": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@silverhand/ts-config-react": "4.0.0",
"@types/react": "^18.0.31",
"@types/react-dom": "^18.0.0",
"buffer": "^5.7.1",
"cross-env": "^7.0.3",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"i18next": "^22.4.15",
"i18next-browser-languagedetector": "^7.0.1",
"lint-staged": "^13.0.0",
"parcel": "2.9.3",
"postcss": "^8.4.6",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-i18next": "^12.3.1",

View file

@ -27,22 +27,22 @@
"@logto/node": "^2.1.1",
"@logto/schemas": "workspace:^1.6.0",
"@logto/shared": "workspace:^2.0.0",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/essentials": "^2.5.0",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config": "4.0.0",
"@types/expect-puppeteer": "^5.0.3",
"@types/jest": "^29.4.0",
"@types/jest-environment-puppeteer": "^5.0.3",
"@types/node": "^18.11.18",
"dotenv": "^16.0.0",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"got": "^13.0.0",
"jest": "^29.5.0",
"jest-puppeteer": "^9.0.0",
"node-fetch": "^3.3.0",
"openapi-schema-validator": "^12.0.0",
"openapi-types": "^12.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"puppeteer": "^20.0.0",
"text-encoder": "^0.0.4",
"typescript": "^5.0.0"

View file

@ -40,12 +40,12 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"buffer": "^5.7.1",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"typescript": "^5.0.0"
},
"engines": {

View file

@ -40,11 +40,11 @@
"zod": "^3.20.2"
},
"devDependencies": {
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"eslint": "^8.34.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"eslint": "^8.44.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"typescript": "^5.0.0"
},
"eslintConfig": {

View file

@ -40,20 +40,20 @@
"node": "^18.12.0"
},
"devDependencies": {
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/essentials": "^2.5.0",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config": "4.0.0",
"@types/inquirer": "^9.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/pluralize": "^0.0.29",
"camelcase": "^7.0.0",
"chalk": "^5.0.0",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"pluralize": "^8.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"roarr": "^7.11.0",
"slonik": "^30.0.0",
"slonik-sql-tag-raw": "^1.1.4",

View file

@ -17,7 +17,7 @@ export type Guard<T extends Record<string, unknown>> = ZodObject<{
export type GeneratedSchema<
CreateSchema extends SchemaLike,
Schema extends CreateSchema
Schema extends CreateSchema,
> = keyof Schema extends string
? Readonly<{
table: string;

View file

@ -30,7 +30,7 @@ const constrainedKeywords = [
'references',
];
const getOutputFileName = (file: string) => pluralize(file.slice(0, -4).replace(/_/g, '-'), 1);
const getOutputFileName = (file: string) => pluralize(file.slice(0, -4).replaceAll('_', '-'), 1);
const generate = async () => {
const files = await fs.readdir(directory);

View file

@ -3,11 +3,12 @@ import { conditional, assert } from '@silverhand/essentials';
import type { Field } from './types.js';
export const normalizeWhitespaces = (string: string): string => string.replace(/\s+/g, ' ').trim();
export const normalizeWhitespaces = (string: string): string =>
string.replaceAll(/\s+/g, ' ').trim();
// Remove all comments not start with @
export const removeUnrecognizedComments = (string: string): string =>
string.replace(/\/\*(?!\s@)[^*]+\*\//g, '');
string.replaceAll(/\/\*(?!\s@)[^*]+\*\//g, '');
const getCountDelta = (value: string): number => {
if (value === '(') {

View file

@ -39,14 +39,14 @@
},
"devDependencies": {
"@logto/connector-kit": "workspace:^1.1.1",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"typescript": "^5.0.0"
},
"engines": {

View file

@ -44,14 +44,14 @@
},
"devDependencies": {
"@jest/types": "^29.0.3",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0"
},

View file

@ -52,19 +52,19 @@
},
"devDependencies": {
"@jest/types": "^29.0.3",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/essentials": "^2.5.0",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config-react": "3.0.0",
"@silverhand/ts-config": "4.0.0",
"@silverhand/ts-config-react": "4.0.0",
"@types/color": "^3.0.3",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"@types/react": "^18.0.31",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"postcss": "^8.4.6",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"stylelint": "^15.0.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0"

View file

@ -39,14 +39,14 @@
},
"devDependencies": {
"@jest/types": "^29.0.3",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/ts-config": "3.0.0",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/ts-config": "4.0.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.11.18",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"jest": "^29.5.0",
"lint-staged": "^13.0.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0"
},

View file

@ -35,11 +35,11 @@
"@parcel/transformer-svg-react": "2.9.3",
"@react-spring/shared": "^9.6.1",
"@react-spring/web": "^9.6.1",
"@silverhand/eslint-config": "3.0.1",
"@silverhand/eslint-config-react": "3.0.1",
"@silverhand/eslint-config": "4.0.1",
"@silverhand/eslint-config-react": "4.0.1",
"@silverhand/essentials": "^2.5.0",
"@silverhand/ts-config": "3.0.0",
"@silverhand/ts-config-react": "3.0.0",
"@silverhand/ts-config": "4.0.0",
"@silverhand/ts-config-react": "4.0.0",
"@swc/core": "^1.3.52",
"@swc/jest": "^0.2.26",
"@testing-library/react": "^14.0.0",
@ -54,7 +54,7 @@
"classnames": "^2.3.1",
"color": "^4.2.3",
"cross-env": "^7.0.3",
"eslint": "^8.34.0",
"eslint": "^8.44.0",
"i18next": "^22.4.15",
"i18next-browser-languagedetector": "^7.0.1",
"identity-obj-proxy": "^3.0.0",
@ -70,7 +70,7 @@
"parcel-resolver-ignore": "^2.1.3",
"postcss": "^8.4.6",
"postcss-modules": "^4.3.0",
"prettier": "^2.8.2",
"prettier": "^3.0.0",
"react": "^18.0.0",
"react-device-detect": "^2.2.2",
"react-dom": "^18.0.0",
@ -110,7 +110,8 @@
"eslintConfig": {
"extends": "@silverhand/react",
"rules": {
"jsx-a11y/no-autofocus": "off"
"jsx-a11y/no-autofocus": "off",
"unicorn/prefer-string-replace-all": "off"
}
},
"stylelint": {

View file

@ -7,7 +7,7 @@ import PageContextProvider from '@/Providers/PageContextProvider';
const renderWithPageContext = <
Q extends Queries = typeof queries,
Container extends Element | DocumentFragment = HTMLElement
Container extends Element | DocumentFragment = HTMLElement,
>(
ui: ReactElement,
memoryRouterProps: Parameters<typeof MemoryRouter>[0] = {},

File diff suppressed because it is too large Load diff