Lint rule changes
This commit is contained in:
parent
90520dfb25
commit
69c6aa9af2
29 changed files with 55 additions and 45 deletions
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
* // eslint-disable-next-line
|
||||||
* @jest-environment jsdom
|
* @jest-environment jsdom
|
||||||
*/
|
*/
|
||||||
import Atom from '../Atom'
|
import Atom from '../Atom'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
// eslint-disable-next-line
|
||||||
* @jest-environment jsdom
|
* @jest-environment jsdom
|
||||||
*/
|
*/
|
||||||
import Atom, {val} from '../../Atom'
|
import Atom, {val} from '../../Atom'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
// eslint-disable-next-line
|
||||||
* @jest-environment jsdom
|
* @jest-environment jsdom
|
||||||
*/
|
*/
|
||||||
import Atom, {val} from './Atom'
|
import Atom, {val} from './Atom'
|
||||||
|
|
|
@ -5,9 +5,9 @@ import useRefreshSnapshot from './useRefreshSnapshot'
|
||||||
* Putting this element in a suspense tree makes sure the snapshot editor
|
* Putting this element in a suspense tree makes sure the snapshot editor
|
||||||
* gets refreshed once the tree renders.
|
* gets refreshed once the tree renders.
|
||||||
*
|
*
|
||||||
* Alternatively you can use
|
* Alternatively you can use {@link useRefreshSnapshot}
|
||||||
* @link useRefreshSnapshot()
|
|
||||||
*
|
*
|
||||||
|
* @example
|
||||||
* Usage
|
* Usage
|
||||||
* ```jsx
|
* ```jsx
|
||||||
* <Suspense fallback={null}>
|
* <Suspense fallback={null}>
|
||||||
|
|
|
@ -148,7 +148,7 @@ function queueIfNeeded() {
|
||||||
* @remarks
|
* @remarks
|
||||||
* It looks like this new implementation of useDerivation() manages to:
|
* It looks like this new implementation of useDerivation() manages to:
|
||||||
* 1. Not over-calculate the derivations
|
* 1. Not over-calculate the derivations
|
||||||
* 2. Render derivation in ancestor -> descendent order
|
* 2. Render derivation in ancestor -\> descendent order
|
||||||
* 3. Not set off React's concurrent mode alarms
|
* 3. Not set off React's concurrent mode alarms
|
||||||
*
|
*
|
||||||
* It works like an implementation of Dataverse's Ticker, except that it runs
|
* It works like an implementation of Dataverse's Ticker, except that it runs
|
||||||
|
|
|
@ -5,7 +5,8 @@ const coreTicker = new Ticker()
|
||||||
export default coreTicker
|
export default coreTicker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo users should also be able to define their own ticker.
|
* @remarks
|
||||||
|
* TODO users should also be able to define their own ticker.
|
||||||
*/
|
*/
|
||||||
const onAnimationFrame = (t: number) => {
|
const onAnimationFrame = (t: number) => {
|
||||||
coreTicker.tick(t)
|
coreTicker.tick(t)
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* Theatre comes in two packages: `@theatre/core` (the library) and
|
* Theatre comes in two packages: `@theatre/core` (the library) and
|
||||||
* `@theatre/studio` (the editor). This package is the core library.
|
* `@theatre/studio` (the editor). This package is the core library.
|
||||||
*
|
|
||||||
* @module \@theatre/core
|
|
||||||
*/
|
*/
|
||||||
export * from './coreExports'
|
export * from './coreExports'
|
||||||
export type {
|
export type {
|
||||||
|
|
|
@ -6,8 +6,9 @@ import type {OnDiskState} from './store/storeTypes'
|
||||||
import globals from '@theatre/shared/globals'
|
import globals from '@theatre/shared/globals'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo this could be turned into a simple derivation, like:
|
* @remarks
|
||||||
* editor.isReady: IDerivation<{isReady: true} | {isReady: false, reason: 'conflictBetweenDiskStateAndBrowserState'}>
|
* TODO this could be turned into a simple derivation, like:
|
||||||
|
* `editor.isReady: IDerivation<{isReady: true} | {isReady: false, reason: 'conflictBetweenDiskStateAndBrowserState'}>`
|
||||||
*/
|
*/
|
||||||
export default async function initialiseProjectState(
|
export default async function initialiseProjectState(
|
||||||
studio: Studio,
|
studio: Studio,
|
||||||
|
|
|
@ -291,6 +291,7 @@ export const string = (
|
||||||
/**
|
/**
|
||||||
* A stringLiteral prop type, useful for building menus or radio buttons.
|
* A stringLiteral prop type, useful for building menus or radio buttons.
|
||||||
*
|
*
|
||||||
|
* @example
|
||||||
* Usage:
|
* Usage:
|
||||||
* ```ts
|
* ```ts
|
||||||
* // Basic usage
|
* // Basic usage
|
||||||
|
@ -304,16 +305,23 @@ export const string = (
|
||||||
* }, {as: "switch", label: "Street Light"})
|
* }, {as: "switch", label: "Street Light"})
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param defaultValue A string
|
|
||||||
* @param options An object like `{[value]: Label}`. Example: {r: "Red", "g": "Green"}
|
|
||||||
* @param opts Extra opts
|
|
||||||
* @param opts.as Determines if editor is shown as a menu or a switch. Either 'menu' or 'switch'. Default: 'menu'
|
|
||||||
* @returns A stringLiteral prop type
|
* @returns A stringLiteral prop type
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export function stringLiteral<Opts extends {[key in string]: string}>(
|
export function stringLiteral<Opts extends {[key in string]: string}>(
|
||||||
|
/**
|
||||||
|
* Default value (a string that equals one of the options)
|
||||||
|
*/
|
||||||
defaultValue: Extract<keyof Opts, string>,
|
defaultValue: Extract<keyof Opts, string>,
|
||||||
|
/**
|
||||||
|
* The options. Use the `"value": "Label"` format.
|
||||||
|
*
|
||||||
|
* An object like `{[value]: Label}`. Example: `{r: "Red", "g": "Green"}`
|
||||||
|
*/
|
||||||
options: Opts,
|
options: Opts,
|
||||||
|
/**
|
||||||
|
* opts.as Determines if editor is shown as a menu or a switch. Either 'menu' or 'switch'. Default: 'menu'
|
||||||
|
*/
|
||||||
opts?: {as?: 'menu' | 'switch'} & PropTypeConfigOpts,
|
opts?: {as?: 'menu' | 'switch'} & PropTypeConfigOpts,
|
||||||
): PropTypeConfig_StringLiteral<Extract<keyof Opts, string>> {
|
): PropTypeConfig_StringLiteral<Extract<keyof Opts, string>> {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -130,9 +130,9 @@ export interface ISequence {
|
||||||
*/
|
*/
|
||||||
attachAudio(args: IAttachAudioArgs): Promise<{
|
attachAudio(args: IAttachAudioArgs): Promise<{
|
||||||
/**
|
/**
|
||||||
* An {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer}.
|
* An {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer | AudioBuffer}.
|
||||||
* If `args.source` is a URL, then `decodedBuffer` would be the result
|
* If `args.source` is a URL, then `decodedBuffer` would be the result
|
||||||
* of {@link https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData audioContext.decodeAudioData()}
|
* of {@link https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData | audioContext.decodeAudioData()}
|
||||||
* on the audio file at that URL.
|
* on the audio file at that URL.
|
||||||
*
|
*
|
||||||
* If `args.source` is an `AudioBuffer`, then `decodedBuffer` would be equal to `args.source`
|
* If `args.source` is an `AudioBuffer`, then `decodedBuffer` would be equal to `args.source`
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
// eslint-disable-next-line tsdoc/syntax
|
||||||
* @jest-environment jsdom
|
* @jest-environment jsdom
|
||||||
*/
|
*/
|
||||||
import {setupTestSheet} from '@theatre/shared/testUtils'
|
import {setupTestSheet} from '@theatre/shared/testUtils'
|
||||||
|
|
|
@ -121,7 +121,8 @@ export default class SheetObject implements IdentityDerivationProvider {
|
||||||
|
|
||||||
getIdentityDerivation(path: Array<string | number>): IDerivation<unknown> {
|
getIdentityDerivation(path: Array<string | number>): IDerivation<unknown> {
|
||||||
/**
|
/**
|
||||||
* @todo perf: Too much indirection here.
|
* @remarks
|
||||||
|
* TODO perf: Too much indirection here.
|
||||||
*/
|
*/
|
||||||
return prism(() => {
|
return prism(() => {
|
||||||
const allValuesP = val(this.getValues())
|
const allValuesP = val(this.getValues())
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/**
|
/**
|
||||||
|
// eslint-disable-next-line tsdoc/syntax
|
||||||
* @jest-environment jsdom
|
* @jest-environment jsdom
|
||||||
*/
|
*/
|
||||||
import {setupTestSheet} from '@theatre/shared/testUtils'
|
import {setupTestSheet} from '@theatre/shared/testUtils'
|
||||||
|
|
|
@ -40,8 +40,8 @@ export interface ISheet {
|
||||||
*
|
*
|
||||||
* **Docs: https://docs.theatrejs.com/in-depth/#objects**
|
* **Docs: https://docs.theatrejs.com/in-depth/#objects**
|
||||||
*
|
*
|
||||||
* @param key Each object is identified by a key, which is a non-empty string
|
* @param key - Each object is identified by a key, which is a non-empty string
|
||||||
* @param props The props of the object. See examples
|
* @param props - The props of the object. See examples
|
||||||
*
|
*
|
||||||
* @returns An Object
|
* @returns An Object
|
||||||
*
|
*
|
||||||
|
|
|
@ -24,15 +24,15 @@ export function createBundles(watch: boolean) {
|
||||||
/**
|
/**
|
||||||
* Prevents double-bundling react.
|
* Prevents double-bundling react.
|
||||||
*
|
*
|
||||||
* @notes
|
* @remarks
|
||||||
* Ideally we'd want to just bundle our own fixed version of react to keep things
|
* Ideally we'd want to just bundle our own fixed version of react to keep things
|
||||||
* simple, but for now we keep react external because we're exposing these
|
* simple, but for now we keep react external because we're exposing these
|
||||||
* react-dependant API from @theatre/studio:
|
* react-dependant API from \@theatre/studio:
|
||||||
*
|
*
|
||||||
* - ToolbarIconButton
|
* - `ToolbarIconButton`
|
||||||
* - IStudio['extend']({globalToolbar: {component}})
|
* - `IStudio['extend']({globalToolbar: {component}})`
|
||||||
*
|
*
|
||||||
* These are further exposed by @theatre/r3f which provides `<Wrapper />`
|
* These are further exposed by \@theatre/r3f which provides `<Wrapper />`
|
||||||
* as an API.
|
* as an API.
|
||||||
*
|
*
|
||||||
* It's probably possible to bundle our own react version and somehow share it
|
* It's probably possible to bundle our own react version and somehow share it
|
||||||
|
@ -58,11 +58,11 @@ export function createBundles(watch: boolean) {
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes
|
* @remarks
|
||||||
* I just disabled ESM builds because I couldn't get them to work
|
* I just disabled ESM builds because I couldn't get them to work
|
||||||
* with create-react-app which uses webpack v4. I'm sure that's fixable,
|
* with create-react-app which uses webpack v4. I'm sure that's fixable,
|
||||||
* but not worth the hassle right now. There is not much to tree-shake
|
* but not worth the hassle right now. There is not much to tree-shake
|
||||||
* in @theatre/core as we've done all the tree-shaking pre-bundle already.
|
* in \@theatre/core as we've done all the tree-shaking pre-bundle already.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// build({
|
// build({
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type SheetTemplate from '@theatre/core/sheets/SheetTemplate'
|
||||||
import type {$IntentionalAny} from './utils/types'
|
import type {$IntentionalAny} from './utils/types'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Since @theatre/core and @theatre/studio are separate bundles,
|
* Since \@theatre/core and \@theatre/studio are separate bundles,
|
||||||
* they cannot use `x instanceof Y` to detect object types.
|
* they cannot use `x instanceof Y` to detect object types.
|
||||||
*
|
*
|
||||||
* The functions in this module are supposed to be a replacement for that.
|
* The functions in this module are supposed to be a replacement for that.
|
||||||
|
|
|
@ -22,7 +22,8 @@ function typeOfValue(v: unknown): ValueType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo explain what this does.
|
* @remarks
|
||||||
|
* TODO explain what this does.
|
||||||
*/
|
*/
|
||||||
export default function minimalOverride<T>(base: T, override: T): T {
|
export default function minimalOverride<T>(base: T, override: T): T {
|
||||||
const typeofOverride = typeOfValue(override)
|
const typeofOverride = typeOfValue(override)
|
||||||
|
|
|
@ -124,7 +124,7 @@ export const stringifyNumber = (n: number): string => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* it is expected that both args are 0 < arg < 1
|
* it is expected that both args are 0 \< arg \< 1
|
||||||
*/
|
*/
|
||||||
export const roundestFloat = (a: number, b: number): number => {
|
export const roundestFloat = (a: number, b: number): number => {
|
||||||
const inString = {
|
const inString = {
|
||||||
|
|
|
@ -32,7 +32,7 @@ export type StrictRecord<Key extends string, V> = {[K in Key]?: V}
|
||||||
* This is supposed to create an "opaque" or "nominal" type, but since typescript
|
* This is supposed to create an "opaque" or "nominal" type, but since typescript
|
||||||
* doesn't allow generic index signatures, we're leaving it be.
|
* doesn't allow generic index signatures, we're leaving it be.
|
||||||
*
|
*
|
||||||
* @todo fix this once https://github.com/microsoft/TypeScript/pull/26797 lands (likely typescript 4.4)
|
* TODO fix this once https://github.com/microsoft/TypeScript/pull/26797 lands (likely typescript 4.4)
|
||||||
*/
|
*/
|
||||||
export type Nominal<T, N extends string> = T
|
export type Nominal<T, N extends string> = T
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ export interface IScrubApi {
|
||||||
* set(obj.props.z, 10)
|
* set(obj.props.z, 10)
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
* @param pointer A Pointer, like object.props
|
* @param pointer - A Pointer, like object.props
|
||||||
* @param value The value to override the existing value. This is treated as a deep partial value.
|
* @param value - The value to override the existing value. This is treated as a deep partial value.
|
||||||
*/
|
*/
|
||||||
set<T>(pointer: Pointer<T>, value: T): void
|
set<T>(pointer: Pointer<T>, value: T): void
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,8 @@ export class Studio {
|
||||||
this.paneManager = new PaneManager(this)
|
this.paneManager = new PaneManager(this)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo If studio.initialize() is not called within a few milliseconds,
|
* @remarks
|
||||||
|
* TODO If studio.initialize() is not called within a few milliseconds,
|
||||||
* we should console.warn() the user that `@theatre/studio` is still in
|
* we should console.warn() the user that `@theatre/studio` is still in
|
||||||
* their bundle. This way we can avoid issues like
|
* their bundle. This way we can avoid issues like
|
||||||
* [this](https://discord.com/channels/870988717190426644/892469755225710642/892479678797971486).
|
* [this](https://discord.com/channels/870988717190426644/892469755225710642/892479678797971486).
|
||||||
|
|
|
@ -52,7 +52,7 @@ export interface ITransactionAPI {
|
||||||
* set(obj.props)
|
* set(obj.props)
|
||||||
* })
|
* })
|
||||||
* ```
|
* ```
|
||||||
* @param pointer A pointer, like object.props
|
* @param pointer - A pointer, like object.props
|
||||||
*/
|
*/
|
||||||
unset<V>(pointer: Pointer<V>): void
|
unset<V>(pointer: Pointer<V>): void
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
/**
|
|
||||||
* @module @theatre/studio
|
|
||||||
*/
|
|
||||||
import {setStudio} from '@theatre/studio/getStudio'
|
import {setStudio} from '@theatre/studio/getStudio'
|
||||||
import {Studio} from '@theatre/studio/Studio'
|
import {Studio} from '@theatre/studio/Studio'
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ const ClosePanelButton = styled.button`
|
||||||
* pane when a drag gesture is active in theatre's UI. It's a hack and its downside
|
* pane when a drag gesture is active in theatre's UI. It's a hack and its downside
|
||||||
* is that pane content cannot interact with the rest of theatre's UI while a drag
|
* is that pane content cannot interact with the rest of theatre's UI while a drag
|
||||||
* gesture is active.
|
* gesture is active.
|
||||||
* @todo find a less hacky way?
|
* TODO find a less hacky way?
|
||||||
*/
|
*/
|
||||||
const F2 = styled(F2Impl)`
|
const F2 = styled(F2Impl)`
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
@ -68,10 +68,10 @@ const Curve: React.FC<IProps> = (props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assuming a box such that: {x: 0, y: 0, width: 1px, height: 1px}
|
* Assuming a box such that: `{x: 0, y: 0, width: 1px, height: 1px}`
|
||||||
* and given the desired coordinates of:
|
* and given the desired coordinates of:
|
||||||
* {x: xInUnitSpace, y: yInExtremumSpace, width: widthInUnitSpace, height: heightInExtremumSpace},
|
* `{x: xInUnitSpace, y: yInExtremumSpace, width: widthInUnitSpace, height: heightInExtremumSpace}`,
|
||||||
* transformBox() returns a CSS transform that transforms the box into its right dimensions
|
* `transformBox()` returns a CSS transform that transforms the box into its right dimensions
|
||||||
* in the GraphEditor space.
|
* in the GraphEditor space.
|
||||||
*/
|
*/
|
||||||
export function transformBox(
|
export function transformBox(
|
||||||
|
|
|
@ -5,7 +5,7 @@ const studioTicker = new Ticker()
|
||||||
export default studioTicker
|
export default studioTicker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo users should also be able to define their own ticker.
|
* TODO users should also be able to define their own ticker.
|
||||||
*/
|
*/
|
||||||
const onAnimationFrame = (t: number) => {
|
const onAnimationFrame = (t: number) => {
|
||||||
studioTicker.tick(t)
|
studioTicker.tick(t)
|
||||||
|
|
|
@ -42,7 +42,7 @@ type State = {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo low-hanging-fruit replace all DraggableArea instances with `react-use-gesture`
|
* TODO low-hanging-fruit replace all DraggableArea instances with `react-use-gesture`
|
||||||
*/
|
*/
|
||||||
class DraggableArea extends React.PureComponent<IProps, {}> {
|
class DraggableArea extends React.PureComponent<IProps, {}> {
|
||||||
s: State
|
s: State
|
||||||
|
|
|
@ -22,9 +22,6 @@ type Option = {
|
||||||
value: string
|
value: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo Implement me
|
|
||||||
*/
|
|
||||||
const BasicSelect: React.FC<{
|
const BasicSelect: React.FC<{
|
||||||
label: string | ElementType
|
label: string | ElementType
|
||||||
options: Array<Option>
|
options: Array<Option>
|
||||||
|
|
|
@ -33,7 +33,7 @@ interface ActionCreatorCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is basically the same as {createAction} from 'redux-actions',
|
* This is basically the same as `{createAction}` from 'redux-actions',
|
||||||
* only that you can query the type of the action from the resulting
|
* only that you can query the type of the action from the resulting
|
||||||
* action creator.
|
* action creator.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue