mirror of
https://github.com/logto-io/logto.git
synced 2025-03-31 22:51:25 -05:00
Merge pull request #205 from logto-io/charles-upgrade-eslint-config-to-0.6.1
chore: upgrade eslint-config to v0.6.1
This commit is contained in:
commit
6a6ae9d7d5
46 changed files with 115 additions and 37 deletions
|
@ -48,8 +48,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@shopify/jest-koa-mocks": "^3.0.8",
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@silverhand/eslint-config": "^0.6.1",
|
||||
"@silverhand/ts-config": "^0.6.1",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/koa": "^2.13.3",
|
||||
"@types/koa-logger": "^3.1.1",
|
||||
|
|
|
@ -25,6 +25,7 @@ export default async function initApp(app: Koa): Promise<void> {
|
|||
app.use(koaUIProxy());
|
||||
|
||||
const { HTTPS_CERT, HTTPS_KEY } = process.env;
|
||||
|
||||
if (HTTPS_CERT && HTTPS_KEY) {
|
||||
https
|
||||
.createServer(
|
||||
|
@ -34,6 +35,7 @@ export default async function initApp(app: Koa): Promise<void> {
|
|||
.listen(port, () => {
|
||||
console.log(`App is listening on port ${port} with HTTPS`);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ export const validateConfig: ValidateConfig = async (config: unknown) => {
|
|||
}
|
||||
|
||||
const result = configGuard.safeParse(config);
|
||||
|
||||
if (!result.success) {
|
||||
throw new ConnectorConfigError(result.error.message);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ export const validateConfig: ValidateConfig = async (config: unknown) => {
|
|||
}
|
||||
|
||||
const result = githubConfigGuard.safeParse(config);
|
||||
|
||||
if (!result.success) {
|
||||
throw new ConnectorConfigError(result.error.message);
|
||||
}
|
||||
|
@ -48,6 +49,7 @@ export const validateConfig: ValidateConfig = async (config: unknown) => {
|
|||
|
||||
export const getAuthorizationUri: GetAuthorizationUri = async (redirectUri, state) => {
|
||||
const config = await getConnectorConfig<GithubConfig>(metadata.id);
|
||||
|
||||
return `${authorizationEndpoint}?${stringify({
|
||||
client_id: config.clientId,
|
||||
redirect_uri: redirectUri,
|
||||
|
@ -75,6 +77,7 @@ export const getAccessToken: GetAccessToken = async (code) => {
|
|||
},
|
||||
})
|
||||
.json<AccessTokenResponse>();
|
||||
|
||||
return accessToken;
|
||||
};
|
||||
|
||||
|
@ -98,6 +101,7 @@ export const getUserInfo: GetUserInfo = async (accessToken: string) => {
|
|||
},
|
||||
})
|
||||
.json<UserInfoResponse>();
|
||||
|
||||
return {
|
||||
id: String(id),
|
||||
avatar,
|
||||
|
|
|
@ -11,6 +11,7 @@ export const getConnectorInstances = async (): Promise<ConnectorInstance[]> => {
|
|||
return Promise.all(
|
||||
allConnectors.map(async (element) => {
|
||||
const connector = await findConnectorById(element.metadata.id);
|
||||
|
||||
return { connector, ...element };
|
||||
})
|
||||
);
|
||||
|
@ -18,6 +19,7 @@ export const getConnectorInstances = async (): Promise<ConnectorInstance[]> => {
|
|||
|
||||
export const getConnectorInstanceById = async (id: string): Promise<ConnectorInstance> => {
|
||||
const found = allConnectors.find((element) => element.metadata.id === id);
|
||||
|
||||
if (!found) {
|
||||
throw new RequestError({
|
||||
code: 'entity.not_found',
|
||||
|
@ -27,6 +29,7 @@ export const getConnectorInstanceById = async (id: string): Promise<ConnectorIns
|
|||
}
|
||||
|
||||
const connector = await findConnectorById(id);
|
||||
|
||||
return { connector, ...found };
|
||||
};
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ export const getSignature = (
|
|||
.sort()
|
||||
.map((key) => {
|
||||
const value = parameters[key];
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
throw new ConnectorError('Invalid value');
|
||||
}
|
||||
|
@ -36,6 +37,7 @@ export const getSignature = (
|
|||
.join('&');
|
||||
|
||||
const stringToSign = `${method.toUpperCase()}&${escaper('/')}&${escaper(canonicalizedQuery)}`;
|
||||
|
||||
return createHmac('sha1', `${secret}&`).update(stringToSign).digest('base64');
|
||||
};
|
||||
|
||||
|
@ -72,9 +74,11 @@ export const request = async <T>(
|
|||
const signature = getSignature(finalParameters, accessKeySecret, 'POST');
|
||||
|
||||
const payload = new URLSearchParams();
|
||||
|
||||
for (const key in finalParameters) {
|
||||
if (has(finalParameters, key)) {
|
||||
const value = finalParameters[key];
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
throw new ConnectorError('Invalid value');
|
||||
}
|
||||
|
@ -84,6 +88,7 @@ export const request = async <T>(
|
|||
}
|
||||
|
||||
payload.append('Signature', signature);
|
||||
|
||||
return got.post<T>({
|
||||
url,
|
||||
headers: {
|
||||
|
|
|
@ -5,6 +5,7 @@ import { findConnectorById, updateConnector } from '@/queries/connector';
|
|||
|
||||
export const getConnectorConfig = async <T extends ConnectorConfig>(id: string): Promise<T> => {
|
||||
const connector = await findConnectorById(id);
|
||||
|
||||
if (!connector) {
|
||||
throw new RequestError({
|
||||
code: 'entity.not_exists_with_id',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable sql/no-unsafe-query */
|
||||
import { CreateUser, Users } from '@logto/schemas';
|
||||
import decamelize from 'decamelize';
|
||||
|
||||
|
@ -9,6 +8,7 @@ import { buildInsertInto } from './insert-into';
|
|||
import { convertToIdentifiers } from './utils';
|
||||
|
||||
const buildExpectedInsertIntoSql = (keys: string[]) => [
|
||||
// eslint-disable-next-line sql/no-unsafe-query
|
||||
`insert into "users" (${keys.map((key) => `"${decamelize(key)}"`).join(', ')})`,
|
||||
`values (${keys.map((_, index) => `$${index + 1}`).join(', ')})`,
|
||||
];
|
||||
|
|
|
@ -83,6 +83,7 @@ export const buildInsertInto: BuildInsertInto = <
|
|||
`);
|
||||
|
||||
assertThat(!returning || entry, 'entity.create_failed', { name: rest.tableSingular });
|
||||
|
||||
return entry;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -63,6 +63,7 @@ export const buildUpdateWhere: BuildUpdateWhere = <
|
|||
status: 404,
|
||||
})
|
||||
);
|
||||
|
||||
return data;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@ const resolveLanguage = (languageString: string): Optional<[string, number]> =>
|
|||
|
||||
for (const item of rest) {
|
||||
const [key, value] = item.split('=');
|
||||
|
||||
if (key === 'q' && !Number.isNaN(value)) {
|
||||
return [language, Number(value)];
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable import/first */
|
||||
import 'module-alias/register.js';
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
|
@ -6,10 +5,12 @@ import Koa from 'koa';
|
|||
|
||||
dotenv.config();
|
||||
|
||||
/* eslint-disable import/first */
|
||||
import initApp from './app/init';
|
||||
import { initConnectors } from './connectors';
|
||||
import { trustingTlsOffloadingProxies } from './env/consts';
|
||||
import initI18n from './i18n/init';
|
||||
/* eslint-enable import/first */
|
||||
|
||||
const app = new Koa({
|
||||
proxy: trustingTlsOffloadingProxies,
|
||||
|
|
|
@ -32,6 +32,7 @@ describe('generateUserId()', () => {
|
|||
|
||||
// eslint-disable-next-line @silverhand/fp/no-mutation
|
||||
tried++;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ const extractBearerTokenFromHeaders = ({ authorization }: IncomingHttpHeaders) =
|
|||
{ supportedTypes: [bearerTokenIdentifier] }
|
||||
)
|
||||
);
|
||||
|
||||
return authorization.slice(bearerTokenIdentifier.length + 1);
|
||||
};
|
||||
|
||||
|
@ -43,6 +44,7 @@ const getUserIdFromRequest = async (request: Request) => {
|
|||
audience: adminResource,
|
||||
});
|
||||
assertThat(sub, new RequestError({ code: 'auth.jwt_sub_missing', status: 401 }));
|
||||
|
||||
return sub;
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ export default function koaErrorHandler<StateT, ContextT>(): Middleware<
|
|||
if (error instanceof RequestError) {
|
||||
ctx.status = error.status;
|
||||
ctx.body = error.body;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -30,6 +31,7 @@ export default function koaErrorHandler<StateT, ContextT>(): Middleware<
|
|||
code: `oidc.${decamelize(error.name)}` as LogtoErrorCode,
|
||||
data: error.error_detail,
|
||||
};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -37,6 +39,7 @@ export default function koaErrorHandler<StateT, ContextT>(): Middleware<
|
|||
const error = new RequestError({ code: 'entity.not_found', status: 404 });
|
||||
ctx.status = error.status;
|
||||
ctx.body = error.body;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ export default function koaI18next<
|
|||
|
||||
await i18next.changeLanguage(foundLanguage);
|
||||
ctx.locale = i18next.language;
|
||||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const createContext = (query: Record<string, string>): WithPaginationContext<Con
|
|||
set: setHeader,
|
||||
append: appendHeader,
|
||||
};
|
||||
|
||||
return context;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ export default function koaPagination<StateT, ContextT, ResponseBodyT>({
|
|||
const page = Math.floor(offset / limit) + 1; // Start from 1
|
||||
ctx.append('Link', buildLink(ctx.request, 1, 'first'));
|
||||
ctx.append('Link', buildLink(ctx.request, totalPage, 'last'));
|
||||
|
||||
if (page > 1) {
|
||||
ctx.append('Link', buildLink(ctx.request, page - 1, 'prev'));
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ export default function koaUIProxy<
|
|||
}
|
||||
|
||||
const uiDistFiles = await fs.readdir(PATH_TO_UI_DIST);
|
||||
|
||||
if (!uiDistFiles.some((file) => ctx.request.path.startsWith(`/${file}`))) {
|
||||
ctx.request.path = '/';
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ export default function koaUserLog<StateT, ContextT, ResponseBodyT>(): Middlewar
|
|||
try {
|
||||
await next();
|
||||
await insertLog(ctx, UserLogResult.Success);
|
||||
|
||||
return;
|
||||
} catch (error: unknown) {
|
||||
await insertLog(ctx, UserLogResult.Failed);
|
||||
|
|
|
@ -79,6 +79,7 @@ export default async function initOidc(app: Koa): Promise<Provider> {
|
|||
properties: Object.keys(CustomClientMetadataType),
|
||||
validator: (_ctx, key, value) => {
|
||||
const result = customClientMetadataGuard.pick({ [key]: true }).safeParse({ key: value });
|
||||
|
||||
if (!result.success) {
|
||||
throw new errors.InvalidClientMetadata(key);
|
||||
}
|
||||
|
@ -86,6 +87,7 @@ export default async function initOidc(app: Koa): Promise<Provider> {
|
|||
},
|
||||
clientBasedCORS: (_, origin) => {
|
||||
console.log('origin', origin);
|
||||
|
||||
return origin.startsWith('http://localhost:3000');
|
||||
},
|
||||
findAccount: async (ctx, sub) => {
|
||||
|
@ -98,6 +100,7 @@ export default async function initOidc(app: Koa): Promise<Provider> {
|
|||
console.log('scope:', scope);
|
||||
console.log('claims:', claims);
|
||||
console.log('rejected:', rejected);
|
||||
|
||||
return { sub };
|
||||
},
|
||||
};
|
||||
|
@ -108,14 +111,17 @@ export default async function initOidc(app: Koa): Promise<Provider> {
|
|||
*/
|
||||
IdToken: (ctx, token, client) => {
|
||||
const { idTokenTtl } = client.metadata();
|
||||
|
||||
return idTokenTtl ?? defaultIdTokenTtl;
|
||||
},
|
||||
RefreshToken: (ctx, token, client) => {
|
||||
const { refreshTokenTtl } = client.metadata();
|
||||
|
||||
return refreshTokenTtl ?? defaultRefreshTokenTtl;
|
||||
},
|
||||
},
|
||||
});
|
||||
app.use(mount('/oidc', oidc.app));
|
||||
|
||||
return oidc;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ export const deleteApplicationById = async (id: string) => {
|
|||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
|
||||
if (rowCount < 1) {
|
||||
throw new DeletionError();
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ export const deleteResourceById = async (id: string) => {
|
|||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
|
||||
if (rowCount < 1) {
|
||||
throw new DeletionError();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ export const deleteScopeById = async (id: string) => {
|
|||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
|
||||
if (rowCount < 1) {
|
||||
throw new DeletionError();
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ export const deleteUserById = async (id: string) => {
|
|||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
|
||||
if (rowCount < 1) {
|
||||
throw new DeletionError();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ export default function applicationRoutes<T extends AuthedRouter>(router: T) {
|
|||
oidcClientMetadata: buildOidcClientMetadata(oidcClientMetadata),
|
||||
...rest,
|
||||
});
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -67,6 +68,7 @@ export default function applicationRoutes<T extends AuthedRouter>(router: T) {
|
|||
} = ctx.guard;
|
||||
|
||||
ctx.body = await findApplicationById(id);
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -91,6 +93,7 @@ export default function applicationRoutes<T extends AuthedRouter>(router: T) {
|
|||
...body.oidcClientMetadata,
|
||||
}),
|
||||
});
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -104,6 +107,7 @@ export default function applicationRoutes<T extends AuthedRouter>(router: T) {
|
|||
await findApplicationById(id);
|
||||
await deleteApplicationById(id);
|
||||
ctx.status = 204;
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -66,6 +66,7 @@ export default function resourceRoutes<T extends AuthedRouter>(router: T) {
|
|||
]);
|
||||
|
||||
ctx.body = { ...resource, scopes };
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -88,6 +89,7 @@ export default function resourceRoutes<T extends AuthedRouter>(router: T) {
|
|||
]);
|
||||
|
||||
ctx.body = { ...resource, scopes };
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -100,6 +102,7 @@ export default function resourceRoutes<T extends AuthedRouter>(router: T) {
|
|||
await findResourceById(id);
|
||||
await deleteResourceById(id);
|
||||
ctx.status = 204;
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -162,6 +162,7 @@ export default function sessionRoutes<T extends AnonymousRouter>(router: T, prov
|
|||
error,
|
||||
});
|
||||
ctx.body = { redirectTo };
|
||||
|
||||
return next();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ import { AnonymousRouter } from './types';
|
|||
export default function statusRoutes<T extends AnonymousRouter>(router: T) {
|
||||
router.get('/status', async (ctx, next) => {
|
||||
ctx.status = 204;
|
||||
|
||||
return next();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ export default function swaggerRoutes<T extends AnonymousRouter>(router: T) {
|
|||
const guard = stack.find((function_): function_ is WithGuardConfig<IMiddleware> =>
|
||||
isGuardMiddleware(function_)
|
||||
);
|
||||
|
||||
return { path, methods, guard };
|
||||
});
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ export default function userRoutes<T extends AnonymousRouter>(router: T) {
|
|||
router.get('/users', async (ctx, next) => {
|
||||
const users = await findAllUsers();
|
||||
ctx.body = users.map((user) => pick(user, ...userInfoSelectFields));
|
||||
|
||||
return next();
|
||||
});
|
||||
|
||||
|
@ -26,6 +27,7 @@ export default function userRoutes<T extends AnonymousRouter>(router: T) {
|
|||
} = ctx.guard;
|
||||
const user = await findUserById(userId);
|
||||
ctx.body = pick(user, ...userInfoSelectFields);
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -51,6 +53,7 @@ export default function userRoutes<T extends AnonymousRouter>(router: T) {
|
|||
passwordEncrypted,
|
||||
});
|
||||
ctx.body = pick(user, ...userInfoSelectFields);
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
@ -66,6 +69,7 @@ export default function userRoutes<T extends AnonymousRouter>(router: T) {
|
|||
} = ctx.guard;
|
||||
await deleteUserById(userId);
|
||||
ctx.status = 204;
|
||||
|
||||
return next();
|
||||
}
|
||||
);
|
||||
|
|
|
@ -9,5 +9,6 @@ export const buildLink = (
|
|||
type: LinkRelationType
|
||||
): string => {
|
||||
const baseUrl = `${request.origin}${request.path}`;
|
||||
|
||||
return `<${baseUrl}?${stringify({ ...request.query, page })}>; rel="${type}"`;
|
||||
};
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
"@silverhand/essentials": "^1.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@silverhand/eslint-config": "^0.6.1",
|
||||
"@silverhand/ts-config": "^0.6.1",
|
||||
"eslint": "^8.1.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"prettier": "^2.3.2",
|
||||
|
|
|
@ -10,3 +10,5 @@ export interface ResourceLanguage {
|
|||
}
|
||||
|
||||
export type ResourceKey = string | { [key: string]: any };
|
||||
|
||||
/* eslint-enable @typescript-eslint/consistent-indexed-object-style */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"node": ">=14.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/eslint-config": "^0.6.1",
|
||||
"@silverhand/essentials": "^1.1.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@types/lodash.uniq": "^4.5.6",
|
||||
|
|
|
@ -87,6 +87,7 @@ const generate = async () => {
|
|||
nullable,
|
||||
};
|
||||
});
|
||||
|
||||
return { name, fields };
|
||||
});
|
||||
const types = statements
|
||||
|
|
|
@ -7,6 +7,7 @@ import { TableWithType } from './types';
|
|||
export const generateSchema = ({ name, fields }: TableWithType) => {
|
||||
const modelName = pluralize(camelcase(name, { pascalCase: true }), 1);
|
||||
const databaseEntryType = `Create${modelName}`;
|
||||
|
||||
return [
|
||||
`export type ${databaseEntryType} = {`,
|
||||
...fields.map(
|
||||
|
|
|
@ -22,6 +22,7 @@ export const removeParentheses = (value: string) =>
|
|||
Object.values(value).reduce<{ result: string; count: number }>(
|
||||
(previous, current) => {
|
||||
const count = previous.count + getCountDelta(current);
|
||||
|
||||
return count === 0 && current !== ')'
|
||||
? { result: previous.result + current, count }
|
||||
: { result: previous.result, count };
|
||||
|
@ -79,6 +80,7 @@ export const findFirstParentheses = (value: string): Optional<ParenthesesMatch>
|
|||
|
||||
const getRawType = (value: string): string => {
|
||||
const bracketIndex = value.indexOf('[');
|
||||
|
||||
return bracketIndex === -1 ? value : value.slice(0, bracketIndex);
|
||||
};
|
||||
|
||||
|
|
|
@ -34,10 +34,10 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@jest/types": "^27.0.6",
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/eslint-config-react": "^0.4.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@silverhand/ts-config-react": "^0.4.0",
|
||||
"@silverhand/eslint-config": "^0.6.1",
|
||||
"@silverhand/eslint-config-react": "^0.6.1",
|
||||
"@silverhand/ts-config": "^0.6.1",
|
||||
"@silverhand/ts-config-react": "^0.6.1",
|
||||
"@testing-library/react": "^12.0.0",
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/react": "^17.0.14",
|
||||
|
|
|
@ -4,5 +4,6 @@ export const consent = async () => {
|
|||
type Response = {
|
||||
redirectTo: string;
|
||||
};
|
||||
|
||||
return ky.post('/api/session/consent').json<Response>();
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ export const register = async (username: string, password: string) => {
|
|||
type Response = {
|
||||
redirectTo: string;
|
||||
};
|
||||
|
||||
return ky
|
||||
.post('/api/session/register', {
|
||||
json: {
|
||||
|
|
|
@ -4,6 +4,7 @@ export const signInBasic = async (username: string, password: string) => {
|
|||
type Response = {
|
||||
redirectTo: string;
|
||||
};
|
||||
|
||||
return ky
|
||||
.post('/api/session', {
|
||||
json: {
|
||||
|
|
|
@ -17,3 +17,5 @@ renderFunction(
|
|||
if (module.hot) {
|
||||
module.hot.accept();
|
||||
}
|
||||
|
||||
/* eslint-enable unicorn/prefer-module */
|
||||
|
|
|
@ -30,6 +30,7 @@ function useApi<Args extends any[], Response>(
|
|||
const kyError = await error.response.json<RequestErrorBody>();
|
||||
setError(kyError);
|
||||
setLoading(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ export default function useTheme() {
|
|||
};
|
||||
|
||||
darkThemeWatchMedia.addEventListener('change', changeTheme);
|
||||
|
||||
return () => {
|
||||
darkThemeWatchMedia.removeEventListener('change', changeTheme);
|
||||
};
|
||||
|
|
61
pnpm-lock.yaml
generated
61
pnpm-lock.yaml
generated
|
@ -23,9 +23,9 @@ importers:
|
|||
'@logto/phrases': ^0.1.0
|
||||
'@logto/schemas': ^0.1.0
|
||||
'@shopify/jest-koa-mocks': ^3.0.8
|
||||
'@silverhand/eslint-config': ^0.4.0
|
||||
'@silverhand/eslint-config': ^0.6.1
|
||||
'@silverhand/essentials': ^1.1.0
|
||||
'@silverhand/ts-config': ^0.4.0
|
||||
'@silverhand/ts-config': ^0.6.1
|
||||
'@types/jest': ^27.0.1
|
||||
'@types/koa': ^2.13.3
|
||||
'@types/koa-logger': ^3.1.1
|
||||
|
@ -100,8 +100,8 @@ importers:
|
|||
zod: 3.11.6
|
||||
devDependencies:
|
||||
'@shopify/jest-koa-mocks': 3.0.8
|
||||
'@silverhand/eslint-config': 0.4.0_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/ts-config': 0.4.0_typescript@4.5.3
|
||||
'@silverhand/eslint-config': 0.6.1_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/ts-config': 0.6.1_typescript@4.5.3
|
||||
'@types/jest': 27.0.3
|
||||
'@types/koa': 2.13.4
|
||||
'@types/koa-logger': 3.1.2
|
||||
|
@ -125,9 +125,9 @@ importers:
|
|||
|
||||
packages/phrases:
|
||||
specifiers:
|
||||
'@silverhand/eslint-config': ^0.4.0
|
||||
'@silverhand/eslint-config': ^0.6.1
|
||||
'@silverhand/essentials': ^1.1.4
|
||||
'@silverhand/ts-config': ^0.4.0
|
||||
'@silverhand/ts-config': ^0.6.1
|
||||
eslint: ^8.1.0
|
||||
lint-staged: ^11.1.1
|
||||
prettier: ^2.3.2
|
||||
|
@ -135,8 +135,8 @@ importers:
|
|||
dependencies:
|
||||
'@silverhand/essentials': 1.1.4
|
||||
devDependencies:
|
||||
'@silverhand/eslint-config': 0.4.0_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/ts-config': 0.4.0_typescript@4.5.3
|
||||
'@silverhand/eslint-config': 0.6.1_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/ts-config': 0.6.1_typescript@4.5.3
|
||||
eslint: 8.4.1
|
||||
lint-staged: 11.2.6
|
||||
prettier: 2.5.1
|
||||
|
@ -145,7 +145,7 @@ importers:
|
|||
packages/schemas:
|
||||
specifiers:
|
||||
'@logto/phrases': ^0.1.0
|
||||
'@silverhand/eslint-config': ^0.4.0
|
||||
'@silverhand/eslint-config': ^0.6.1
|
||||
'@silverhand/essentials': ^1.1.0
|
||||
'@silverhand/ts-config': ^0.4.0
|
||||
'@types/lodash.uniq': ^4.5.6
|
||||
|
@ -164,7 +164,7 @@ importers:
|
|||
'@logto/phrases': link:../phrases
|
||||
zod: 3.11.6
|
||||
devDependencies:
|
||||
'@silverhand/eslint-config': 0.4.0_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/eslint-config': 0.6.1_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/essentials': 1.1.2
|
||||
'@silverhand/ts-config': 0.4.0_typescript@4.5.3
|
||||
'@types/lodash.uniq': 4.5.6
|
||||
|
@ -185,10 +185,10 @@ importers:
|
|||
'@jest/types': ^27.0.6
|
||||
'@logto/phrases': ^0.1.0
|
||||
'@logto/schemas': ^0.1.0
|
||||
'@silverhand/eslint-config': ^0.4.0
|
||||
'@silverhand/eslint-config-react': ^0.4.0
|
||||
'@silverhand/ts-config': ^0.4.0
|
||||
'@silverhand/ts-config-react': ^0.4.0
|
||||
'@silverhand/eslint-config': ^0.6.1
|
||||
'@silverhand/eslint-config-react': ^0.6.1
|
||||
'@silverhand/ts-config': ^0.6.1
|
||||
'@silverhand/ts-config-react': ^0.6.1
|
||||
'@testing-library/react': ^12.0.0
|
||||
'@types/jest': ^26.0.24
|
||||
'@types/react': ^17.0.14
|
||||
|
@ -237,10 +237,10 @@ importers:
|
|||
devDependencies:
|
||||
'@babel/core': 7.16.0
|
||||
'@jest/types': 27.4.2
|
||||
'@silverhand/eslint-config': 0.4.0_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/eslint-config-react': 0.4.0_9d4efdeaabe00e4de1f3b58f5988ea20
|
||||
'@silverhand/ts-config': 0.4.0_typescript@4.5.3
|
||||
'@silverhand/ts-config-react': 0.4.0_typescript@4.5.3
|
||||
'@silverhand/eslint-config': 0.6.1_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/eslint-config-react': 0.6.1_9d4efdeaabe00e4de1f3b58f5988ea20
|
||||
'@silverhand/ts-config': 0.6.1_typescript@4.5.3
|
||||
'@silverhand/ts-config-react': 0.6.1_typescript@4.5.3
|
||||
'@testing-library/react': 12.1.2_react-dom@17.0.2+react@17.0.2
|
||||
'@types/jest': 26.0.24
|
||||
'@types/react': 17.0.37
|
||||
|
@ -3076,12 +3076,12 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@silverhand/eslint-config-react/0.4.0_9d4efdeaabe00e4de1f3b58f5988ea20:
|
||||
resolution: {integrity: sha512-C0Sf3eajHXzrS/Nc4XJQv+1RGh3XJBJcUDb/W0JI9O4YVmC1zRsGanuzs+Vvd1uDcBzVqWVDjSH5GRw36IOonA==}
|
||||
/@silverhand/eslint-config-react/0.6.1_9d4efdeaabe00e4de1f3b58f5988ea20:
|
||||
resolution: {integrity: sha512-QrYy4E6jPPYDHTBiwD6cTQUZ2iC/6GjUrP6bnDDa7ujn93ll0oDlTVsJjcIj9tHaxjF7rJofG+JKCJKLED0Bhw==}
|
||||
peerDependencies:
|
||||
stylelint: ^13.13.1
|
||||
dependencies:
|
||||
'@silverhand/eslint-config': 0.4.0_1462fc7e3c7b4386daba890f6c2395d0
|
||||
'@silverhand/eslint-config': 0.6.1_1462fc7e3c7b4386daba890f6c2395d0
|
||||
eslint-config-xo-react: 0.25.0_0d0b684468c8c3b6dac037452254bcd4
|
||||
eslint-plugin-react: 7.27.1_eslint@8.4.1
|
||||
eslint-plugin-react-hooks: 4.3.0_eslint@8.4.1
|
||||
|
@ -3094,8 +3094,8 @@ packages:
|
|||
- typescript
|
||||
dev: true
|
||||
|
||||
/@silverhand/eslint-config/0.4.0_1462fc7e3c7b4386daba890f6c2395d0:
|
||||
resolution: {integrity: sha512-ivaUaS1S6w6EZ+K+anZYTJMCDkzP4DxF2aMEo6jndBkAA0/W9CGyQ4fmnLuRamgeE0OzzNpeYRQOaDmLLEEXvA==}
|
||||
/@silverhand/eslint-config/0.6.1_1462fc7e3c7b4386daba890f6c2395d0:
|
||||
resolution: {integrity: sha512-XgLn291LvMjhdfPgRfjtL8L2rmZ2Dci40N3jvNoC65jb4i1wmHoaG2ZYL4eVSTXOLiAfIuRJnuuLisunY/aUKQ==}
|
||||
engines: {node: '>=14.15.0'}
|
||||
peerDependencies:
|
||||
eslint: ^8.1.0
|
||||
|
@ -3153,13 +3153,13 @@ packages:
|
|||
lodash.pick: 4.4.0
|
||||
dev: false
|
||||
|
||||
/@silverhand/ts-config-react/0.4.0_typescript@4.5.3:
|
||||
resolution: {integrity: sha512-8D/VFFFGDrOf4zspfkvasXViOpwC+S/VrJx/rHD7Ztbn8+HPeHQRZeykXI2Tgg/G8cBkmlhW9ufrtCBYElJd+g==}
|
||||
/@silverhand/ts-config-react/0.6.1_typescript@4.5.3:
|
||||
resolution: {integrity: sha512-tFuXXeOzWY4p9acWdxL4TyEl+XMHSNj6lpcqQBrYErGklr0Qq9ztYNEQ1MMpNmQMWoUCkUvH/nbl3HEC0DZz5w==}
|
||||
engines: {node: '>=14.15.0'}
|
||||
peerDependencies:
|
||||
typescript: ^4.3.5
|
||||
dependencies:
|
||||
'@silverhand/ts-config': 0.4.0_typescript@4.5.3
|
||||
'@silverhand/ts-config': 0.6.1_typescript@4.5.3
|
||||
typescript: 4.5.3
|
||||
dev: true
|
||||
|
||||
|
@ -3172,6 +3172,15 @@ packages:
|
|||
typescript: 4.5.3
|
||||
dev: true
|
||||
|
||||
/@silverhand/ts-config/0.6.1_typescript@4.5.3:
|
||||
resolution: {integrity: sha512-Bj6xK0ZUuv57bqryD9LbOJu3j13ud4aM+mrF6ztlQr8WnauvqSn17zCUfwLNxL7EMRH+qIb2BdVqJVIYFE2Dhg==}
|
||||
engines: {node: '>=14.15.0'}
|
||||
peerDependencies:
|
||||
typescript: ^4.3.5
|
||||
dependencies:
|
||||
typescript: 4.5.3
|
||||
dev: true
|
||||
|
||||
/@sindresorhus/is/4.2.0:
|
||||
resolution: {integrity: sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw==}
|
||||
engines: {node: '>=10'}
|
||||
|
|
Loading…
Add table
Reference in a new issue