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
|
@ -5,7 +5,7 @@ import { API } from "./helpers/api";
|
|||
import { getDefaultAppState } from "../appState";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { Pointer, UI } from "./helpers/ui";
|
||||
import { ExcalidrawTextElement } from "../element/types";
|
||||
import type { ExcalidrawTextElement } from "../element/types";
|
||||
|
||||
const { h } = window;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
getLineHeightInPx,
|
||||
} from "../element/textElement";
|
||||
import { getElementBounds } from "../element";
|
||||
import { NormalizedZoomValue } from "../types";
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
import { API } from "./helpers/api";
|
||||
import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
|
|
@ -16,7 +16,7 @@ import * as StaticScene from "../renderer/staticScene";
|
|||
import { reseed } from "../random";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
import { KEYS } from "../keys";
|
||||
import { ShortcutName } from "../actions/shortcuts";
|
||||
import type { ShortcutName } from "../actions/shortcuts";
|
||||
import { copiedStyles } from "../actions/actionStyles";
|
||||
import { API } from "./helpers/api";
|
||||
import { setDateTimeForTests } from "../utils";
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
import {
|
||||
RemoteExcalidrawElement,
|
||||
reconcileElements,
|
||||
} from "../../data/reconcile";
|
||||
import {
|
||||
import type { RemoteExcalidrawElement } from "../../data/reconcile";
|
||||
import { reconcileElements } from "../../data/reconcile";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "../../element/types";
|
||||
import { syncInvalidIndices } from "../../fractionalIndex";
|
||||
import { randomInteger } from "../../random";
|
||||
import { AppState } from "../../types";
|
||||
import type { AppState } from "../../types";
|
||||
import { cloneJSON } from "../../utils";
|
||||
|
||||
type Id = string;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as restore from "../../data/restore";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
@ -8,8 +8,8 @@ import {
|
|||
import * as sizeHelpers from "../../element/sizeHelpers";
|
||||
import { API } from "../helpers/api";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { ImportedDataState } from "../../data/types";
|
||||
import { NormalizedZoomValue } from "../../types";
|
||||
import type { ImportedDataState } from "../../data/types";
|
||||
import type { NormalizedZoomValue } from "../../types";
|
||||
import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "../../constants";
|
||||
import { newElementWith } from "../../element/mutateElement";
|
||||
import { vi } from "vitest";
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
mockBoundingClientRect,
|
||||
restoreOriginalGetBoundingClientRect,
|
||||
} from "./test-utils";
|
||||
import { ExcalidrawLinearElement } from "../element/types";
|
||||
import type { ExcalidrawLinearElement } from "../element/types";
|
||||
import { reseed } from "../random";
|
||||
import { vi } from "vitest";
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from "../data/image";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
import { exportToSvg } from "../scene/export";
|
||||
import { FileId } from "../element/types";
|
||||
import type { FileId } from "../element/types";
|
||||
import { getDataURL } from "../data/blob";
|
||||
import { getDefaultAppState } from "../appState";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ExcalidrawElement } from "../../element/types";
|
||||
import type { ExcalidrawElement } from "../../element/types";
|
||||
|
||||
const elementBase: Omit<ExcalidrawElement, "type"> = {
|
||||
id: "vWrqOAfkind2qcm7LDAGZ",
|
||||
|
|
|
@ -10,7 +10,7 @@ import { UI, Pointer, Keyboard } from "./helpers/ui";
|
|||
import { API } from "./helpers/api";
|
||||
import { actionFlipHorizontal, actionFlipVertical } from "../actions";
|
||||
import { getElementAbsoluteCoords } from "../element";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
@ -20,7 +20,7 @@ import {
|
|||
import { newLinearElement } from "../element";
|
||||
import { Excalidraw } from "../index";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
import { NormalizedZoomValue } from "../types";
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
import { ROUNDNESS } from "../constants";
|
||||
import { vi } from "vitest";
|
||||
import * as blob from "../data/blob";
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { API } from "./helpers/api";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { InvalidFractionalIndexError } from "../errors";
|
||||
import { ExcalidrawElement, FractionalIndex } from "../element/types";
|
||||
import type { ExcalidrawElement, FractionalIndex } from "../element/types";
|
||||
import { deepCopyElement } from "../element/newElement";
|
||||
import { generateKeyBetween } from "fractional-indexing";
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawGenericElement,
|
||||
ExcalidrawTextElement,
|
||||
|
@ -26,10 +26,10 @@ import {
|
|||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
} from "../../element/newElement";
|
||||
import { Point } from "../../types";
|
||||
import type { Point } from "../../types";
|
||||
import { getSelectedElements } from "../../scene/selection";
|
||||
import { isLinearElementType } from "../../element/typeChecks";
|
||||
import { Mutable } from "../../utility-types";
|
||||
import type { Mutable } from "../../utility-types";
|
||||
import { assertNever } from "../../utils";
|
||||
import { createTestHook } from "../../components/App";
|
||||
|
||||
|
|
|
@ -10,12 +10,12 @@ import type {
|
|||
ExcalidrawTextContainer,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
} from "../../element/types";
|
||||
import type { TransformHandleType } from "../../element/transformHandles";
|
||||
import {
|
||||
getTransformHandles,
|
||||
getTransformHandlesFromCoords,
|
||||
OMIT_SIDES_FOR_FRAME,
|
||||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
TransformHandleType,
|
||||
type TransformHandle,
|
||||
type TransformHandleDirection,
|
||||
} from "../../element/transformHandles";
|
||||
|
|
|
@ -13,7 +13,7 @@ import { getDefaultAppState } from "../appState";
|
|||
import { fireEvent, waitFor } from "@testing-library/react";
|
||||
import { createUndoAction, createRedoAction } from "../actions/actionHistory";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { AppState, ExcalidrawImperativeAPI } from "../types";
|
||||
import type { AppState, ExcalidrawImperativeAPI } from "../types";
|
||||
import { arrayToMap, resolvablePromise } from "../utils";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
|
@ -22,7 +22,7 @@ import {
|
|||
} from "../colors";
|
||||
import { KEYS } from "../keys";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawFrameElement,
|
||||
ExcalidrawGenericElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
|
|
@ -5,11 +5,11 @@ import { queryByTestId } from "@testing-library/react";
|
|||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
import { MIME_TYPES } from "../constants";
|
||||
import { LibraryItem, LibraryItems } from "../types";
|
||||
import type { LibraryItem, LibraryItems } from "../types";
|
||||
import { UI } from "./helpers/ui";
|
||||
import { serializeLibraryAsJSON } from "../data/json";
|
||||
import { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||
import { ExcalidrawGenericElement } from "../element/types";
|
||||
import type { ExcalidrawGenericElement } from "../element/types";
|
||||
import { getCommonBoundingBox } from "../element/bounds";
|
||||
import { parseLibraryJSON } from "../data/blob";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
|
@ -14,7 +14,7 @@ import * as InteractiveCanvas from "../renderer/interactiveScene";
|
|||
import { Keyboard, Pointer, UI } from "./helpers/ui";
|
||||
import { screen, render, fireEvent, GlobalTestState } from "./test-utils";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import { Point } from "../types";
|
||||
import type { Point } from "../types";
|
||||
import { KEYS } from "../keys";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { queryByTestId, queryByText } from "@testing-library/react";
|
||||
|
|
|
@ -5,7 +5,7 @@ import * as StaticScene from "../renderer/staticScene";
|
|||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import { reseed } from "../random";
|
||||
import { bindOrUnbindLinearElement } from "../element/binding";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawLinearElement,
|
||||
NonDeleted,
|
||||
ExcalidrawRectangleElement,
|
||||
|
|
|
@ -9,7 +9,7 @@ import { Excalidraw } from "../index";
|
|||
import * as StaticScene from "../renderer/staticScene";
|
||||
import * as InteractiveCanvas from "../renderer/interactiveScene";
|
||||
import { KEYS } from "../keys";
|
||||
import { ExcalidrawLinearElement } from "../element/types";
|
||||
import type { ExcalidrawLinearElement } from "../element/types";
|
||||
import { reseed } from "../random";
|
||||
import { vi } from "vitest";
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { vi } from "vitest";
|
||||
import { Excalidraw, StoreAction } from "../../index";
|
||||
import { ExcalidrawImperativeAPI } from "../../types";
|
||||
import type { ExcalidrawImperativeAPI } from "../../types";
|
||||
import { resolvablePromise } from "../../utils";
|
||||
import { render } from "../test-utils";
|
||||
import { Pointer } from "../helpers/ui";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { queries, buildQueries } from "@testing-library/react";
|
||||
import { ToolType } from "../../types";
|
||||
import type { ToolType } from "../../types";
|
||||
import { TOOL_TYPE } from "../../constants";
|
||||
|
||||
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { Excalidraw } from "../index";
|
||||
import { reseed } from "../random";
|
||||
|
|
|
@ -7,7 +7,8 @@ import type {
|
|||
ExcalidrawLinearElement,
|
||||
} from "../element/types";
|
||||
import type { Point } from "../types";
|
||||
import { Bounds, getElementPointsCoords } from "../element/bounds";
|
||||
import type { Bounds } from "../element/bounds";
|
||||
import { getElementPointsCoords } from "../element/bounds";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "./helpers/api";
|
||||
import { KEYS } from "../keys";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { NonDeletedExcalidrawElement } from "../../element/types";
|
||||
import type { NonDeletedExcalidrawElement } from "../../element/types";
|
||||
import * as exportUtils from "../../scene/export";
|
||||
import {
|
||||
diamondFixture,
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
import "pepjs";
|
||||
|
||||
import {
|
||||
render,
|
||||
queries,
|
||||
RenderResult,
|
||||
RenderOptions,
|
||||
waitFor,
|
||||
fireEvent,
|
||||
} from "@testing-library/react";
|
||||
import type { RenderResult, RenderOptions } from "@testing-library/react";
|
||||
import { render, queries, waitFor, fireEvent } from "@testing-library/react";
|
||||
|
||||
import * as toolQueries from "./queries/toolQueries";
|
||||
import { ImportedDataState } from "../data/types";
|
||||
import type { ImportedDataState } from "../data/types";
|
||||
import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
|
||||
|
||||
import { SceneData } from "../types";
|
||||
import type { SceneData } from "../types";
|
||||
import { getSelectedElements } from "../scene/selection";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import { UI } from "./helpers/ui";
|
||||
|
||||
const customQueries = {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Excalidraw } from "../index";
|
||||
import { ExcalidrawImperativeAPI } from "../types";
|
||||
import type { ExcalidrawImperativeAPI } from "../types";
|
||||
import { resolvablePromise } from "../utils";
|
||||
import { render } from "./test-utils";
|
||||
import { Pointer } from "./helpers/ui";
|
||||
|
|
|
@ -9,10 +9,10 @@ import {
|
|||
actionSendToBack,
|
||||
actionDuplicateSelection,
|
||||
} from "../actions";
|
||||
import { AppState } from "../types";
|
||||
import type { AppState } from "../types";
|
||||
import { API } from "./helpers/api";
|
||||
import { selectGroupsForSelectedElements } from "../groups";
|
||||
import {
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameElement,
|
||||
ExcalidrawSelectionElement,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue