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

* Fix eslint no-unused-vars

* Remove eslint-disable in files
This commit is contained in:
Gwenaël Gallon 2022-07-30 09:28:48 +02:00 committed by GitHub
parent 3c2c26c11e
commit ecb4bfcc3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 11 additions and 142 deletions

View file

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

View file

@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import * as React from 'react' import * as React from 'react'
import Utils from '../utils' import Utils from '../utils'
import type { TLBounds, TLComponentProps, TLForwardedRef, TLShape, TLUser } from '../types' 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)) { if (!this.refMap.has(shape.id)) {
this.refMap.set(shape.id, React.createRef<E>()) this.refMap.set(shape.id, React.createRef<E>())
} }
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.refMap.get(shape.id)! return this.refMap.get(shape.id)!
} }

View file

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

View file

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

View file

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

View file

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

View file

@ -3,7 +3,7 @@ import { mockDocument, mockUtils } from '~test'
import { act, render } from '@testing-library/react' import { act, render } from '@testing-library/react'
import { Renderer } from './Renderer' import { Renderer } from './Renderer'
import { action, makeAutoObservable } from 'mobx' 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 Utils from '~utils'
import type { BoxShape } from '~TLShapeUtil/TLShapeUtil.spec' import type { BoxShape } from '~TLShapeUtil/TLShapeUtil.spec'
import Vec from '@tldraw/vec' import Vec from '@tldraw/vec'

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 * as React from 'react'
import type { import type {
IShapeTreeNode, 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. .filter(Boolean) // TODO: Find cases where shapes would be missing.
.sort((a, b) => a.childIndex - b.childIndex) .sort((a, b) => a.childIndex - b.childIndex)
.forEach((childShape) => .forEach((childShape) =>
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
addToShapeTree( addToShapeTree(
childShape, childShape,
node.children!, node.children!,

View file

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

View file

@ -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 * as React from 'react'
import { useTLContext } from './useTLContext' import { useTLContext } from './useTLContext'
import { Handler, useGesture, WebKitGestureEvent } from '@use-gesture/react' import { Handler, useGesture, WebKitGestureEvent } from '@use-gesture/react'

View file

@ -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> return <TLContext.Provider value={context as any}>{children}</TLContext.Provider>
} }

View file

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* --------------------- Primary -------------------- */ /* --------------------- Primary -------------------- */
import type React from 'react' 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 }> = { 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 [P in T['type']]: T extends any ? (P extends T['type'] ? T : never) : never
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,6 +1,6 @@
import * as React from 'react' import * as React from 'react'
import { FormattedMessage, useIntl } from 'react-intl' 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 { useTldrawApp } from '~hooks'
import { TDDockPosition, TDExportBackground, TDSnapshot } from '~types' import { TDDockPosition, TDExportBackground, TDSnapshot } from '~types'
import { styled } from '~styles' import { styled } from '~styles'
@ -28,30 +28,14 @@ export function PreferencesMenu() {
app.setSetting('isFocusMode', (v) => !v) app.setSetting('isFocusMode', (v) => !v)
}, [app]) }, [app])
const toggleRotateHandle = React.useCallback(() => {
app.setSetting('showRotateHandles', (v) => !v)
}, [app])
const toggleGrid = React.useCallback(() => { const toggleGrid = React.useCallback(() => {
app.setSetting('showGrid', (v) => !v) app.setSetting('showGrid', (v) => !v)
}, [app]) }, [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(() => { const toggleKeepStyleMenuOpen = React.useCallback(() => {
app.setSetting('keepStyleMenuOpen', (v) => !v) app.setSetting('keepStyleMenuOpen', (v) => !v)
}, [app]) }, [app])
const toggleCloneControls = React.useCallback(() => {
app.setSetting('showCloneHandles', (v) => !v)
}, [app])
const toggleCadSelectMode = React.useCallback(() => { const toggleCadSelectMode = React.useCallback(() => {
app.setSetting('isCadSelectMode', (v) => !v) app.setSetting('isCadSelectMode', (v) => !v)
}, [app]) }, [app])

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import { TLDR } from '~state/TLDR' 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) { export function removeShapesFromPage(data: TDSnapshot, ids: string[], pageId: string) {
const before: PagePartial = { const before: PagePartial = {
@ -51,7 +51,6 @@ export function removeShapesFromPage(data: TDSnapshot, ids: string[], pageId: st
deletedIds.add(parent.id) deletedIds.add(parent.id)
before.shapes[parent.id] = { children: parent.children } before.shapes[parent.id] = { children: parent.children }
after.shapes[parent.id] = { children: parent.children.filter((id) => !ids.includes(id)) } 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) { if (after.shapes[parent.id]?.children!.length === 0) {
after.shapes[parent.id] = undefined after.shapes[parent.id] = undefined
before.shapes[parent.id] = TLDR.getShape(data, parent.id, pageId) before.shapes[parent.id] = TLDR.getShape(data, parent.id, pageId)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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 { Utils, TLShapeUtil } from '@tldraw/core'
import type { TLPointerInfo, TLBounds } from '@tldraw/core' import type { TLPointerInfo, TLBounds } from '@tldraw/core'
import { import {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/ban-types */
import type { import type {
TLPage, TLPage,
TLUser, TLUser,
@ -528,7 +526,6 @@ export enum TDExportBackground {
/* Type Helpers */ /* 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 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 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 ExceptFirstTwo<T extends unknown[]> = T extends [any, any, ...infer U] ? U : never
export type PropsOfType<U> = { 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 [K in keyof TDShape]: TDShape[K] extends any ? (TDShape[K] extends U ? K : never) : never
}[keyof TDShape] }[keyof TDShape]