mirror of
https://github.com/logto-io/logto.git
synced 2025-03-17 22:31:28 -05:00
chore: update dependency of ESLint to version 8.1.0 or later (#155)
* chore: update eslint version to 8.1.0 * chore: update silverhand configs dependency * chore: update silverhand configs dependency and fix code block according to linting rules
This commit is contained in:
parent
1fc73030e8
commit
dd7a385363
14 changed files with 2911 additions and 3013 deletions
|
@ -46,8 +46,8 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@shopify/jest-koa-mocks": "^3.0.8",
|
||||
"@silverhand/eslint-config": "^0.2.2",
|
||||
"@silverhand/ts-config": "^0.2.2",
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/koa": "^2.13.3",
|
||||
"@types/koa-logger": "^3.1.1",
|
||||
|
@ -57,7 +57,7 @@
|
|||
"@types/lodash.pick": "^4.4.6",
|
||||
"@types/node": "^16.3.1",
|
||||
"@types/oidc-provider": "^7.8.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint": "^8.1.0",
|
||||
"jest": "^27.0.6",
|
||||
"jest-matcher-specific-error": "^1.0.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable sql/no-unsafe-query */
|
||||
import { UserDBEntry, Users } from '@logto/schemas';
|
||||
import decamelize from 'decamelize';
|
||||
|
||||
|
|
|
@ -62,22 +62,22 @@ export const buildInsertInto: BuildInsertInto = <
|
|||
const {
|
||||
rows: [entry],
|
||||
} = await pool.query<ReturnType>(sql`
|
||||
insert into ${table} (${sql.join(
|
||||
insert into ${table} (${sql.join(
|
||||
keys.map((key) => fields[key]),
|
||||
sql`, `
|
||||
)})
|
||||
values (${sql.join(
|
||||
keys.map((key) => convertToPrimitiveOrSql(key, data[key] ?? null)),
|
||||
sql`, `
|
||||
)})
|
||||
${conditionalSql(returning, () => sql`returning *`)}
|
||||
${conditionalSql(
|
||||
onConflict,
|
||||
({ fields, setExcludedFields }) => sql`
|
||||
on conflict (${sql.join(fields, sql`, `)}) do update
|
||||
set ${setExcluded(...setExcludedFields)}
|
||||
`
|
||||
)}
|
||||
values (${sql.join(
|
||||
keys.map((key) => convertToPrimitiveOrSql(key, data[key] ?? null)),
|
||||
sql`, `
|
||||
)})
|
||||
${conditionalSql(returning, () => sql`returning *`)}
|
||||
${conditionalSql(
|
||||
onConflict,
|
||||
({ fields, setExcludedFields }) => sql`
|
||||
on conflict (${sql.join(fields, sql`, `)}) do update
|
||||
set ${setExcluded(...setExcludedFields)}
|
||||
`
|
||||
)}
|
||||
`);
|
||||
|
||||
assertThat(!returning || entry, 'entity.create_failed', { name: rest.tableSingular });
|
||||
|
|
|
@ -11,37 +11,37 @@ const { table, fields } = convertToIdentifiers(Resources);
|
|||
|
||||
export const findAllResources = async () =>
|
||||
pool.many<Resource>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
`);
|
||||
|
||||
export const hasResource = async (indentifier: string) =>
|
||||
pool.exists(sql`
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.identifier}=${indentifier}
|
||||
`);
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.identifier}=${indentifier}
|
||||
`);
|
||||
|
||||
export const hasResourceWithId = async (id: string) =>
|
||||
pool.exists(sql`
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
|
||||
export const findResourceByIdentifier = async (indentifier: string) =>
|
||||
pool.maybeOne<Resource>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.identifier}=${indentifier}
|
||||
`);
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.identifier}=${indentifier}
|
||||
`);
|
||||
|
||||
export const findResourceById = async (id: string) =>
|
||||
pool.one<Resource>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
|
||||
export const insertResource = buildInsertInto<ResourceDBEntry, Resource>(pool, Resources, {
|
||||
returning: true,
|
||||
|
@ -56,9 +56,9 @@ export const updateResourceById = async (
|
|||
|
||||
export const deleteResourceById = async (id: string) => {
|
||||
const { rowCount } = await pool.query(sql`
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
if (rowCount < 1) {
|
||||
throw new RequestError({
|
||||
code: 'entity.not_exists_with_id',
|
||||
|
|
|
@ -13,7 +13,7 @@ export const findAllScopesWithResourceId = async (resourceId: string) =>
|
|||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.resourceId}=${resourceId}
|
||||
`);
|
||||
`);
|
||||
|
||||
export const insertScope = buildInsertInto<ResourceScopeDBEntry, ResourceScope>(
|
||||
pool,
|
||||
|
@ -25,9 +25,9 @@ export const insertScope = buildInsertInto<ResourceScopeDBEntry, ResourceScope>(
|
|||
|
||||
export const deleteScopeById = async (id: string) => {
|
||||
const { rowCount } = await pool.query(sql`
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
if (rowCount < 1) {
|
||||
throw new RequestError({
|
||||
code: 'entity.not_exists_with_id',
|
||||
|
|
|
@ -11,31 +11,31 @@ const { table, fields } = convertToIdentifiers(Users);
|
|||
|
||||
export const findUserByUsername = async (username: string) =>
|
||||
pool.one<User>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.username}=${username}
|
||||
`);
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.username}=${username}
|
||||
`);
|
||||
|
||||
export const findUserById = async (id: string) =>
|
||||
pool.one<User>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
select ${sql.join(Object.values(fields), sql`,`)}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
|
||||
export const hasUser = async (username: string) =>
|
||||
pool.exists(sql`
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.username}=${username}
|
||||
`);
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.username}=${username}
|
||||
`);
|
||||
|
||||
export const hasUserWithId = async (id: string) =>
|
||||
pool.exists(sql`
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
select ${fields.id}
|
||||
from ${table}
|
||||
where ${fields.id}=${id}
|
||||
`);
|
||||
|
||||
export const insertUser = buildInsertInto<UserDBEntry, User>(pool, Users, { returning: true });
|
||||
|
||||
|
@ -52,9 +52,9 @@ export const updateUserById = async (id: string, set: Partial<OmitAutoSetFields<
|
|||
|
||||
export const deleteUserById = async (id: string) => {
|
||||
const { rowCount } = await pool.query(sql`
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
delete from ${table}
|
||||
where id=${id}
|
||||
`);
|
||||
if (rowCount < 1) {
|
||||
throw new RequestError({
|
||||
code: 'entity.not_exists_with_id',
|
||||
|
|
|
@ -26,7 +26,10 @@ export const encryptPassword = (
|
|||
{ method }
|
||||
);
|
||||
|
||||
const sum = [...id].reduce((accumulator, current) => accumulator + current.charCodeAt(0), 0);
|
||||
const sum = [...id].reduce(
|
||||
(accumulator, current) => accumulator + (current.codePointAt(0) ?? 0),
|
||||
0
|
||||
);
|
||||
const pepper = peppers[sum % peppers.length];
|
||||
|
||||
assertThat(pepper, 'password.pepper_not_found');
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
"url": "https://github.com/logto-io/logto/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.2.2",
|
||||
"@silverhand/ts-config": "^0.2.2",
|
||||
"eslint": "^7.32.0",
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"eslint": "^8.1.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"prettier": "^2.3.2",
|
||||
"typescript": "^4.3.5"
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
"node": ">=14.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "^0.2.2",
|
||||
"@silverhand/eslint-config": "^0.4.0",
|
||||
"@silverhand/essentials": "^1.1.0",
|
||||
"@silverhand/ts-config": "^0.2.2",
|
||||
"@silverhand/ts-config": "^0.4.0",
|
||||
"@types/lodash.uniq": "^4.5.6",
|
||||
"@types/node": "14",
|
||||
"@types/pluralize": "^0.0.29",
|
||||
"camelcase": "^6.2.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint": "^8.1.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
"lodash.uniq": "^4.5.0",
|
||||
"pluralize": "^8.0.0",
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
import { ZodObject, ZodType, ZodOptional } from 'zod';
|
||||
|
||||
export type Guard<T extends Record<string, unknown>> = ZodObject<
|
||||
{
|
||||
[key in keyof T]-?: undefined extends T[key]
|
||||
? ZodOptional<ZodType<Exclude<T[key], undefined>>>
|
||||
: ZodType<T[key]>;
|
||||
}
|
||||
>;
|
||||
export type Guard<T extends Record<string, unknown>> = ZodObject<{
|
||||
[key in keyof T]-?: undefined extends T[key]
|
||||
? ZodOptional<ZodType<Exclude<T[key], undefined>>>
|
||||
: ZodType<T[key]>;
|
||||
}>;
|
||||
|
||||
export type SchemaValuePrimitive = string | number | boolean | undefined;
|
||||
export type SchemaValue = SchemaValuePrimitive | Record<string, unknown> | null;
|
||||
|
|
|
@ -29,7 +29,8 @@ const generate = async () => {
|
|||
files
|
||||
.filter((file) => file.endsWith('.sql'))
|
||||
.map<Promise<[string, FileData]>>(async (file) => {
|
||||
const statements = (await fs.readFile(path.join(directory, file), { encoding: 'utf-8' }))
|
||||
const paragraph = await fs.readFile(path.join(directory, file), { encoding: 'utf-8' });
|
||||
const statements = paragraph
|
||||
.split(';')
|
||||
.map((value) => normalizeWhitespaces(value))
|
||||
.map((value) => removeUnrecognizedComments(value));
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@jest/types": "^27.0.6",
|
||||
"@silverhand/eslint-config": "^0.2.2",
|
||||
"@silverhand/eslint-config-react": "^0.2.2",
|
||||
"@silverhand/ts-config": "^0.2.2",
|
||||
"@silverhand/ts-config-react": "^0.2.2",
|
||||
"@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",
|
||||
"@testing-library/react": "^12.0.0",
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/react": "^17.0.14",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"@types/webpack-env": "^1.16.2",
|
||||
"babel-preset-razzle": "4.0.5",
|
||||
"concurrently": "^6.2.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint": "^8.1.0",
|
||||
"html-webpack-plugin": "^4.5.2",
|
||||
"imports-loader": "^3.1.0",
|
||||
"lint-staged": "^11.1.1",
|
||||
|
|
|
@ -10,7 +10,7 @@ const Consent = () => {
|
|||
|
||||
useEffect(() => {
|
||||
void asyncConsent();
|
||||
}, []);
|
||||
}, [asyncConsent]);
|
||||
|
||||
useEffect(() => {
|
||||
if (result?.redirectTo) {
|
||||
|
|
5759
pnpm-lock.yaml
generated
5759
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue