Enforce eslint rules not to import anything from excalidraw package inside common & element

This commit is contained in:
Marcel Mraz 2025-03-24 13:58:36 +01:00
parent 033fcfea14
commit c82f486e88
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
6 changed files with 29 additions and 1 deletions

View file

@ -0,0 +1,3 @@
{
"extends": ["../eslintrc.base.json"]
}

View file

@ -0,0 +1,3 @@
{
"extends": ["../eslintrc.base.json"]
}

View file

@ -21,6 +21,7 @@ import {
} from "@excalidraw/common";
// TODO: remove direct dependency on the scene, should be passed in or injected instead
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import Scene from "@excalidraw/excalidraw/scene/Scene";
import type { Store } from "@excalidraw/excalidraw/store";

View file

@ -6,6 +6,7 @@ import {
} from "@excalidraw/common";
// TODO: remove direct dependency on the scene, should be passed in or injected instead
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import Scene from "@excalidraw/excalidraw/scene/Scene";
import type { Radians } from "@excalidraw/math";

View file

@ -0,0 +1,21 @@
{
"overrides": [
{
"files": ["src/**/*.{ts,tsx}"],
"rules": {
"@typescript-eslint/no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["../../excalidraw", "../../../packages/excalidraw", "@excalidraw/excalidraw"],
"message": "Do not import from '@excalidraw/excalidraw' package anything but types, as this package must be independent.",
"allowTypeImports": true
}
]
}
]
}
}
]
}

View file

@ -19,7 +19,6 @@ import { Excalidraw } from "../index";
import * as InteractiveCanvas from "../renderer/interactiveScene";
import * as StaticScene from "../renderer/staticScene";
import { UI, Pointer, Keyboard } from "./helpers/ui";
import { render, fireEvent, act, unmountComponent } from "./test-utils";