Enforces explicit type imports (#7158)

* Enforces explicit type imports

* Upgrades typescript-eslint

* Upgrades eslint related dependencies

* Update config

* Sync packages mismatches

* Syncs prettier version

* Linting

* Relocks node version

* Fixes

* Locks @vitejs/plugin-react to 1.3.2

* Linting
This commit is contained in:
Omar López authored and GitHub committed 2023-02-16 15:39:57 -07:00
1 parent 3df289b557
commit 7c749299bb
425 files changed
+1216 -1069

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
import { CheckCircleIcon, ExclamationIcon, InformationCircleIcon, XCircleIcon } from "@heroicons/react/solid";
import classNames from "classnames";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { FiInfo } from "../icon";
+2 -1
View File
@@ -1,6 +1,7 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import { useRouter } from "next/router";
import { UIEvent, useEffect, useRef, useState } from "react";
import type { UIEvent } from "react";
import { useEffect, useRef, useState } from "react";
import { classNames } from "@calcom/lib";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+1 -1
View File
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
import useAddAppMutation from "@calcom/app-store/_utils/useAddAppMutation";
import { InstallAppButton } from "@calcom/app-store/components";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppFrontendPayload as App } from "@calcom/types/App";
import type { AppFrontendPayload as App } from "@calcom/types/App";
import type { CredentialFrontendPayload as Credential } from "@calcom/types/Credential";
import { Button } from "../button";
@@ -1,5 +1,5 @@
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppFrontendPayload as App } from "@calcom/types/App";
import type { AppFrontendPayload as App } from "@calcom/types/App";
import { AppCard } from "./AppCard";
import { Slider } from "./Slider";
+4 -2
View File
@@ -1,7 +1,9 @@
import Glide, { Options } from "@glidejs/glide";
import type { Options } from "@glidejs/glide";
import Glide from "@glidejs/glide";
import "@glidejs/glide/dist/css/glide.core.min.css";
import "@glidejs/glide/dist/css/glide.theme.min.css";
import { ComponentProps, FC, useEffect, useRef } from "react";
import type { ComponentProps, FC } from "react";
import { useEffect, useRef } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -1,4 +1,4 @@
import { AppFrontendPayload as App } from "@calcom/types/App";
import type { AppFrontendPayload as App } from "@calcom/types/App";
export const _SBApps: App[] = [
{
+1 -1
View File
@@ -5,7 +5,7 @@ import Link from "next/link";
import classNames from "@calcom/lib/classNames";
import { defaultAvatarSrc } from "@calcom/lib/defaultAvatarImage";
import { Maybe } from "@trpc/server";
import type { Maybe } from "@trpc/server";
import { FiCheck } from "../icon";
+1 -1
View File
@@ -1,7 +1,7 @@
import { GoPrimitiveDot } from "react-icons/go";
import classNames from "@calcom/lib/classNames";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
const badgeClassNameByVariant = {
default: "bg-orange-100 text-orange-800",
+5 -3
View File
@@ -1,10 +1,12 @@
import { cva, VariantProps } from "class-variance-authority";
import Link, { LinkProps } from "next/link";
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";
import type { LinkProps } from "next/link";
import Link from "next/link";
import React, { forwardRef } from "react";
import classNames from "@calcom/lib/classNames";
import { applyStyleToMultipleVariants } from "@calcom/lib/cva";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { FiPlus } from "../icon";
import { Tooltip } from "../tooltip";
@@ -1,6 +1,6 @@
import React from "react";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
interface LinkIconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
Icon: SVGComponent;
@@ -21,7 +21,7 @@ export function ButtonGroup({ children, combined = false, containerProps }: Prop
"flex",
!combined
? "space-x-2 rtl:space-x-reverse"
: "ltr:[&>*:first-child]:ml-0 ltr:[&>*:first-child]:rounded-l-md ltr:[&>*:first-child]:border-l rtl:[&>*:first-child]:rounded-r-md rtl:[&>*:first-child]:border-r ltr:[&>*:last-child]:rounded-r-md rtl:[&>*:last-child]:rounded-l-md [&_button]:rounded-none [&_a]:rounded-none [&>a]:-ml-[1px] hover:[&>a]:z-[1] [&>button]:-ml-[1px] hover:[&>button]:z-[1]",
: "[&_a]:rounded-none ltr:[&>*:first-child]:ml-0 ltr:[&>*:first-child]:rounded-l-md ltr:[&>*:first-child]:border-l rtl:[&>*:first-child]:rounded-r-md rtl:[&>*:first-child]:border-r ltr:[&>*:last-child]:rounded-r-md rtl:[&>*:last-child]:rounded-l-md [&_button]:rounded-none [&>a]:-ml-[1px] hover:[&>a]:z-[1] [&>button]:-ml-[1px] hover:[&>button]:z-[1]",
containerProps?.className
)}>
{children}
+1 -1
View File
@@ -1,6 +1,6 @@
// @TODO: turn this into a more generic component that has the same Props API as MUI https://mui.com/material-ui/react-card/
import Link from "next/link";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import React from "react";
import classNames from "@calcom/lib/classNames";
+2 -1
View File
@@ -2,7 +2,8 @@ import Link from "next/link";
import { classNames } from "@calcom/lib";
import { Badge, BadgeProps } from "../..";
import type { BadgeProps } from "../..";
import { Badge } from "../..";
import { Divider } from "../divider";
import { FiArrowDown, FiArrowUp, FiTrash } from "../icon";
@@ -1,5 +1,6 @@
import * as DialogPrimitive from "@radix-ui/react-dialog";
import React, { PropsWithChildren, ReactNode } from "react";
import type { PropsWithChildren, ReactNode } from "react";
import React from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
+8 -6
View File
@@ -1,14 +1,16 @@
import * as DialogPrimitive from "@radix-ui/react-dialog";
import { useRouter } from "next/router";
import React, { ReactNode, useState } from "react";
import type { ReactNode } from "react";
import React, { useState } from "react";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Button, ButtonProps } from "../../components/button";
import type { ButtonProps } from "../../components/button";
import { Button } from "../../components/button";
export type DialogProps = React.ComponentProps<typeof DialogPrimitive["Root"]> & {
export type DialogProps = React.ComponentProps<(typeof DialogPrimitive)["Root"]> & {
name?: string;
clearQueryParamsOnClose?: string[];
};
@@ -55,7 +57,7 @@ export function Dialog(props: DialogProps) {
return <DialogPrimitive.Root {...dialogProps}>{children}</DialogPrimitive.Root>;
}
type DialogContentProps = React.ComponentProps<typeof DialogPrimitive["Content"]> & {
type DialogContentProps = React.ComponentProps<(typeof DialogPrimitive)["Content"]> & {
size?: "xl" | "lg" | "md";
type?: "creation" | "confirmation";
title?: string;
@@ -142,7 +144,7 @@ export const DialogTrigger = DialogPrimitive.Trigger;
export function DialogClose(
props: {
dialogCloseProps?: React.ComponentProps<typeof DialogPrimitive["Close"]>;
dialogCloseProps?: React.ComponentProps<(typeof DialogPrimitive)["Close"]>;
children?: ReactNode;
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;
disabled?: boolean;
@@ -12,18 +12,14 @@ import { $createHeadingNode, $isHeadingNode } from "@lexical/rich-text";
import { $isAtNodeEnd, $wrapNodes } from "@lexical/selection";
import { $getNearestNodeOfType, mergeRegister } from "@lexical/utils";
import classNames from "classnames";
import type { EditorState, GridSelection, LexicalEditor, NodeSelection, RangeSelection } from "lexical";
import {
$createParagraphNode,
$getRoot,
$getSelection,
$insertNodes,
$isRangeSelection,
EditorState,
FORMAT_TEXT_COMMAND,
GridSelection,
LexicalEditor,
NodeSelection,
RangeSelection,
SELECTION_CHANGE_COMMAND,
} from "lexical";
import { useCallback, useEffect, useRef, useState } from "react";
@@ -32,7 +28,7 @@ import { createPortal } from "react-dom";
import { Button } from "../../button";
import { Dropdown, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../form/dropdown";
import { FiChevronDown } from "../../icon";
import { TextEditorProps } from "../Editor";
import type { TextEditorProps } from "../Editor";
import { AddVariablesDropdown } from "./AddVariablesDropdown";
const LowPriority = 1;
@@ -1,7 +1,8 @@
import React, { ReactNode } from "react";
import { IconType } from "react-icons";
import type { ReactNode } from "react";
import React from "react";
import type { IconType } from "react-icons";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Button } from "../../components/button";
@@ -1,4 +1,5 @@
import React, { ErrorInfo } from "react";
import type { ErrorInfo } from "react";
import React from "react";
class ErrorBoundary extends React.Component<
{ children: React.ReactNode; message?: string },
@@ -1,4 +1,5 @@
import React, { forwardRef, InputHTMLAttributes } from "react";
import type { InputHTMLAttributes } from "react";
import React, { forwardRef } from "react";
import classNames from "@calcom/lib/classNames";
@@ -1,6 +1,8 @@
import React, { Dispatch, SetStateAction } from "react";
import { components, GroupBase, OptionProps } from "react-select";
import { Props } from "react-select";
import type { Dispatch, SetStateAction } from "react";
import React from "react";
import type { GroupBase, OptionProps } from "react-select";
import { components } from "react-select";
import type { Props } from "react-select";
import { classNames } from "@calcom/lib";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -1,16 +1,17 @@
import { CheckCircleIcon } from "@heroicons/react/outline";
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import Link from "next/link";
import { ComponentProps, forwardRef } from "react";
import type { ComponentProps } from "react";
import { forwardRef } from "react";
import { classNames } from "@calcom/lib";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { ButtonColor } from "../../button/Button";
import type { ButtonColor } from "../../button/Button";
export const Dropdown = DropdownMenuPrimitive.Root;
type DropdownMenuTriggerProps = ComponentProps<typeof DropdownMenuPrimitive["Trigger"]>;
type DropdownMenuTriggerProps = ComponentProps<(typeof DropdownMenuPrimitive)["Trigger"]>;
export const DropdownMenuTrigger = forwardRef<HTMLButtonElement, DropdownMenuTriggerProps>(
({ className = "", ...props }, forwardedRef) => (
<DropdownMenuPrimitive.Trigger
@@ -29,7 +30,7 @@ export const DropdownMenuTriggerItem = DropdownMenuPrimitive.Trigger;
export const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
type DropdownMenuContentProps = ComponentProps<typeof DropdownMenuPrimitive["Content"]>;
type DropdownMenuContentProps = ComponentProps<(typeof DropdownMenuPrimitive)["Content"]>;
export const DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenuContentProps>(
({ children, sideOffset = 2, align = "end", ...props }, forwardedRef) => {
return (
@@ -49,12 +50,12 @@ export const DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenuConten
);
DropdownMenuContent.displayName = "DropdownMenuContent";
type DropdownMenuLabelProps = ComponentProps<typeof DropdownMenuPrimitive["Label"]>;
type DropdownMenuLabelProps = ComponentProps<(typeof DropdownMenuPrimitive)["Label"]>;
export const DropdownMenuLabel = (props: DropdownMenuLabelProps) => (
<DropdownMenuPrimitive.Label {...props} className="px-3 py-2 text-gray-500" />
);
type DropdownMenuItemProps = ComponentProps<typeof DropdownMenuPrimitive["CheckboxItem"]>;
type DropdownMenuItemProps = ComponentProps<(typeof DropdownMenuPrimitive)["CheckboxItem"]>;
export const DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemProps>(
({ className = "", ...props }, forwardedRef) => (
<DropdownMenuPrimitive.Item
@@ -68,7 +69,7 @@ DropdownMenuItem.displayName = "DropdownMenuItem";
export const DropdownMenuGroup = DropdownMenuPrimitive.Group;
type DropdownMenuCheckboxItemProps = ComponentProps<typeof DropdownMenuPrimitive["CheckboxItem"]>;
type DropdownMenuCheckboxItemProps = ComponentProps<(typeof DropdownMenuPrimitive)["CheckboxItem"]>;
export const DropdownMenuCheckboxItem = forwardRef<HTMLDivElement, DropdownMenuCheckboxItemProps>(
({ children, ...props }, forwardedRef) => {
return (
@@ -85,7 +86,7 @@ DropdownMenuCheckboxItem.displayName = "DropdownMenuCheckboxItem";
export const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
type DropdownMenuRadioItemProps = ComponentProps<typeof DropdownMenuPrimitive["RadioItem"]>;
type DropdownMenuRadioItemProps = ComponentProps<(typeof DropdownMenuPrimitive)["RadioItem"]>;
export const DropdownMenuRadioItem = forwardRef<HTMLDivElement, DropdownMenuRadioItemProps>(
({ children, ...props }, forwardedRef) => {
return (
@@ -146,7 +147,7 @@ export const DropdownItem = (props: DropdownItemProps) => {
);
};
type DropdownMenuSeparatorProps = ComponentProps<typeof DropdownMenuPrimitive["Separator"]>;
type DropdownMenuSeparatorProps = ComponentProps<(typeof DropdownMenuPrimitive)["Separator"]>;
export const DropdownMenuSeparator = forwardRef<HTMLDivElement, DropdownMenuSeparatorProps>(
({ className = "", ...props }, forwardedRef) => {
return (
@@ -1,4 +1,5 @@
import { FieldValues, useFormContext } from "react-hook-form";
import type { FieldValues } from "react-hook-form";
import { useFormContext } from "react-hook-form";
import { FiCheck, FiCircle, FiInfo, FiX } from "../../icon";
+4 -2
View File
@@ -1,5 +1,7 @@
import React, { forwardRef, ReactElement, ReactNode, Ref, useCallback, useId, useState } from "react";
import { FieldValues, FormProvider, SubmitHandler, useFormContext, UseFormReturn } from "react-hook-form";
import type { ReactElement, ReactNode, Ref } from "react";
import React, { forwardRef, useCallback, useId, useState } from "react";
import type { FieldValues, SubmitHandler, UseFormReturn } from "react-hook-form";
import { FormProvider, useFormContext } from "react-hook-form";
import classNames from "@calcom/lib/classNames";
import { getErrorFromUnknown } from "@calcom/lib/errors";
@@ -1,7 +1,6 @@
import { useId } from "@radix-ui/react-id";
import * as React from "react";
import ReactSelect, {
components as reactSelectComponents,
import type {
GroupBase,
Props,
SingleValue,
@@ -9,6 +8,7 @@ import ReactSelect, {
SelectComponentsConfig,
MenuPlacement,
} from "react-select";
import ReactSelect, { components as reactSelectComponents } from "react-select";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -1,5 +1,4 @@
import {
components as reactSelectComponents,
import type {
ControlProps,
GroupBase,
InputProps,
@@ -10,6 +9,7 @@ import {
SingleValueProps,
ValueContainerProps,
} from "react-select";
import { components as reactSelectComponents } from "react-select";
import { classNames } from "@calcom/lib";
@@ -4,7 +4,7 @@ import { FiCheck } from "react-icons/fi";
import { classNames as cn } from "@calcom/lib";
import { useSelectContext } from "./SelectProvider";
import { Option } from "./type";
import type { Option } from "./type";
interface ItemProps {
item: Option;
@@ -6,7 +6,7 @@ import { useKeyPress } from "@calcom/lib/hooks/useKeyPress";
import { Label } from "../../inputs/Label";
import Item from "./Item";
import { SelectContext } from "./SelectProvider";
import { Option } from "./type";
import type { Option } from "./type";
interface OptionsProps<T extends Option> {
list: T[];
@@ -8,7 +8,7 @@ import { FiX, FiChevronDown } from "../../../icon";
import Options from "./Options";
import SearchInput from "./SearchInput";
import SelectProvider from "./SelectProvider";
import { Option } from "./type";
import type { Option } from "./type";
interface SelectProps<T extends Option> {
options: T[];
@@ -1,6 +1,6 @@
import React, { createContext, useContext, useMemo } from "react";
import { ClassNames, Option } from "./type";
import type { ClassNames, Option } from "./type";
interface Store {
selectedItems: Option | Option[] | null;
@@ -1,5 +1,5 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { Label } from "..";
import Switch from "./Switch";
@@ -1,10 +1,6 @@
import { useMemo } from "react";
import BaseSelect, {
allTimezones,
ITimezoneOption,
ITimezone,
Props as SelectProps,
} from "react-timezone-select";
import type { ITimezoneOption, ITimezone, Props as SelectProps } from "react-timezone-select";
import BaseSelect, { allTimezones } from "react-timezone-select";
import { getReactSelectProps } from "../select";
@@ -1,6 +1,7 @@
import { noop } from "lodash";
import { useRouter } from "next/router";
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import type { Dispatch, SetStateAction } from "react";
import { useEffect, useState } from "react";
import classNames from "@calcom/lib/classNames";
+4 -8
View File
@@ -1,14 +1,10 @@
import merge from "lodash/merge";
import { NextSeo, NextSeoProps } from "next-seo";
import type { NextSeoProps } from "next-seo";
import { NextSeo } from "next-seo";
import { useRouter } from "next/router";
import {
AppImageProps,
constructAppImage,
constructGenericImage,
constructMeetingImage,
MeetingImageProps,
} from "@calcom/lib/OgImages";
import type { AppImageProps, MeetingImageProps } from "@calcom/lib/OgImages";
import { constructAppImage, constructGenericImage, constructMeetingImage } from "@calcom/lib/OgImages";
import { getBrowserInfo } from "@calcom/lib/browser/browser.utils";
import { APP_NAME } from "@calcom/lib/constants";
import { seoConfig, getSeoImage } from "@calcom/lib/next-seo.config";
@@ -1,5 +1,6 @@
import * as SliderPrimitive from "@radix-ui/react-slider";
import { FormEvent, useCallback, useEffect, useState } from "react";
import type { FormEvent } from "react";
import { useCallback, useEffect, useState } from "react";
import Cropper from "react-easy-crop";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -1,4 +1,4 @@
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { classNames } from "@calcom/lib";
@@ -1,10 +1,10 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { ComponentProps } from "react";
import type { ComponentProps } from "react";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { Avatar } from "../../avatar";
import { SkeletonText } from "../../skeleton";
@@ -1,4 +1,5 @@
import HorizontalTabItem, { HorizontalTabItemProps } from "./HorizontalTabItem";
import type { HorizontalTabItemProps } from "./HorizontalTabItem";
import HorizontalTabItem from "./HorizontalTabItem";
export interface NavTabProps {
tabs: HorizontalTabItemProps[];
@@ -1,10 +1,11 @@
import Link from "next/link";
import { useRouter } from "next/router";
import { ComponentProps, Fragment } from "react";
import type { ComponentProps } from "react";
import { Fragment } from "react";
import classNames from "@calcom/lib/classNames";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { SVGComponent } from "@calcom/types/SVGComponent";
import type { SVGComponent } from "@calcom/types/SVGComponent";
import { FiChevronRight, FiExternalLink } from "../../icon";
import { Skeleton } from "../../skeleton";
@@ -1,6 +1,7 @@
import { classNames } from "@calcom/lib";
import VerticalTabItem, { VerticalTabItemProps } from "./VerticalTabItem";
import type { VerticalTabItemProps } from "./VerticalTabItem";
import VerticalTabItem from "./VerticalTabItem";
export { VerticalTabItem };
@@ -1,7 +1,9 @@
import React, { FC } from "react";
import { IconType } from "react-icons/lib";
import type { FC } from "react";
import React from "react";
import type { IconType } from "react-icons/lib";
import { Button, ButtonBaseProps } from "../button";
import type { ButtonBaseProps } from "../button";
import { Button } from "../button";
import {
Dropdown,
DropdownMenuContent,
@@ -1,7 +1,7 @@
import { XIcon } from "@heroicons/react/solid";
import classNames from "classnames";
import noop from "lodash/noop";
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { FiAlertTriangle, FiInfo } from "../icon";