mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore: upgrade configs and eslint (#294)
* chore: upgrade configs and eslint * chore: update lockfile * fix(ui): stylelint
This commit is contained in:
parent
fb6a1dc236
commit
f7925d9332
14 changed files with 766 additions and 378 deletions
|
@ -10,10 +10,10 @@
|
|||
"dev": "lerna run --stream prepack && lerna --scope=@logto/{core,ui} exec -- pnpm dev"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^13.1.0",
|
||||
"@commitlint/config-conventional": "^13.1.0",
|
||||
"@commitlint/types": "^13.1.0",
|
||||
"husky": "^7.0.1",
|
||||
"@commitlint/cli": "^13.2.1",
|
||||
"@commitlint/config-conventional": "^13.2.0",
|
||||
"@commitlint/types": "^13.2.0",
|
||||
"husky": "^7.0.4",
|
||||
"lerna": "^4.0.0",
|
||||
"typescript": "^4.5.5"
|
||||
},
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
"devDependencies": {
|
||||
"@parcel/core": "^2.3.1",
|
||||
"@parcel/transformer-sass": "^2.3.1",
|
||||
"@silverhand/eslint-config": "^0.8.1",
|
||||
"@silverhand/eslint-config-react": "^0.8.1",
|
||||
"@silverhand/ts-config": "^0.8.1",
|
||||
"@silverhand/ts-config-react": "^0.8.1",
|
||||
"@silverhand/eslint-config": "^0.9.1",
|
||||
"@silverhand/eslint-config-react": "^0.9.2",
|
||||
"@silverhand/ts-config": "^0.9.1",
|
||||
"@silverhand/ts-config-react": "^0.9.2",
|
||||
"@types/react": "^17.0.14",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint": "^8.10.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"parcel": "^2.3.1",
|
||||
"postcss": "^8.4.6",
|
||||
|
|
|
@ -48,8 +48,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@shopify/jest-koa-mocks": "^3.0.8",
|
||||
"@silverhand/eslint-config": "^0.8.1",
|
||||
"@silverhand/ts-config": "^0.8.1",
|
||||
"@silverhand/eslint-config": "^0.9.1",
|
||||
"@silverhand/ts-config": "^0.9.1",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/koa": "^2.13.3",
|
||||
"@types/koa-logger": "^3.1.1",
|
||||
|
@ -60,7 +60,7 @@
|
|||
"@types/oidc-provider": "^7.8.0",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"codecov": "^3.8.3",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint": "^8.10.0",
|
||||
"jest": "^27.0.6",
|
||||
"jest-matcher-specific-error": "^1.0.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
|
|
|
@ -51,6 +51,8 @@ describe('validateConfig', () => {
|
|||
).resolves.not.toThrow();
|
||||
});
|
||||
it('should throw on empty config', async () => {
|
||||
// FIXME: @sijie
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
await expect(validateConfig()).rejects.toThrowError();
|
||||
});
|
||||
|
|
|
@ -12,8 +12,6 @@ export const conditionalSql = <T>(
|
|||
) => (notFalsy(value) ? buildSql(value) : sql``);
|
||||
|
||||
export const autoSetFields = Object.freeze(['createdAt', 'updatedAt'] as const);
|
||||
// `Except` type will require omit fields to be the key of given type
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type OmitAutoSetFields<T> = Omit<T, typeof autoSetFields[number]>;
|
||||
export type ExcludeAutoSetFields<T> = Exclude<T, typeof autoSetFields[number]>;
|
||||
export const excludeAutoSetFields = <T extends string>(fields: readonly T[]) =>
|
||||
|
@ -34,7 +32,9 @@ export const excludeAutoSetFields = <T extends string>(fields: readonly T[]) =>
|
|||
*/
|
||||
export const convertToPrimitiveOrSql = (
|
||||
key: string,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
value: NonNullable<SchemaValue> | null
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
): NonNullable<SchemaValuePrimitive> | SqlTokenType | null => {
|
||||
if (value === null) {
|
||||
return null;
|
||||
|
|
|
@ -76,6 +76,8 @@ export const getUserInfoFromInteractionResult = async (
|
|||
*/
|
||||
export const findSocialRelatedUser = async (
|
||||
info: SocialUserInfo
|
||||
// FIXME:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
): Promise<null | [string, User]> => {
|
||||
if (info.phone && (await hasUserWithPhone(info.phone))) {
|
||||
const user = await findUserByPhone(info.phone);
|
||||
|
|
|
@ -16,11 +16,13 @@ export type QueryResult = Pick<OidcModelInstance, 'payload' | 'consumedAt'>;
|
|||
|
||||
const { table, fields } = convertToIdentifiers(OidcModelInstances);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const withConsumed = <T>(data: T, consumedAt?: number | null): WithConsumed<T> => ({
|
||||
...data,
|
||||
...(consumedAt ? { consumed: true } : undefined),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const convertResult = (result: QueryResult | null) =>
|
||||
conditional(result && withConsumed(result.payload, result.consumedAt));
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
"@silverhand/essentials": "^1.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.8.1",
|
||||
"@silverhand/ts-config": "^0.8.1",
|
||||
"eslint": "^8.1.0",
|
||||
"@silverhand/eslint-config": "^0.9.1",
|
||||
"@silverhand/ts-config": "^0.9.1",
|
||||
"eslint": "^8.10.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.5.5"
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
"node": ">=14.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.8.1",
|
||||
"@silverhand/eslint-config": "^0.9.1",
|
||||
"@silverhand/essentials": "^1.1.0",
|
||||
"@silverhand/ts-config": "^0.8.1",
|
||||
"@silverhand/ts-config": "^0.9.1",
|
||||
"@types/lodash.uniq": "^4.5.6",
|
||||
"@types/node": "14",
|
||||
"@types/pluralize": "^0.0.29",
|
||||
"camelcase": "^6.2.0",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint": "^8.10.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"lodash.uniq": "^4.5.0",
|
||||
"pluralize": "^8.0.0",
|
||||
|
@ -37,7 +37,10 @@
|
|||
"typescript": "^4.5.5"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "@silverhand"
|
||||
"extends": "@silverhand",
|
||||
"rules": {
|
||||
"@typescript-eslint/ban-types": "off"
|
||||
}
|
||||
},
|
||||
"prettier": "@silverhand/eslint-config/.prettierrc",
|
||||
"dependencies": {
|
||||
|
|
|
@ -8,7 +8,6 @@ export type Field = {
|
|||
isArray: boolean;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type FieldWithType = Omit<Field, 'type' | 'customType'> & { type: string; isEnum: boolean };
|
||||
|
||||
export type Type = {
|
||||
|
|
|
@ -30,16 +30,16 @@
|
|||
"@jest/types": "^27.5.1",
|
||||
"@parcel/core": "^2.3.1",
|
||||
"@parcel/transformer-sass": "^2.3.1",
|
||||
"@silverhand/eslint-config": "^0.8.1",
|
||||
"@silverhand/eslint-config-react": "^0.8.1",
|
||||
"@silverhand/ts-config": "^0.8.1",
|
||||
"@silverhand/ts-config-react": "^0.8.1",
|
||||
"@silverhand/eslint-config": "^0.9.1",
|
||||
"@silverhand/eslint-config-react": "^0.9.2",
|
||||
"@silverhand/ts-config": "^0.9.1",
|
||||
"@silverhand/ts-config-react": "^0.9.2",
|
||||
"@testing-library/react": "^12.0.0",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/react": "^17.0.14",
|
||||
"@types/react-dom": "^17.0.9",
|
||||
"@types/react-router-dom": "^5.3.2",
|
||||
"eslint": "^8.1.0",
|
||||
"eslint": "^8.10.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^27.5.1",
|
||||
"lint-staged": "^11.1.1",
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
--color-error-border: #{rgba(#ff6b66, 0.35)};
|
||||
|
||||
/* Shadow */
|
||||
--shadow-button: 2px 2px 8px rgb(60 76 227 / 25%);
|
||||
--shadow-button: 2px 2px 8px rgb(60, 76, 227, 25%);
|
||||
|
||||
/* Transition */
|
||||
--transition-default-function: 0.2s ease-in-out;
|
||||
|
@ -39,8 +39,8 @@
|
|||
--color-background: #101419;
|
||||
|
||||
/* Shadow */
|
||||
--shadow-card: 2px 2px 24px rgb(59 61 63 / 25%);
|
||||
--shadow-control: 1px 1px 2px rgb(221 221 221 / 25%);
|
||||
--shadow-card: 2px 2px 24px rgb(59, 61, 63, 25%);
|
||||
--shadow-control: 1px 1px 2px rgb(221, 221, 221, 25%);
|
||||
}
|
||||
|
||||
.light {
|
||||
|
@ -54,8 +54,8 @@
|
|||
--color-background: #fdfdff;
|
||||
|
||||
/* Shadow */
|
||||
--shadow-card: 2px 2px 24px rgb(187 189 191 / 20%);
|
||||
--shadow-control: 1px 1px 2px rgb(221 221 221 / 25%);
|
||||
--shadow-card: 2px 2px 24px rgb(187, 189, 191, 20%);
|
||||
--shadow-control: 1px 1px 2px rgb(221, 221, 221, 25%);
|
||||
}
|
||||
|
||||
$font-family: 'PingFang SC', 'SF Pro Text', sans-serif;
|
||||
|
|
|
@ -5,6 +5,8 @@ import { useState, useCallback } from 'react';
|
|||
type UseApi<T extends any[], U> = {
|
||||
result?: U;
|
||||
loading: boolean;
|
||||
// FIXME:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
error: RequestErrorBody | null;
|
||||
run: (...args: T) => Promise<void>;
|
||||
};
|
||||
|
@ -13,6 +15,8 @@ function useApi<Args extends any[], Response>(
|
|||
api: (...args: Args) => Promise<Response>
|
||||
): UseApi<Args, Response> {
|
||||
const [loading, setLoading] = useState(false);
|
||||
// FIXME:
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
const [error, setError] = useState<RequestErrorBody | null>(null);
|
||||
const [result, setResult] = useState<Response>();
|
||||
|
||||
|
|
1068
pnpm-lock.yaml
1068
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue