Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency @theguild/eslint-config to v0.13.2 + Fix Lint Errors #5974

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@parcel/watcher": "2.5.0",
"@sentry/cli": "2.38.2",
"@swc/core": "1.9.2",
"@theguild/eslint-config": "0.12.1",
"@theguild/eslint-config": "0.13.2",
"@theguild/prettier-config": "2.0.7",
"@types/node": "22.9.3",
"bob-the-bundler": "7.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/libraries/cli/src/commands/schema/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default class SchemaPublish extends Command<typeof SchemaPublish> {
// If we are able to parse it, it means it's a valid JSON, let's use it as-is

return metadata;
} catch (e) {
} catch {
// If we can't parse it, we can try to load it from FS
const exists = existsSync(metadata);

Expand All @@ -167,7 +167,7 @@ export default class SchemaPublish extends Command<typeof SchemaPublish> {
JSON.parse(fileContent);

return fileContent;
} catch (e) {
} catch {
throw new Error(
`Failed to load metadata from file "${metadata}": Please make sure the file is readable and contains a valid JSON`,
);
Expand Down
4 changes: 2 additions & 2 deletions packages/libraries/cli/src/helpers/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export class Config {
throw new Error('Invalid config.');
}
}
} catch (error) {
} catch {
this.cache = {
registry: {
endpoint: undefined,
Expand All @@ -241,7 +241,7 @@ export class Config {
this.cache = map;
try {
mkdirp(path.dirname(this.filepath));
} catch (e) {}
} catch {}
fs.writeFileSync(this.filepath, JSON.stringify(this.cache));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ class AwsV4Signer {
try {
/** @type {string} */
this.encodedPath = decodeURIComponent(this.url.pathname.replace(/\+/g, ' '));
} catch (e) {
} catch {
this.encodedPath = this.url.pathname;
}
} else {
Expand Down
10 changes: 6 additions & 4 deletions packages/migrations/test/utils/testkit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/first */

import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { config } from 'dotenv';
Expand All @@ -25,11 +25,11 @@ export async function initMigrationTestingEnvironment() {
...env.postgres,
db: 'postgres',
}));

const dbName = 'migration_test_' + Date.now() + Math.random().toString(16).substring(2);
console.log('db name:', dbName)
await db.query(`CREATE DATABASE ${dbName};`);

const connectionString = createConnectionString({
...env.postgres,
db: dbName,
Expand Down Expand Up @@ -113,7 +113,9 @@ export async function initMigrationTestingEnvironment() {
await runPGMigrations({ slonik });
},
async done(deleteDb = true) {
deleteDb ?? (await db.query(`DROP DATABASE ${dbName};`));
if (deleteDb) {
await db.query(`DROP DATABASE ${dbName};`);
}
Comment on lines -116 to +118
Copy link
Collaborator

@dimaMachina dimaMachina Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n1ru4l I think the previous condition was incorrect

when deleteDb: true => do nothing
when deleteDb: false => do nothing
when deleteDb: null | undefined => delete db

should I change to if (deleteDb == null) { to match previous behaviour?

await db.$pool.end().catch();
},
};
Expand Down
1 change: 1 addition & 0 deletions packages/services/api/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface RegistryContext {

declare global {
namespace GraphQLModules {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- can't use `type`
interface GlobalContext extends RegistryContext {}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Scalars } from '../../__generated__/types';
import type { AdminOrganizationStats } from '../../shared/entities';

export type AdminQueryMapper = {};
export type AdminQueryMapper = object;
export type AdminStatsMapper = {
period: {
from: Scalars['DateTime']['input'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class AppDeployments {
private storage: Storage,
private schemaVersionHelper: SchemaVersionHelper,
private persistedDocumentScheduler: PersistedDocumentScheduler,
@Inject(APP_DEPLOYMENTS_ENABLED) private appDeploymentsEnabled: Boolean,
@Inject(APP_DEPLOYMENTS_ENABLED) private appDeploymentsEnabled: boolean,
) {
this.logger = logger.child({ source: 'AppDeployments' });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/services/api/src/modules/cdn/providers/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export class AwsV4Signer {
try {
/** @type {string} */
this.encodedPath = decodeURIComponent(this.url.pathname.replace(/\+/g, ' '));
} catch (e) {
} catch {
this.encodedPath = this.url.pathname;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export class RegistryChecks {
}),
)
: null;
} catch (error) {
} catch {
this.logger.error('Failed to build schema for diff. Skip diff check.');
return {
status: 'skipped',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Organization: Pick<
viewerCanManageSupportTickets: async (organization, _arg, { session, injector }) => {
try {
injector.get(SupportManager);
} catch (err) {
} catch {
return false;
}
return await session.canPerformAction({
Expand Down
2 changes: 1 addition & 1 deletion packages/services/api/src/shared/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function parseDateTime(value: number | string | Date): Date {
if (typeof value === 'number') {
try {
return new UTCDate(value);
} catch (e) {
} catch {
throw new TypeError('DateTime cannot represent an invalid Unix timestamp ' + value);
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/services/broker-worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ const handler: ExportedHandler<Env> = {
};

function flush() {
loki && ctx.waitUntil(loki.flush());
if (loki) {
ctx.waitUntil(loki.flush());
}
}

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/cdn-worker/src/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export class AwsV4Signer {
try {
/** @type {string} */
this.encodedPath = decodeURIComponent(this.url.pathname.replace(/\+/g, ' '));
} catch (e) {
} catch {
this.encodedPath = this.url.pathname;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/cdn-worker/src/cdn-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function decodeCdnAccessTokenSafe(token: string) {

try {
str = globalThis.atob(token);
} catch (error) {
} catch {
return decodeError;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/services/emails/src/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ interface Email {
body: string;
}

const emailProviders = {
const _emailProviders = {
postmark,
mock,
smtp,
sendmail,
};

export interface EmailProvider {
id: keyof typeof emailProviders;
id: keyof typeof _emailProviders;
send(email: Email): Promise<void>;
history: Email[];
}
Expand Down
6 changes: 3 additions & 3 deletions packages/services/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export async function main() {
method: ['GET', 'HEAD'],
url: '/_health',
async handler(_, res) {
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
res.status(200).send();
},
});

Expand Down Expand Up @@ -497,15 +497,15 @@ export async function main() {
req.log.error(`Readiness check failed: [${response.statusCode}] ${response.body}`);
} else {
reportReadiness(true);
res.status(200).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
res.status(200).send();
return;
}
} catch (error) {
req.log.error(error);
}

reportReadiness(false);
res.status(400).send(); // eslint-disable-line @typescript-eslint/no-floating-promises -- false positive, FastifyReply.then returns void
res.status(400).send();
},
});

Expand Down
9 changes: 0 additions & 9 deletions packages/services/server/src/supertokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { ProviderInput } from 'supertokens-node/recipe/thirdparty/types';
import ThirdPartyEmailPasswordNode from 'supertokens-node/recipe/thirdpartyemailpassword/index.js';
import type { TypeInput as ThirdPartEmailPasswordTypeInput } from 'supertokens-node/recipe/thirdpartyemailpassword/types';
import type { TypeInput } from 'supertokens-node/types';
import zod from 'zod';
import { type Storage } from '@hive/api';
import type { EmailsApi } from '@hive/emails';
import { createTRPCProxyClient, httpLink } from '@trpc/client';
Expand All @@ -21,14 +20,6 @@ import {
} from './supertokens/oidc-provider';
import { createThirdPartyEmailPasswordNodeOktaProvider } from './supertokens/okta-provider';

const SuperTokenAccessTokenModel = zod.object({
version: zod.literal('1'),
superTokensUserId: zod.string(),
email: zod.string(),
});

export type SupertokensSession = zod.TypeOf<typeof SuperTokenAccessTokenModel>;

export const backendConfig = (requirements: {
storage: Storage;
crypto: CryptoProvider;
Expand Down
6 changes: 3 additions & 3 deletions packages/services/server/src/use-armor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const getHiveClientVersion = (userAgent: string | null) => {
};

export function useArmor<
PluginContext extends Record<string, any> = {},
TServerContext extends Record<string, any> = {},
TUserContext = {},
PluginContext extends Record<string, any> = object,
TServerContext extends Record<string, any> = object,
TUserContext = object,
>(): Plugin<PluginContext, TServerContext, TUserContext> {
return {
onValidate(ctx) {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/service-common/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ type FunctionTraceOptions<TArgs extends any[], TResult> = {
errorAttributes?: Attributes | ((error: Error) => Attributes);
};

export function traceFn<This extends Object, TArgs extends any[], TResult>(
export function traceFn<This extends object, TArgs extends any[], TResult>(
spanName: string,
options?: FunctionTraceOptions<TArgs, Awaited<TResult>>,
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/service-common/src/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const handleTRPCError = experimental_standaloneMiddleware<{
ctx: {
req: FastifyRequest;
};
input: {};
input: unknown;
}>().create(async opts => {
const result = await opts.next();

Expand Down
4 changes: 3 additions & 1 deletion packages/services/storage/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export type { tokens, schema_policy_resource } from './db/types';

type Connection = DatabasePool | DatabaseTransactionConnection;

type OverrideProp<T extends {}, K extends keyof T, V extends T[K]> = Omit<T, K> & { [P in K]: V };
type OverrideProp<T extends object, K extends keyof T, V extends T[K]> = Omit<T, K> & {
[P in K]: V;
};

type schema_log = Omit<schema_log_in_db, 'action'> & {
action: 'PUSH' | 'DELETE';
Expand Down
4 changes: 2 additions & 2 deletions packages/services/storage/src/schema-change-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ export const InsertConditionalBreakingChangeMetadataModel =
},
})).nullable();

const SchemaCheckInputModel = z.union([
const _SchemaCheckInputModel = z.union([
z.intersection(
z.object({
isSuccess: z.literal(false),
Expand Down Expand Up @@ -1106,7 +1106,7 @@ export const SchemaCheckModel = z.union([
),
]);

export type SchemaCheckInput = z.TypeOf<typeof SchemaCheckInputModel>;
export type SchemaCheckInput = z.TypeOf<typeof _SchemaCheckInputModel>;
export type SchemaCheck = z.TypeOf<typeof SchemaCheckModel>;

export const TargetBreadcrumbModel = z
Expand Down
2 changes: 1 addition & 1 deletion packages/services/stripe-billing/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const stripeBillingApiRouter = t.router({
});

return upcomingInvoice;
} catch (e) {
} catch {
return null;
}
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function normalizeOperation(operation: {
let parsed: DocumentNode;
try {
parsed = parse(operation.document);
} catch (error) {
} catch {
// No need to log this, it's already logged by the usage service
// We do check for parse errors here (in addition to the usage service),
// because the usage service was not parsing the operations before and we got corrupted documents in the Kafka loop.
Expand Down
2 changes: 1 addition & 1 deletion packages/services/usage/src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function createTokens(config: { endpoint: string; logger: ServiceLogger }
return result;
}
return TokenStatus.NotFound;
} catch (error) {
} catch {
return TokenStatus.NotFound;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/services/usage/src/usage-processor-1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ export function isValidOperationBody(operation: string) {
});
validOperationBodyCache.set(operation, true);
return true;
} catch (error) {
} catch {
validOperationBodyCache.set(operation, false);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HiveStripeWrapper } from '@/lib/billing/stripe';
* Utility for wrapping a component with an authenticated container that has the default application layout.
*/
export const authenticated =
<TProps extends {}>(Component: (props: TProps) => ReactElement | null) =>
<TProps extends object>(Component: (props: TProps) => ReactElement | null) =>
(props: TProps) => {
return (
<SessionAuth>
Expand Down
4 changes: 1 addition & 3 deletions packages/web/app/src/components/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ const Command = React.forwardRef<
));
Command.displayName = CommandPrimitive.displayName;

interface CommandDialogProps extends DialogProps {}

const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
const CommandDialog = ({ children, ...props }: DialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0 shadow-lg">
Expand Down
4 changes: 2 additions & 2 deletions packages/web/app/src/components/ui/use-toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ToasterToast = ToastProps & {
action?: ToastActionElement;
};

const actionTypes = {
const _actionTypes = {
ADD_TOAST: 'ADD_TOAST',
UPDATE_TOAST: 'UPDATE_TOAST',
DISMISS_TOAST: 'DISMISS_TOAST',
Expand All @@ -26,7 +26,7 @@ function genId() {
return count.toString();
}

type ActionType = typeof actionTypes;
type ActionType = typeof _actionTypes;

type Action =
| {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const TransferOrganizationOwnership_Members = graphql(`
}
`);

const MemberFields = graphql(`
const _MemberFields = graphql(`
fragment MemberFields on Member {
id
user {
Expand All @@ -69,7 +69,7 @@ const MemberFields = graphql(`
`);

type Member = NonNullable<
FragmentType<typeof MemberFields>[' $fragmentRefs']
FragmentType<typeof _MemberFields>[' $fragmentRefs']
>['MemberFieldsFragment'];

const TransferOrganizationOwnershipModal_OrganizationFragment = graphql(`
Expand Down
Loading
Loading