mirror of
https://github.com/logto-io/logto.git
synced 2025-03-17 22:31:28 -05:00
chore: upgrade Silverhand configs (#2153)
This commit is contained in:
parent
608e221e65
commit
39a5347ac9
30 changed files with 826 additions and 542 deletions
|
@ -59,9 +59,9 @@
|
|||
"zod": "^3.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/inquirer": "^8.2.1",
|
||||
"@types/jest": "^28.1.6",
|
||||
|
@ -79,12 +79,6 @@
|
|||
},
|
||||
"eslintConfig": {
|
||||
"extends": "@silverhand",
|
||||
"rules": {
|
||||
"complexity": [
|
||||
"error",
|
||||
7
|
||||
]
|
||||
},
|
||||
"ignorePatterns": ["src/package-json.ts"]
|
||||
},
|
||||
"prettier": "@silverhand/eslint-config/.prettierrc"
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
"@parcel/transformer-mdx": "2.7.0",
|
||||
"@parcel/transformer-sass": "2.7.0",
|
||||
"@parcel/transformer-svg-react": "2.7.0",
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config-react": "1.1.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/eslint-config-react": "1.2.1",
|
||||
"@silverhand/essentials": "^1.3.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config-react": "1.1.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@silverhand/ts-config-react": "1.2.1",
|
||||
"@tsconfig/docusaurus": "^1.0.5",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/lodash.kebabcase": "^4.1.6",
|
||||
|
@ -91,8 +91,7 @@
|
|||
"eslintConfig": {
|
||||
"extends": "@silverhand/react",
|
||||
"rules": {
|
||||
"complexity": "off",
|
||||
"@typescript-eslint/prefer-nullish-coalescing": "off"
|
||||
"complexity": "off"
|
||||
}
|
||||
},
|
||||
"stylelint": {
|
||||
|
|
|
@ -17,7 +17,7 @@ const ApplicationName = ({ applicationId, isLink = false }: Props) => {
|
|||
const { data } = useSWR<Application>(!isAdminConsole && `/api/applications/${applicationId}`);
|
||||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
const name = (isAdminConsole ? <>Admin Console ({t('system_app')})</> : data?.name) || '-';
|
||||
const name = (isAdminConsole ? <>Admin Console ({t('system_app')})</> : data?.name) ?? '-';
|
||||
|
||||
if (isLink && !isAdminConsole) {
|
||||
return (
|
||||
|
|
|
@ -17,7 +17,7 @@ const UserName = ({ userId, isLink = false }: Props) => {
|
|||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
|
||||
|
||||
const isLoading = !data && !error;
|
||||
const name = data?.name || t('users.unnamed');
|
||||
const name = data?.name ?? t('users.unnamed');
|
||||
|
||||
const isAdmin = data?.roleNames.includes(UserRole.Admin);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ const UserDetails = () => {
|
|||
*/}
|
||||
<img
|
||||
className={styles.avatar}
|
||||
src={data.avatar || generateAvatarPlaceHolderById(userId)}
|
||||
src={data.avatar ?? generateAvatarPlaceHolderById(userId)}
|
||||
referrerPolicy="no-referrer"
|
||||
alt="avatar"
|
||||
/>
|
||||
|
|
|
@ -131,13 +131,13 @@ const Users = () => {
|
|||
>
|
||||
<td>
|
||||
<ItemPreview
|
||||
title={name || t('users.unnamed')}
|
||||
title={name ?? t('users.unnamed')}
|
||||
subtitle={id}
|
||||
icon={
|
||||
<img
|
||||
alt="avatar"
|
||||
className={styles.avatar}
|
||||
src={avatar || generateAvatarPlaceHolderById(id)}
|
||||
src={avatar ?? generateAvatarPlaceHolderById(id)}
|
||||
/>
|
||||
}
|
||||
to={`/users/${id}`}
|
||||
|
|
|
@ -72,9 +72,9 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@shopify/jest-koa-mocks": "^5.0.0",
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/etag": "^1.8.1",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
|
@ -110,10 +110,7 @@
|
|||
"@": "./build"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "@silverhand",
|
||||
"rules": {
|
||||
"complexity": "off"
|
||||
}
|
||||
"extends": "@silverhand"
|
||||
},
|
||||
"prettier": "@silverhand/eslint-config/.prettierrc"
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@ export const sendPasscode = async (passcode: Passcode) => {
|
|||
export const passcodeExpiration = 10 * 60 * 1000; // 10 minutes.
|
||||
export const passcodeMaxTryCount = 10;
|
||||
|
||||
// TODO: @sijie refactor me
|
||||
// eslint-disable-next-line complexity
|
||||
export const verifyPasscode = async (
|
||||
sessionId: string,
|
||||
type: PasscodeType,
|
||||
|
|
|
@ -45,6 +45,8 @@ type TokenInfo = {
|
|||
roleNames?: string[];
|
||||
};
|
||||
|
||||
// TODO: @Gao refactor me
|
||||
// eslint-disable-next-line complexity
|
||||
export const verifyBearerTokenFromRequest = async (
|
||||
request: Request,
|
||||
resourceIndicator = managementResource.indicator
|
||||
|
|
|
@ -6,6 +6,8 @@ import { z } from 'zod';
|
|||
import RequestError from '@/errors/RequestError';
|
||||
|
||||
export default function koaConnectorErrorHandler<StateT, ContextT>(): Middleware<StateT, ContextT> {
|
||||
// Too many error types :-)
|
||||
// eslint-disable-next-line complexity
|
||||
return async (ctx, next) => {
|
||||
try {
|
||||
await next();
|
||||
|
|
|
@ -10,6 +10,8 @@ import RequestError from '@/errors/RequestError';
|
|||
*/
|
||||
|
||||
export default function koaOIDCErrorHandler<StateT, ContextT>(): Middleware<StateT, ContextT> {
|
||||
// Too many error types :-)
|
||||
// eslint-disable-next-line complexity
|
||||
return async (ctx, next) => {
|
||||
try {
|
||||
await next();
|
||||
|
|
|
@ -35,6 +35,8 @@ export default function koaPagination<StateT, ContextT, ResponseBodyT>({
|
|||
StateT,
|
||||
WithPaginationContext<ContextT>,
|
||||
ResponseBodyT
|
||||
// TODO: Refactor me
|
||||
// eslint-disable-next-line complexity
|
||||
> = async (ctx, next) => {
|
||||
try {
|
||||
const {
|
||||
|
|
|
@ -98,6 +98,8 @@ export function createRequester(
|
|||
}
|
||||
): request.SuperTest<request.Test>;
|
||||
|
||||
// TODO: Refacttor me
|
||||
// eslint-disable-next-line complexity
|
||||
export function createRequester({
|
||||
anonymousRoutes,
|
||||
authedRoutes,
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import { Translation } from '@logto/schemas';
|
||||
|
||||
// LOG-4385: Refactor me
|
||||
// eslint-disable-next-line complexity
|
||||
export const isValidStructure = (fullTranslation: Translation, partialTranslation: Translation) => {
|
||||
const fullKeys = new Set(Object.keys(fullTranslation));
|
||||
const partialKeys = Object.keys(partialTranslation);
|
||||
|
|
|
@ -54,6 +54,8 @@ export const translationSchemas: Record<string, OpenAPIV3.SchemaObject> = {
|
|||
|
||||
export type ZodStringCheck = ValuesOf<ZodStringDef['checks']>;
|
||||
|
||||
// Switch-clause
|
||||
// eslint-disable-next-line complexity
|
||||
const zodStringCheckToSwaggerFormat = (zodStringCheck: ZodStringCheck) => {
|
||||
const { kind } = zodStringCheck;
|
||||
|
||||
|
@ -126,6 +128,8 @@ const zodLiteralToSwagger = (zodLiteral: ZodLiteral<unknown>): OpenAPIV3.SchemaO
|
|||
}
|
||||
};
|
||||
|
||||
// Too many zod types :-)
|
||||
// eslint-disable-next-line complexity
|
||||
export const zodTypeToSwagger = (
|
||||
config: unknown
|
||||
): OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject => {
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
"@logto/schemas": "^1.0.0-beta.10",
|
||||
"@parcel/core": "2.7.0",
|
||||
"@parcel/transformer-sass": "2.7.0",
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config-react": "1.1.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config-react": "1.1.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/eslint-config-react": "1.2.1",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@silverhand/ts-config-react": "1.2.1",
|
||||
"@types/react": "^18.0.0",
|
||||
"@types/react-dom": "^18.0.0",
|
||||
"cross-env": "^7.0.3",
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
"@logto/node": "1.0.0-beta.8",
|
||||
"@logto/schemas": "^1.0.0-beta.10",
|
||||
"@peculiar/webcrypto": "^1.3.3",
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/essentials": "^1.3.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/jest-environment-puppeteer": "^5.0.2",
|
||||
"@types/node": "^16.0.0",
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
"zod": "^3.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"eslint": "^8.21.0",
|
||||
"lint-staged": "^13.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
"zod": "^3.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"eslint": "^8.21.0",
|
||||
"lint-staged": "^13.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
"node": "^16.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/essentials": "^1.3.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@types/jest": "^28.0.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/lodash.uniq": "^4.5.6",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/pluralize": "^0.0.29",
|
||||
|
|
|
@ -135,7 +135,7 @@ const generate = async () => {
|
|||
const customTypes: string[] = [];
|
||||
const tableWithTypes = tables.map<TableWithType>(({ fields, ...rest }) => ({
|
||||
...rest,
|
||||
// eslint-disable-next-line complexity
|
||||
|
||||
fields: fields.map(({ type, customType, tsType, ...rest }) => {
|
||||
const finalType =
|
||||
tsType ?? type ?? allTypes.find(({ name }) => name === customType)?.tsName;
|
||||
|
|
|
@ -13,7 +13,6 @@ export const generateSchema = ({ name, fields }: TableWithType) => {
|
|||
return [
|
||||
`export type ${databaseEntryType} = {`,
|
||||
...fields.map(
|
||||
// eslint-disable-next-line complexity
|
||||
({ name, type, isArray, nullable, hasDefaultValue }) =>
|
||||
` ${camelcase(name)}${conditionalString(
|
||||
(nullable || hasDefaultValue) && '?'
|
||||
|
|
|
@ -158,7 +158,6 @@ const parseStringMaxLength = (rawType: string) => {
|
|||
);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export const parseType = (tableFieldDefinition: string): Field => {
|
||||
const [nameRaw, typeRaw, ...rest] = tableFieldDefinition.split(' ');
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
"test:ci": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/jest": "^28.1.6",
|
||||
"@types/node": "^16.0.0",
|
||||
"eslint": "^8.21.0",
|
||||
|
|
|
@ -6,8 +6,6 @@ import findUp, { exists } from 'find-up';
|
|||
|
||||
const findPackage = async (cwd: string, allowSymlink = false) =>
|
||||
findUp(
|
||||
// Will update to 7 soon
|
||||
// eslint-disable-next-line complexity
|
||||
async (directory) => {
|
||||
const testPath = path.join(directory, 'package.json');
|
||||
const hasPackageJson = await exists(testPath);
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
"@parcel/transformer-sass": "2.7.0",
|
||||
"@parcel/transformer-svg-react": "2.7.0",
|
||||
"@peculiar/webcrypto": "^1.3.3",
|
||||
"@silverhand/eslint-config": "1.0.0",
|
||||
"@silverhand/eslint-config-react": "1.1.0",
|
||||
"@silverhand/eslint-config": "1.2.0",
|
||||
"@silverhand/eslint-config-react": "1.2.1",
|
||||
"@silverhand/essentials": "^1.3.0",
|
||||
"@silverhand/jest-config": "1.0.0",
|
||||
"@silverhand/ts-config": "1.0.0",
|
||||
"@silverhand/ts-config-react": "1.1.0",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@silverhand/ts-config-react": "1.2.1",
|
||||
"@testing-library/react": "^13.3.0",
|
||||
"@types/color": "^3.0.3",
|
||||
"@types/jest": "^28.1.6",
|
||||
|
|
|
@ -13,7 +13,7 @@ export type Props = HTMLProps<HTMLInputElement> & {
|
|||
className?: string;
|
||||
error?: ErrorType;
|
||||
onClear?: () => void;
|
||||
errorStyling?: boolean;
|
||||
isErrorStyling?: boolean;
|
||||
};
|
||||
|
||||
const Input = ({
|
||||
|
@ -21,13 +21,13 @@ const Input = ({
|
|||
type = 'text',
|
||||
value,
|
||||
error,
|
||||
errorStyling = true,
|
||||
isErrorStyling = true,
|
||||
onClear,
|
||||
...rest
|
||||
}: Props) => {
|
||||
return (
|
||||
<div className={className}>
|
||||
<div className={classNames(styles.wrapper, error && errorStyling && styles.error)}>
|
||||
<div className={classNames(styles.wrapper, error && isErrorStyling && styles.error)}>
|
||||
<input type={type} value={value} {...rest} />
|
||||
{value && onClear && (
|
||||
<ClearIcon
|
||||
|
|
|
@ -117,7 +117,7 @@ const CreateAccount = ({ className, autoFocus }: Props) => {
|
|||
{...fieldRegister('confirmPassword', (confirmPassword) =>
|
||||
confirmPasswordValidation(fieldValue.password, confirmPassword)
|
||||
)}
|
||||
errorStyling={false}
|
||||
isErrorStyling={false}
|
||||
onClear={() => {
|
||||
setFieldValue((state) => ({ ...state, confirmPassword: '' }));
|
||||
}}
|
||||
|
|
|
@ -109,7 +109,7 @@ const ResetPassword = ({ className, autoFocus }: Props) => {
|
|||
{...register('confirmPassword', (confirmPassword) =>
|
||||
confirmPasswordValidation(fieldValue.password, confirmPassword)
|
||||
)}
|
||||
errorStyling={false}
|
||||
isErrorStyling={false}
|
||||
onClear={() => {
|
||||
setFieldValue((state) => ({ ...state, confirmPassword: '' }));
|
||||
}}
|
||||
|
|
1256
pnpm-lock.yaml
generated
1256
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue