build: enable consistent type imports eslint rule (#7992)

* build: enable consistent type imports eslint rule

* change to warn

* fix the warning in example and excalidraw-app

* fix packages

* enable type annotations and throw error for the rule
This commit is contained in:
Aakansha Doshi 2024-05-08 14:21:50 +05:30 committed by GitHub
parent c1926f33bb
commit 1ed53b153c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
240 changed files with 635 additions and 611 deletions

View file

@ -1,6 +1,6 @@
import { StaticCanvasAppState, AppState } from "../types";
import type { StaticCanvasAppState, AppState } from "../types";
import { StaticCanvasRenderConfig } from "../scene/types";
import type { StaticCanvasRenderConfig } from "../scene/types";
import { THEME, THEME_FILTER } from "../constants";

View file

@ -21,23 +21,25 @@ import {
getElementsInGroup,
selectGroupsFromGivenElements,
} from "../groups";
import {
getOmitSidesForDevice,
shouldShowBoundingBox,
import type {
TransformHandles,
TransformHandleType,
} from "../element/transformHandles";
import {
getOmitSidesForDevice,
shouldShowBoundingBox,
} from "../element/transformHandles";
import { arrayToMap, throttleRAF } from "../utils";
import { InteractiveCanvasAppState, Point } from "../types";
import type { InteractiveCanvasAppState, Point } from "../types";
import { DEFAULT_TRANSFORM_HANDLE_SPACING, FRAME_STYLE } from "../constants";
import { renderSnaps } from "../renderer/renderSnaps";
import {
maxBindingGap,
import type {
SuggestedBinding,
SuggestedPointBinding,
} from "../element/binding";
import { maxBindingGap } from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
bootstrapCanvas,
@ -46,7 +48,7 @@ import {
} from "./helpers";
import oc from "open-color";
import { isFrameLikeElement, isLinearElement } from "../element/typeChecks";
import {
import type {
ElementsMap,
ExcalidrawBindableElement,
ExcalidrawElement,
@ -55,7 +57,7 @@ import {
GroupId,
NonDeleted,
} from "../element/types";
import {
import type {
InteractiveCanvasRenderConfig,
InteractiveSceneRenderConfig,
RenderableElementsMap,

View file

@ -1,4 +1,4 @@
import {
import type {
ExcalidrawElement,
ExcalidrawTextElement,
NonDeletedExcalidrawElement,
@ -21,14 +21,14 @@ import {
import { getElementAbsoluteCoords } from "../element/bounds";
import type { RoughCanvas } from "roughjs/bin/canvas";
import {
import type {
StaticCanvasRenderConfig,
RenderableElementsMap,
} from "../scene/types";
import { distance, getFontString, isRTL } from "../utils";
import { getCornerRadius, isRightAngle } from "../math";
import rough from "roughjs/bin/rough";
import {
import type {
AppState,
StaticCanvasAppState,
Zoom,
@ -43,7 +43,8 @@ import {
MIME_TYPES,
THEME,
} from "../constants";
import { getStroke, StrokeOptions } from "perfect-freehand";
import type { StrokeOptions } from "perfect-freehand";
import { getStroke } from "perfect-freehand";
import {
getBoundTextElement,
getContainerCoords,

View file

@ -1,6 +1,6 @@
import { THEME } from "../constants";
import { PointSnapLine, PointerSnapLine } from "../snapping";
import { InteractiveCanvasAppState, Point } from "../types";
import type { PointSnapLine, PointerSnapLine } from "../snapping";
import type { InteractiveCanvasAppState, Point } from "../types";
const SNAP_COLOR_LIGHT = "#ff6b6b";
const SNAP_COLOR_DARK = "#ff0000";

View file

@ -13,13 +13,13 @@ import {
} from "../element/typeChecks";
import { renderElement } from "../renderer/renderElement";
import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
import { StaticCanvasAppState, Zoom } from "../types";
import {
import type { StaticCanvasAppState, Zoom } from "../types";
import type {
ElementsMap,
ExcalidrawFrameLikeElement,
NonDeletedExcalidrawElement,
} from "../element/types";
import {
import type {
StaticCanvasRenderConfig,
StaticSceneRenderConfig,
} from "../scene/types";

View file

@ -1,5 +1,5 @@
import { Drawable } from "roughjs/bin/core";
import { RoughSVG } from "roughjs/bin/svg";
import type { Drawable } from "roughjs/bin/core";
import type { RoughSVG } from "roughjs/bin/svg";
import {
FRAME_STYLE,
MAX_DECIMALS_FOR_SVG_EXPORT,
@ -25,7 +25,7 @@ import {
isInitializedImageElement,
isTextElement,
} from "../element/typeChecks";
import {
import type {
ExcalidrawElement,
ExcalidrawTextElementWithContainer,
NonDeletedExcalidrawElement,
@ -33,8 +33,8 @@ import {
import { getContainingFrame } from "../frame";
import { getCornerRadius, isPathALoop } from "../math";
import { ShapeCache } from "../scene/ShapeCache";
import { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
import { AppState, BinaryFiles } from "../types";
import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
import type { AppState, BinaryFiles } from "../types";
import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";