Fix: no-unused-vars and remove eslint-disable in files (#862)

* Fix eslint no-unused-vars

* Remove eslint-disable in files
pull/869/head
Gwenaël Gallon 2022-07-30 09:28:48 +02:00 zatwierdzone przez GitHub
rodzic 3c2c26c11e
commit ecb4bfcc3b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
68 zmienionych plików z 11 dodań i 142 usunięć

Wyświetl plik

@ -1,7 +1,4 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
/* eslint-disable @typescript-eslint/no-unused-vars */
import type { TLShape, TLBounds, TLComponentProps } from '../types'
import { TLShapeUtil } from './TLShapeUtil'
import { render } from '@testing-library/react'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
import Utils from '../utils'
import type { TLBounds, TLComponentProps, TLForwardedRef, TLShape, TLUser } from '../types'
@ -34,7 +33,6 @@ export abstract class TLShapeUtil<T extends TLShape, E extends Element = any, M
if (!this.refMap.has(shape.id)) {
this.refMap.set(shape.id, React.createRef<E>())
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.refMap.get(shape.id)!
}

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as React from 'react'
import { TLBoundsEdge, TLBoundsCorner, TLBounds } from '~types'
import { CenterHandle } from './CenterHandle'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { observer } from 'mobx-react-lite'
import * as React from 'react'
import type { TLBounds } from '~types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
import { observer } from 'mobx-react-lite'
import {
@ -25,7 +24,6 @@ import { Brush } from '~components/Brush'
import { Page } from '~components/Page'
import { Users } from '~components/Users'
import { useResizeObserver } from '~hooks/useResizeObserver'
import { inputs } from '~inputs'
import { UsersIndicators } from '~components/UsersIndicators'
import { SnapLines } from '~components/SnapLines/SnapLines'
import { Grid } from '~components/Grid'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { observer } from 'mobx-react-lite'
import * as React from 'react'
import type { TLAssets, TLBinding, TLPage, TLPageState, TLShape } from '~types'

Wyświetl plik

@ -3,7 +3,7 @@ import { mockDocument, mockUtils } from '~test'
import { act, render } from '@testing-library/react'
import { Renderer } from './Renderer'
import { action, makeAutoObservable } from 'mobx'
import type { TLBinding, TLBounds, TLPage, TLPageState } from '~types'
import type { TLBounds, TLPage, TLPageState } from '~types'
import Utils from '~utils'
import type { BoxShape } from '~TLShapeUtil/TLShapeUtil.spec'
import Vec from '@tldraw/vec'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { observer } from 'mobx-react-lite'
import * as React from 'react'
import type {

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { observer } from 'mobx-react-lite'
import * as React from 'react'
import type { TLComponentProps, TLShape } from '~types'

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable no-inner-declarations */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as React from 'react'
import type { TLShape, TLUser } from '~types'

Wyświetl plik

@ -1,5 +1,4 @@
import * as React from 'react'
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ShapeIndicator } from '~components/ShapeIndicator'
import type { TLPage, TLShape, TLUsers } from '~types'
import Utils from '~utils'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react'
import { useTLContext } from './useTLContext'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { autorun } from 'mobx'
import * as React from 'react'
import type { TLPageState } from '../types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { autorun } from 'mobx'
import * as React from 'react'
import type { TLBounds } from '../types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import * as React from 'react'
import { useTLContext } from './useTLContext'

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as React from 'react'
import type {
IShapeTreeNode,
@ -59,7 +57,6 @@ function addToShapeTree<T extends TLShape, M extends Record<string, unknown>>(
.filter(Boolean) // TODO: Find cases where shapes would be missing.
.sort((a, b) => a.childIndex - b.childIndex)
.forEach((childShape) =>
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
addToShapeTree(
childShape,
node.children!,

Wyświetl plik

@ -3,7 +3,6 @@ import type { Inputs } from '~inputs'
import type { TLCallbacks, TLShape, TLBounds, TLPageState } from '~types'
import type { TLShapeUtilsMap } from '~TLShapeUtil'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface TLContextType<T extends TLShape> {
id?: string
callbacks: Partial<TLCallbacks<T>>

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import * as React from 'react'
import { useTLContext } from './useTLContext'
import { Handler, useGesture, WebKitGestureEvent } from '@use-gesture/react'

Wyświetl plik

@ -27,6 +27,5 @@ export const ContextWrapper = ({ children }: { children: any }) => {
},
}))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return <TLContext.Provider value={context as any}>{children}</TLContext.Provider>
}

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* --------------------- Primary -------------------- */
import type React from 'react'
@ -353,7 +351,6 @@ export interface IShapeTreeNode<T extends TLShape, M = any> {
/* -------------------------------------------------- */
export type MappedByType<K extends string, T extends { type: K }> = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[P in T['type']]: T extends any ? (P extends T['type'] ? T : never) : never
}

Wyświetl plik

@ -1,6 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable no-extend-native */
/**
* String.prototype.replaceAll() polyfill
* https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/

Wyświetl plik

@ -1,7 +1,4 @@
/* eslint-disable @typescript-eslint/no-extra-semi */
/* eslint-disable @typescript-eslint/ban-types */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-redeclare */
import type React from 'react'
import { TLBounds, TLBoundsCorner, SnapPoints, Snap, TLBoundsEdge } from '../types'
import { Vec } from '@tldraw/vec'
@ -38,7 +35,6 @@ export class Utils {
static lerpColor(color1: string, color2: string, factor = 0.5): string {
function h2r(hex: string) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!
return [parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16)]
}
@ -1291,7 +1287,6 @@ left past the initial left edge) then swap points on that axis.
* getFromCache(boundsCache, shape, (cache) => cache.set(shape, "value"))
*```
*/
// eslint-disable-next-line @typescript-eslint/ban-types
static getFromCache<V, I extends object>(cache: WeakMap<I, V>, item: I, getNext: () => V): V {
let value = cache.get(item)
@ -1330,7 +1325,6 @@ left past the initial left edge) then swap points on that axis.
* Debounce a function.
*/
static debounce<T extends (...args: any[]) => void>(fn: T, ms = 0) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let timeoutId: number | any
return function (...args: Parameters<T>) {
clearTimeout(timeoutId)
@ -1448,7 +1442,6 @@ left past the initial left edge) then swap points on that axis.
setTimeout(() => (inThrottle = false), limit)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
lastResult = func(...args)
}

Wyświetl plik

@ -988,21 +988,13 @@ export function intersectEllipseRectangle(
* @param _r2
*/
export function intersectEllipseEllipse(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_c1: number[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_rx1: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_ry1: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_r1: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_c2: number[],
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_rx2: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_ry2: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_r2: number
): TLIntersection {
// TODO

Wyświetl plik

@ -1,6 +1,5 @@
import * as React from 'react'
import { FormattedMessage } from 'react-intl'
import { Panel } from '~components/Primitives/Panel'
import { useTldrawApp } from '~hooks'
import { styled } from '~styles'
import type { TDSnapshot } from '~types'

Wyświetl plik

@ -1,4 +1,3 @@
import * as React from 'react'
import { styled } from '~styles'
export const Divider = styled('hr', {

Wyświetl plik

@ -34,10 +34,6 @@ const shapeShapeIcons = {
[TDShapeType.Line]: <LineIcon />,
}
enum Status {
SpacePanning = 'spacePanning',
}
const dockPositionState = (s: TDSnapshot) => s.settings.dockPosition
export const ShapesMenu = React.memo(function ShapesMenu({

Wyświetl plik

@ -10,7 +10,7 @@ import { Divider } from '~components/Primitives/Divider'
const languageSelector = (s: TDSnapshot) => s.settings.language
export const LanguageMenu = React.forwardRef((props, ref) => {
export const LanguageMenu = () => {
const app = useTldrawApp()
const language = app.useStore(languageSelector)
@ -48,4 +48,4 @@ export const LanguageMenu = React.forwardRef((props, ref) => {
</a>
</DMContent>
)
})
}

Wyświetl plik

@ -1,6 +1,6 @@
import * as React from 'react'
import { FormattedMessage, useIntl } from 'react-intl'
import { DMCheckboxItem, DMDivider, DMSubMenu } from '~components/Primitives/DropdownMenu'
import { DMCheckboxItem, DMSubMenu } from '~components/Primitives/DropdownMenu'
import { useTldrawApp } from '~hooks'
import { TDDockPosition, TDExportBackground, TDSnapshot } from '~types'
import { styled } from '~styles'
@ -28,30 +28,14 @@ export function PreferencesMenu() {
app.setSetting('isFocusMode', (v) => !v)
}, [app])
const toggleRotateHandle = React.useCallback(() => {
app.setSetting('showRotateHandles', (v) => !v)
}, [app])
const toggleGrid = React.useCallback(() => {
app.setSetting('showGrid', (v) => !v)
}, [app])
const toggleBoundShapesHandle = React.useCallback(() => {
app.setSetting('showBindingHandles', (v) => !v)
}, [app])
const toggleisSnapping = React.useCallback(() => {
app.setSetting('isSnapping', (v) => !v)
}, [app])
const toggleKeepStyleMenuOpen = React.useCallback(() => {
app.setSetting('keepStyleMenuOpen', (v) => !v)
}, [app])
const toggleCloneControls = React.useCallback(() => {
app.setSetting('showCloneHandles', (v) => !v)
}, [app])
const toggleCadSelectMode = React.useCallback(() => {
app.setSetting('isCadSelectMode', (v) => !v)
}, [app])

Wyświetl plik

@ -3,12 +3,7 @@ import * as DropdownMenu from '@radix-ui/react-dropdown-menu'
import { strokes, fills, defaultTextStyle } from '~state/shapes/shared/shape-styles'
import { FormattedMessage } from 'react-intl'
import { useTldrawApp } from '~hooks'
import {
DMCheckboxItem,
DMContent,
DMDivider,
DMRadioItem,
} from '~components/Primitives/DropdownMenu'
import { DMCheckboxItem, DMContent, DMRadioItem } from '~components/Primitives/DropdownMenu'
import {
CircleIcon,
DashDashedIcon,
@ -141,12 +136,10 @@ export const StyleMenu = React.memo(function ColorMenu() {
STYLE_KEYS.forEach((key) => {
if (overrides.has(key)) return
if (commonStyle[key] === undefined) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
commonStyle[key] = shape.style[key]
} else {
if (commonStyle[key] === shape.style[key]) return
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
commonStyle[key] = shape.style[key]
overrides.add(key)

Wyświetl plik

@ -2,7 +2,6 @@
/* Breakpoints */
/* -------------------------------------------------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const breakpoints: any = {
'@initial': 'mobile',
'@micro': 'micro',

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export const LETTER_SPACING = '-0.03em'
export const LINE_HEIGHT = 1
export const GRID_SIZE = 8

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLBounds, TLTransformInfo, Utils, TLPageState } from '@tldraw/core'
import {
TDSnapshot,
@ -23,9 +22,7 @@ import { BINDING_DISTANCE } from '~constants'
const isDev = process.env.NODE_ENV === 'development'
export class TLDR {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static getShapeUtil<T extends TDShape>(type: T['type']): TDShapeUtil<T>
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static getShapeUtil<T extends TDShape>(shape: T): TDShapeUtil<T>
static getShapeUtil<T extends TDShape>(shape: T | T['type']) {
return getShapeUtil<T>(shape)

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { mockDocument, TldrawTestApp } from '~test'
import { ArrowShape, ColorStyle, SessionType, TDShapeType } from '~types'
import { deepCopy } from './StateManager/copy'

Wyświetl plik

@ -1,6 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Vec } from '@tldraw/vec'
import {
TLBoundsEventHandler,
@ -85,8 +82,6 @@ import { StateManager } from './StateManager'
import { clearPrevSize } from './shapes/shared/getTextSize'
import { getClipboard, setClipboard } from './IdbClipboard'
import { deepCopy } from './StateManager/copy'
import { getTranslation } from '~translations'
import { TextUtil } from './shapes/TextUtil'
const uuid = Utils.uniqueId()
@ -2732,7 +2727,6 @@ export class TldrawApp extends StateManager<TDSnapshot> {
const { session } = this
if (!session) return this
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const patch = session.update()
if (!patch) return this

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Vec } from '@tldraw/vec'
import { Utils } from '@tldraw/core'
import { AlignType, TldrawCommand, TDShapeType } from '~types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'
import { DistributeType, TDShape, TldrawCommand, TDShapeType } from '~types'
import { TLDR } from '~state/TLDR'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'
import { TLDR } from '~state/TLDR'
import { mockDocument, TldrawTestApp } from '~test'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import { TLDR } from '~state/TLDR'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { mockDocument, TldrawTestApp } from '~test'
import { GroupShape, TDShape, TDShapeType } from '~types'

Wyświetl plik

@ -116,7 +116,6 @@ export function groupShapes(
const shape = otherEffectedGroups.pop()
if (!shape) break
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const nextChildren = (beforeShapes[shape.id]?.children || shape.children)!.filter(
(childId) => childId && !(idsToGroup.includes(childId) || deletedGroupIds.includes(childId))
)

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'
import { TLDR } from '~state/TLDR'
import { mockDocument, TldrawTestApp } from '~test'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { Utils } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import { TLDR } from '~state/TLDR'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import type { ArrowShape, PagePartial, TldrawCommand, TDShape } from '~types'
import type { TldrawApp } from '../../internal'
import { TLDR } from '~state/TLDR'

Wyświetl plik

@ -1,5 +1,5 @@
import { TLDR } from '~state/TLDR'
import type { ArrowShape, GroupShape, PagePartial, TDPage, TDSnapshot } from '~types'
import type { ArrowShape, GroupShape, PagePartial, TDSnapshot } from '~types'
export function removeShapesFromPage(data: TDSnapshot, ids: string[], pageId: string) {
const before: PagePartial = {
@ -51,7 +51,6 @@ export function removeShapesFromPage(data: TDSnapshot, ids: string[], pageId: st
deletedIds.add(parent.id)
before.shapes[parent.id] = { children: parent.children }
after.shapes[parent.id] = { children: parent.children.filter((id) => !ids.includes(id)) }
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
if (after.shapes[parent.id]?.children!.length === 0) {
after.shapes[parent.id] = undefined
before.shapes[parent.id] = TLDR.getShape(data, parent.id, pageId)

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLBoundsCorner, Utils } from '@tldraw/core'
import { StretchType, TDShapeType } from '~types'
import type { TldrawCommand } from '~types'

Wyświetl plik

@ -1,4 +1,4 @@
import { mockDocument, TldrawTestApp } from '~test'
import { TldrawTestApp } from '~test'
import { ArrowShape, Decoration, TDShapeType } from '~types'
describe('Toggle decoration command', () => {

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { mockDocument, TldrawTestApp } from '~test'
import { ArrowShape, SessionType, TDShapeType } from '~types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { mockDocument, TldrawTestApp } from '~test'
import { GroupShape, TDShapeType } from '~types'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import type { TDDocument, TDFile } from '~types'
import type { FileSystemHandle } from './browser-fs-access'
import { get as getFromIdb, set as setToIdb } from 'idb-keyval'

Wyświetl plik

@ -1,8 +1,6 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {
Decoration,
FontStyle,
TDDocument,
TDExportBackground,
TDShapeType,
TDSnapshot,
@ -67,7 +65,6 @@ export function migrate(state: TDSnapshot, newVersion: number): TDSnapshot {
if (version <= 13) {
Object.values(document.pages).forEach((page) => {
Object.values(page.bindings).forEach((binding) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Object.assign(binding, (binding as any).meta)
})

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import {
ArrowBinding,
ArrowShape,

Wyświetl plik

@ -1,4 +1,4 @@
import { mockDocument, TldrawTestApp } from '~test'
import { TldrawTestApp } from '~test'
import {
ColorStyle,
DashStyle,

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TDShape, SessionType, TldrawPatch, TldrawCommand } from '~types'
import { BaseSession } from '../BaseSession'
import type { TldrawApp } from '../../internal'

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLPageState, TLBounds, Utils } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import {

Wyświetl plik

@ -1,7 +1,7 @@
import Vec from '@tldraw/vec'
import { Utils } from '@tldraw/core'
import { mockDocument, TldrawTestApp } from '~test'
import { SessionType, TDStatus } from '~types'
import { TDStatus } from '~types'
describe('Rotate session', () => {
const app = new TldrawTestApp()

Wyświetl plik

@ -1,4 +1,4 @@
import { TLPerformanceMode, Utils } from '@tldraw/core'
import { Utils } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import { SessionType, TldrawCommand, TldrawPatch, TDShape, TDStatus } from '~types'
import { TLDR } from '~state/TLDR'

Wyświetl plik

@ -1,4 +1,4 @@
import { TLBounds, TLBoundsCorner, TLBoundsEdge, TLPerformanceMode, Utils } from '@tldraw/core'
import { TLBounds, TLBoundsCorner, TLBoundsEdge, Utils } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import type { TLSnapLine, TLBoundsWithCenter } from '@tldraw/core'
import { SessionType, TldrawCommand, TldrawPatch, TDShape, TDStatus } from '~types'
@ -97,7 +97,6 @@ export class TransformSession extends BaseSession {
return void null
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
update = (): TldrawPatch | undefined => {
const {
transformType,

Wyświetl plik

@ -5,7 +5,6 @@ import {
Utils,
TLBoundsWithCenter,
TLBounds,
TLPerformanceMode,
} from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import { SessionType, TldrawCommand, TldrawPatch, TDShape, TDStatus } from '~types'

Wyświetl plik

@ -1,6 +1,3 @@
import { mockDocument, TldrawTestApp } from '~test'
import { SessionType, TDShapeType, TDStatus } from '~types'
describe('Translate label session', () => {
it.todo('begins, updateSession')
it.todo('cancels session')

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { TLPageState, Utils, TLBoundsWithCenter, TLSnapLine, TLBounds } from '@tldraw/core'
import { Vec } from '@tldraw/vec'
import {
@ -548,13 +547,10 @@ export class TranslateSession extends BaseSession {
afterShapes[id] = { ...afterShapes[id], handles: {} }
// There should be before and after shapes
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
beforeShapes[id]!.handles![handle.id as keyof ArrowShape['handles']] = {
bindingId: binding.id,
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
afterShapes[id]!.handles![handle.id as keyof ArrowShape['handles']] = {
bindingId: undefined,
}

Wyświetl plik

@ -248,12 +248,10 @@ export class DrawUtil extends TDShapeUtil<T, E> {
this.pointCache[shape.id] = shape.point
this.shapeBoundsCache.set(
shape.id,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
Utils.translateBounds(this.pointsBoundsCache.get(shape.points)!, shape.point)
)
}
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.shapeBoundsCache.get(shape.id)!
}

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as React from 'react'
import { Utils, HTMLContainer, TLBounds } from '@tldraw/core'
import { AlignStyle, StickyShape, TDMeta, TDShapeType, TransformInfo } from '~types'

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Utils, TLShapeUtil } from '@tldraw/core'
import type { TLPointerInfo, TLBounds } from '@tldraw/core'
import {

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import * as React from 'react'
import { Utils, HTMLContainer, TLBounds } from '@tldraw/core'
import { TextShape, TDMeta, TDShapeType, TransformInfo, AlignStyle } from '~types'
@ -401,7 +400,6 @@ export class TextUtil extends TDShapeUtil<T, E> {
/* Helpers */
/* -------------------------------------------------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let melm: any
function getMeasurementDiv() {

Wyświetl plik

@ -1,6 +1,5 @@
import { LETTER_SPACING } from '~constants'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let melm: any
function getMeasurementDiv() {

Wyświetl plik

@ -13,7 +13,6 @@ export enum Status {
Pinching = 'pinching',
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export abstract class BaseTool<T extends string = any> extends TDEventHandler {
type: TDToolType = 'select' as const

Wyświetl plik

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { badDocument } from './documents/badDocument'
import { TldrawTestApp } from './TldrawTestApp'

Wyświetl plik

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type {
TLPage,
TLUser,
@ -528,7 +526,6 @@ export enum TDExportBackground {
/* Type Helpers */
/* -------------------------------------------------- */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ParametersExceptFirst<F> = F extends (arg0: any, ...rest: infer R) => any ? R : never
export type ExceptFirst<T extends unknown[]> = T extends [any, ...infer U] ? U : never
@ -536,7 +533,6 @@ export type ExceptFirst<T extends unknown[]> = T extends [any, ...infer U] ? U :
export type ExceptFirstTwo<T extends unknown[]> = T extends [any, any, ...infer U] ? U : never
export type PropsOfType<U> = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[K in keyof TDShape]: TDShape[K] extends any ? (TDShape[K] extends U ? K : never) : never
}[keyof TDShape]