mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
c1926f33bb
commit
1ed53b153c
240 changed files with 635 additions and 611 deletions
|
@ -2,7 +2,10 @@ import { isTextElement, refreshTextDimensions } from "../element";
|
|||
import { newElementWith } from "../element/mutateElement";
|
||||
import { getContainerElement } from "../element/textElement";
|
||||
import { isBoundToContainer } from "../element/typeChecks";
|
||||
import { ExcalidrawElement, ExcalidrawTextElement } from "../element/types";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
} from "../element/types";
|
||||
import { getFontString } from "../utils";
|
||||
import type Scene from "./Scene";
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { isElementInViewport } from "../element/sizeHelpers";
|
||||
import { isImageElement } from "../element/typeChecks";
|
||||
import {
|
||||
import type {
|
||||
NonDeletedElementsMap,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
|
||||
import { renderStaticSceneThrottled } from "../renderer/staticScene";
|
||||
|
||||
import { AppState } from "../types";
|
||||
import type { AppState } from "../types";
|
||||
import { memoize, toBrandedType } from "../utils";
|
||||
import Scene from "./Scene";
|
||||
import { RenderableElementsMap } from "./types";
|
||||
import type Scene from "./Scene";
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
|
||||
export class Renderer {
|
||||
private scene: Scene;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeleted,
|
||||
|
@ -10,11 +10,11 @@ import {
|
|||
Ordered,
|
||||
} from "../element/types";
|
||||
import { isNonDeletedElement } from "../element";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import type { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { getSelectedElements } from "./selection";
|
||||
import { AppState } from "../types";
|
||||
import { Assert, SameType } from "../utility-types";
|
||||
import type { AppState } from "../types";
|
||||
import type { Assert, SameType } from "../utility-types";
|
||||
import { randomInteger } from "../random";
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
|
|
|
@ -21,7 +21,7 @@ import {
|
|||
isLinearElement,
|
||||
} from "../element/typeChecks";
|
||||
import { canChangeRoundness } from "./comparisons";
|
||||
import { EmbedsValidationStatus } from "../types";
|
||||
import type { EmbedsValidationStatus } from "../types";
|
||||
|
||||
const getDashArrayDashed = (strokeWidth: number) => [8, 8 + strokeWidth];
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Drawable } from "roughjs/bin/core";
|
||||
import type { Drawable } from "roughjs/bin/core";
|
||||
import { RoughGenerator } from "roughjs/bin/generator";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawSelectionElement,
|
||||
} from "../element/types";
|
||||
import { elementWithCanvasCache } from "../renderer/renderElement";
|
||||
import { _generateElementShape } from "./Shape";
|
||||
import { ElementShape, ElementShapes } from "./types";
|
||||
import type { ElementShape, ElementShapes } from "./types";
|
||||
import { COLOR_PALETTE } from "../colors";
|
||||
import { AppState, EmbedsValidationStatus } from "../types";
|
||||
import type { AppState, EmbedsValidationStatus } from "../types";
|
||||
|
||||
export class ShapeCache {
|
||||
private static rg = new RoughGenerator();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { isIframeElement } from "../element/typeChecks";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawIframeElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import { ElementOrToolType } from "../types";
|
||||
import type { ElementOrToolType } from "../types";
|
||||
|
||||
export const hasBackground = (type: ElementOrToolType) =>
|
||||
type === "rectangle" ||
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
import rough from "roughjs/bin/rough";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
import {
|
||||
Bounds,
|
||||
getCommonBounds,
|
||||
getElementAbsoluteCoords,
|
||||
} from "../element/bounds";
|
||||
import type { Bounds } from "../element/bounds";
|
||||
import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
|
||||
import { renderSceneToSvg } from "../renderer/staticSvgScene";
|
||||
import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
|
||||
import { AppState, BinaryFiles } from "../types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
import {
|
||||
DEFAULT_EXPORT_PADDING,
|
||||
FONT_FAMILY,
|
||||
|
@ -35,10 +32,10 @@ import {
|
|||
getRootElements,
|
||||
} from "../frame";
|
||||
import { newTextElement } from "../element";
|
||||
import { Mutable } from "../utility-types";
|
||||
import type { Mutable } from "../utility-types";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { isFrameElement, isFrameLikeElement } from "../element/typeChecks";
|
||||
import { RenderableElementsMap } from "./types";
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
import { renderStaticScene } from "../renderer/staticScene";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { AppState, PointerCoords, Zoom } from "../types";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import type { AppState, PointerCoords, Zoom } from "../types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import {
|
||||
getCommonBounds,
|
||||
getClosestElementBounds,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { getCommonBounds } from "../element";
|
||||
import { InteractiveCanvasAppState } from "../types";
|
||||
import { ScrollBars } from "./types";
|
||||
import type { InteractiveCanvasAppState } from "../types";
|
||||
import type { ScrollBars } from "./types";
|
||||
import { getGlobalCSSVariable } from "../utils";
|
||||
import { getLanguage } from "../i18n";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
export const SCROLLBAR_MARGIN = 4;
|
||||
export const SCROLLBAR_WIDTH = 6;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import {
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import { getElementAbsoluteCoords, getElementBounds } from "../element";
|
||||
import { AppState, InteractiveCanvasAppState } from "../types";
|
||||
import type { AppState, InteractiveCanvasAppState } from "../types";
|
||||
import { isBoundToContainer, isFrameLikeElement } from "../element/typeChecks";
|
||||
import {
|
||||
elementOverlapsWithFrame,
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import type { RoughCanvas } from "roughjs/bin/canvas";
|
||||
import { Drawable } from "roughjs/bin/core";
|
||||
import {
|
||||
import type { Drawable } from "roughjs/bin/core";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeletedElementsMap,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
import {
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
EmbedsValidationStatus,
|
||||
|
@ -18,7 +18,7 @@ import {
|
|||
UserIdleState,
|
||||
Device,
|
||||
} from "../types";
|
||||
import { MakeBrand } from "../utility-types";
|
||||
import type { MakeBrand } from "../utility-types";
|
||||
|
||||
export type RenderableElementsMap = NonDeletedElementsMap &
|
||||
MakeBrand<"RenderableElementsMap">;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { MIN_ZOOM } from "../constants";
|
||||
import { AppState, NormalizedZoomValue } from "../types";
|
||||
import type { AppState, NormalizedZoomValue } from "../types";
|
||||
|
||||
export const getNormalizedZoom = (zoom: number): NormalizedZoomValue => {
|
||||
return Math.max(MIN_ZOOM, Math.min(zoom, 30)) as NormalizedZoomValue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue