Suggestion: let prettier sort imports order (#673)

* Suggestion: let prettier sort imports order

# Conflicts:
#	yarn.lock

* AUTO SORT ALL THE IMPORTS

* Linting

* Fixes test
This commit is contained in:
Omar López authored and GitHub committed 2021-09-22 13:52:38 -06:00
1 parent 3add84a279
commit d194878bb2
192 files changed
+921 -577

No files matched your search

+3 -2
View File
@@ -1,6 +1,7 @@
import { CalendarEvent } from "./calendarClient";
import { v5 as uuidv5 } from "uuid";
import short from "short-uuid";
import { v5 as uuidv5 } from "uuid";
import { CalendarEvent } from "./calendarClient";
import { stripHtml } from "./emails/helpers";
const translator = short();
+3 -2
View File
@@ -1,9 +1,10 @@
import React from "react";
import { createTelemetryClient, TelemetryProvider } from "@lib/telemetry";
import { Provider } from "next-auth/client";
import React from "react";
import { QueryClient, QueryClientProvider } from "react-query";
import { Hydrate } from "react-query/hydration";
import { createTelemetryClient, TelemetryProvider } from "@lib/telemetry";
export const queryClient = new QueryClient();
const AppProviders: React.FC = (props, pageProps) => {
+7 -5
View File
@@ -1,12 +1,14 @@
import EventOrganizerMail from "./emails/EventOrganizerMail";
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
import prisma from "./prisma";
import { Prisma, Credential } from "@prisma/client";
import CalEventParser from "./CalEventParser";
import { EventResult } from "@lib/events/EventManager";
import logger from "@lib/logger";
import { CalDavCalendar } from "./integrations/CalDav/CalDavCalendarAdapter";
import CalEventParser from "./CalEventParser";
import EventOrganizerMail from "./emails/EventOrganizerMail";
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
import { AppleCalendar } from "./integrations/Apple/AppleCalendarAdapter";
import { CalDavCalendar } from "./integrations/CalDav/CalDavCalendarAdapter";
import prisma from "./prisma";
const log = logger.getChildLogger({ prefix: ["[lib] calendarClient"] });
+1 -1
View File
@@ -1,7 +1,7 @@
// handles logic related to user clock display using 24h display / timeZone options.
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);
dayjs.extend(timezone);
+1
View File
@@ -1,4 +1,5 @@
import { DefaultSeoProps } from "next-seo";
import { HeadSeoProps } from "@components/seo/head-seo";
const seoImages = {
+5 -5
View File
@@ -1,9 +1,9 @@
import dayjs, { Dayjs } from "dayjs";
import EventMail from "./EventMail";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
import EventMail from "./EventMail";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -160,6 +160,6 @@ export default class EventAttendeeMail extends EventMail {
* @private
*/
protected getInviteeStart(): Dayjs {
return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
return dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
}
}
+3 -2
View File
@@ -1,8 +1,9 @@
import nodemailer from "nodemailer";
import CalEventParser from "../CalEventParser";
import { stripHtml } from "./helpers";
import { CalendarEvent, ConferenceData } from "../calendarClient";
import { serverConfig } from "../serverConfig";
import nodemailer from "nodemailer";
import { stripHtml } from "./helpers";
export interface EntryPoint {
entryPointType?: string;
+6 -6
View File
@@ -1,11 +1,11 @@
import { createEvent } from "ics";
import dayjs, { Dayjs } from "dayjs";
import EventMail from "./EventMail";
import utc from "dayjs/plugin/utc";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import toArray from "dayjs/plugin/toArray";
import localizedFormat from "dayjs/plugin/localizedFormat";
import utc from "dayjs/plugin/utc";
import { createEvent } from "ics";
import EventMail from "./EventMail";
import { stripHtml } from "./helpers";
dayjs.extend(utc);
@@ -217,6 +217,6 @@ export default class EventOrganizerMail extends EventMail {
* @private
*/
protected getOrganizerStart(): Dayjs {
return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
}
}
+6 -6
View File
@@ -1,11 +1,11 @@
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import toArray from "dayjs/plugin/toArray";
import localizedFormat from "dayjs/plugin/localizedFormat";
import EventOrganizerMail from "@lib/emails/EventOrganizerMail";
import utc from "dayjs/plugin/utc";
import { CalendarEvent } from "@lib/calendarClient";
import EventOrganizerMail from "@lib/emails/EventOrganizerMail";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -27,7 +27,7 @@ export default class EventOrganizerRefundFailedMail extends EventOrganizerMail {
}
protected getBodyText(): string {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return `The refund for the event ${this.calEvent.type} with ${
this.calEvent.attendees[0].name
} on ${organizerStart.format("LT dddd, LL")} failed. Please check with your payment provider and ${
@@ -57,7 +57,7 @@ export default class EventOrganizerRefundFailedMail extends EventOrganizerMail {
}
protected getSubject(): string {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return `Refund failed: ${this.calEvent.attendees[0].name} - ${organizerStart.format("LT dddd, LL")} - ${
this.calEvent.type
}`;
+4 -4
View File
@@ -1,9 +1,9 @@
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import toArray from "dayjs/plugin/toArray";
import localizedFormat from "dayjs/plugin/localizedFormat";
import utc from "dayjs/plugin/utc";
import EventOrganizerMail from "@lib/emails/EventOrganizerMail";
dayjs.extend(utc);
@@ -42,7 +42,7 @@ export default class EventOrganizerRequestMail extends EventOrganizerMail {
}
protected getSubject(): string {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return `New event request: ${this.calEvent.attendees[0].name} - ${organizerStart.format(
"LT dddd, LL"
)} - ${this.calEvent.type}`;
@@ -1,9 +1,9 @@
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import toArray from "dayjs/plugin/toArray";
import localizedFormat from "dayjs/plugin/localizedFormat";
import utc from "dayjs/plugin/utc";
import EventOrganizerRequestMail from "@lib/emails/EventOrganizerRequestMail";
dayjs.extend(utc);
@@ -17,7 +17,7 @@ export default class EventOrganizerRequestReminderMail extends EventOrganizerReq
}
protected getSubject(): string {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return `Event request is still waiting: ${this.calEvent.attendees[0].name} - ${organizerStart.format(
"LT dddd, LL"
)} - ${this.calEvent.type}`;
+2 -1
View File
@@ -1,4 +1,5 @@
import dayjs, { Dayjs } from "dayjs";
import EventOrganizerMail from "./EventOrganizerMail";
export default class EventOrganizerRescheduledMail extends EventOrganizerMail {
@@ -48,7 +49,7 @@ export default class EventOrganizerRescheduledMail extends EventOrganizerMail {
* @protected
*/
protected getNodeMailerPayload(): Record<string, unknown> {
const organizerStart: Dayjs = <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
const organizerStart: Dayjs = dayjs(this.calEvent.startTime).tz(this.calEvent.organizer.timeZone);
return {
icalEvent: {
+6 -5
View File
@@ -1,11 +1,12 @@
import dayjs, { Dayjs } from "dayjs";
import EventMail, { AdditionInformation } from "./EventMail";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
import { CalendarEvent } from "@lib/calendarClient";
import EventMail, { AdditionInformation } from "./EventMail";
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(localizedFormat);
@@ -160,6 +161,6 @@ export default class EventPaymentMail extends EventMail {
* @private
*/
protected getInviteeStart(): Dayjs {
return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
return dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
}
}
+5 -5
View File
@@ -1,9 +1,9 @@
import dayjs, { Dayjs } from "dayjs";
import EventMail from "./EventMail";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import localizedFormat from "dayjs/plugin/localizedFormat";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
import EventMail from "./EventMail";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -86,6 +86,6 @@ export default class EventRejectionMail extends EventMail {
* @private
*/
protected getInviteeStart(): Dayjs {
return <Dayjs>dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
return dayjs(this.calEvent.startTime).tz(this.calEvent.attendees[0].timeZone);
}
}
+3 -2
View File
@@ -1,8 +1,9 @@
import { AdditionInformation } from "@lib/emails/EventMail";
import { CalendarEvent } from "../calendarClient";
import { VideoCallData } from "../videoClient";
import EventAttendeeMail from "./EventAttendeeMail";
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
import { VideoCallData } from "../videoClient";
import { AdditionInformation } from "@lib/emails/EventMail";
export default class VideoEventAttendeeMail extends EventAttendeeMail {
videoCallData: VideoCallData;
+5 -4
View File
@@ -1,9 +1,10 @@
import { CalendarEvent } from "../calendarClient";
import EventOrganizerMail from "./EventOrganizerMail";
import { VideoCallData } from "../videoClient";
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
import { AdditionInformation } from "@lib/emails/EventMail";
import { CalendarEvent } from "../calendarClient";
import { VideoCallData } from "../videoClient";
import EventOrganizerMail from "./EventOrganizerMail";
import { getFormattedMeetingId, getIntegrationName } from "./helpers";
export default class VideoEventOrganizerMail extends EventOrganizerMail {
videoCallData: VideoCallData;
+2 -1
View File
@@ -1,6 +1,7 @@
import { serverConfig } from "../serverConfig";
import nodemailer from "nodemailer";
import { serverConfig } from "../serverConfig";
export default function createInvitationEmail(data: any, options: any = {}) {
return sendEmail(data, {
provider: {
+2 -1
View File
@@ -1,6 +1,7 @@
import { serverConfig } from "../serverConfig";
import nodemailer, { SentMessageInfo } from "nodemailer";
import { serverConfig } from "../serverConfig";
const sendEmail = ({ to, subject, text, html = null }): Promise<string | SentMessageInfo> =>
new Promise((resolve, reject) => {
const { transport, from } = serverConfig;
+6 -5
View File
@@ -1,13 +1,14 @@
import { CalendarEvent, createEvent, updateEvent } from "@lib/calendarClient";
import { Credential } from "@prisma/client";
import async from "async";
import { createMeeting, updateMeeting } from "@lib/videoClient";
import prisma from "@lib/prisma";
import { LocationType } from "@lib/location";
import { v5 as uuidv5 } from "uuid";
import merge from "lodash.merge";
import { v5 as uuidv5 } from "uuid";
import { CalendarEvent, createEvent, updateEvent } from "@lib/calendarClient";
import EventAttendeeMail from "@lib/emails/EventAttendeeMail";
import EventAttendeeRescheduledMail from "@lib/emails/EventAttendeeRescheduledMail";
import { LocationType } from "@lib/location";
import prisma from "@lib/prisma";
import { createMeeting, updateMeeting } from "@lib/videoClient";
export interface EventResult {
type: string;
+5 -2
View File
@@ -1,10 +1,13 @@
import { useState, useEffect } from "react";
import getSlots from "@lib/slots";
import { User, SchedulingType } from "@prisma/client";
import dayjs, { Dayjs } from "dayjs";
import isBetween from "dayjs/plugin/isBetween";
import utc from "dayjs/plugin/utc";
import { useState, useEffect } from "react";
import getSlots from "@lib/slots";
import { FreeBusyTime } from "@components/ui/Schedule/Schedule";
dayjs.extend(isBetween);
dayjs.extend(utc);
@@ -1,5 +1,7 @@
import { IntegrationCalendar, CalendarApiAdapter, CalendarEvent } from "../../calendarClient";
import { symmetricDecrypt } from "@lib/crypto";
import { Credential } from "@prisma/client";
import dayjs from "dayjs";
import ICAL from "ical.js";
import { createEvent, DurationObject, Attendee, Person } from "ics";
import {
createAccount,
fetchCalendars,
@@ -9,14 +11,14 @@ import {
updateCalendarObject,
deleteCalendarObject,
} from "tsdav";
import { Credential } from "@prisma/client";
import ICAL from "ical.js";
import { createEvent, DurationObject, Attendee, Person } from "ics";
import dayjs from "dayjs";
import { v4 as uuidv4 } from "uuid";
import { stripHtml } from "../../emails/helpers";
import { symmetricDecrypt } from "@lib/crypto";
import logger from "@lib/logger";
import { IntegrationCalendar, CalendarApiAdapter, CalendarEvent } from "../../calendarClient";
import { stripHtml } from "../../emails/helpers";
const log = logger.getChildLogger({ prefix: ["[[lib] apple calendar"] });
type EventBusyDate = Record<"start" | "end", Date>;
@@ -1,5 +1,7 @@
import { CalendarApiAdapter, CalendarEvent, IntegrationCalendar } from "../../calendarClient";
import { symmetricDecrypt } from "@lib/crypto";
import { Credential } from "@prisma/client";
import dayjs from "dayjs";
import ICAL from "ical.js";
import { Attendee, createEvent, DurationObject, Person } from "ics";
import {
createAccount,
createCalendarObject,
@@ -9,14 +11,14 @@ import {
getBasicAuthHeaders,
updateCalendarObject,
} from "tsdav";
import { Credential } from "@prisma/client";
import ICAL from "ical.js";
import { Attendee, createEvent, DurationObject, Person } from "ics";
import dayjs from "dayjs";
import { v4 as uuidv4 } from "uuid";
import { stripHtml } from "../../emails/helpers";
import { symmetricDecrypt } from "@lib/crypto";
import logger from "@lib/logger";
import { CalendarApiAdapter, CalendarEvent, IntegrationCalendar } from "../../calendarClient";
import { stripHtml } from "../../emails/helpers";
const log = logger.getChildLogger({ prefix: ["[lib] caldav"] });
type EventBusyDate = Record<"start" | "end", Date>;
+2 -1
View File
@@ -1,6 +1,7 @@
import { validJson } from "@lib/jsonUtils";
import { Prisma } from "@prisma/client";
import { validJson } from "@lib/jsonUtils";
const credentialData = Prisma.validator<Prisma.CredentialArgs>()({
select: { id: true, type: true, key: true },
});
@@ -1,6 +1,7 @@
import { EventType } from "@prisma/client";
import * as fetch from "@lib/core/http/fetch-wrapper";
import { CreateEventType } from "@lib/types/event-type";
import { EventType } from "@prisma/client";
const createEventType = async (data: CreateEventType) => {
const response = await fetch.post<CreateEventType, EventType>("/api/availability/eventtype", data);
@@ -1,6 +1,7 @@
import { EventType } from "@prisma/client";
import * as fetch from "@lib/core/http/fetch-wrapper";
import { EventTypeInput } from "@lib/types/event-type";
import { EventType } from "@prisma/client";
const updateEventType = async (data: EventTypeInput) => {
const response = await fetch.patch<EventTypeInput, EventType>("/api/availability/eventtype", data);
+2 -1
View File
@@ -1,6 +1,7 @@
import * as fetch from "@lib/core/http/fetch-wrapper";
import { EventType } from "@prisma/client";
import * as fetch from "@lib/core/http/fetch-wrapper";
type GetEventsResponse = { message: string; data: EventType[] };
const getEventTypes = async () => {
const response = await fetch.get<GetEventsResponse>("/api/event-type");
+3 -2
View File
@@ -1,6 +1,7 @@
import dayjs, { Dayjs } from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import utc from "dayjs/plugin/utc";
dayjs.extend(utc);
dayjs.extend(timezone);
@@ -94,7 +95,7 @@ const getSlotsBetweenBoundary = (frequency: number, { lowerBound, upperBound }:
const slots: Dayjs[] = [];
for (let minutes = 0; lowerBound + minutes <= upperBound - frequency; minutes += frequency) {
slots.push(
<Dayjs>dayjs
dayjs
.utc()
.startOf("d")
.add(lowerBound + minutes, "minutes")
+1
View File
@@ -1,4 +1,5 @@
import { Team } from "@prisma/client";
import prisma from "@lib/prisma";
import { defaultAvatarSrc } from "@lib/profile";
+1 -1
View File
@@ -1,5 +1,5 @@
import React, { useContext } from "react";
import { jitsuClient, JitsuClient } from "@jitsu/sdk-js";
import React, { useContext } from "react";
/**
* Enumeration of all event types that are being sent
+2 -1
View File
@@ -1,6 +1,7 @@
import { LocationType } from "@lib/location";
import { Booking } from "@prisma/client";
import { LocationType } from "@lib/location";
export type BookingCreateBody = {
email: string;
end: string;
+13 -11
View File
@@ -1,17 +1,19 @@
import prisma from "./prisma";
import { CalendarEvent } from "./calendarClient";
import VideoEventOrganizerMail from "./emails/VideoEventOrganizerMail";
import VideoEventAttendeeMail from "./emails/VideoEventAttendeeMail";
import { v5 as uuidv5 } from "uuid";
import { Credential } from "@prisma/client";
import short from "short-uuid";
import EventAttendeeRescheduledMail from "./emails/EventAttendeeRescheduledMail";
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
import { EventResult } from "@lib/events/EventManager";
import logger from "@lib/logger";
import { v5 as uuidv5 } from "uuid";
import CalEventParser from "@lib/CalEventParser";
import { AdditionInformation, EntryPoint } from "@lib/emails/EventMail";
import { getIntegrationName } from "@lib/emails/helpers";
import CalEventParser from "@lib/CalEventParser";
import { Credential } from "@prisma/client";
import { EventResult } from "@lib/events/EventManager";
import logger from "@lib/logger";
import { CalendarEvent } from "./calendarClient";
import EventAttendeeRescheduledMail from "./emails/EventAttendeeRescheduledMail";
import EventOrganizerRescheduledMail from "./emails/EventOrganizerRescheduledMail";
import VideoEventAttendeeMail from "./emails/VideoEventAttendeeMail";
import VideoEventOrganizerMail from "./emails/VideoEventOrganizerMail";
import prisma from "./prisma";
const log = logger.getChildLogger({ prefix: ["[lib] videoClient"] });