From aec6b2a25135e6264e7529e7d3800c4bc3badee6 Mon Sep 17 00:00:00 2001 From: Aria Minaei Date: Wed, 23 Feb 2022 22:53:39 +0100 Subject: [PATCH] Fix a bunch of eslint warnings --- packages/dataverse/src/Atom.ts | 14 +++++++------- packages/dataverse/src/Box.ts | 6 +++--- packages/dataverse/src/PointerProxy.ts | 4 ++-- packages/dataverse/src/Ticker.ts | 10 +++++----- .../src/derivations/AbstractDerivation.ts | 12 ++++++------ .../src/derivations/ConstantDerivation.ts | 2 +- .../dataverse/src/derivations/DerivationEmitter.ts | 4 ++-- .../src/derivations/DerivationFromSource.ts | 4 ++-- packages/dataverse/src/derivations/IDerivation.ts | 12 ++++++------ .../dataverse/src/derivations/iterateOver.test.ts | 3 +-- .../dataverse/src/derivations/prism/prism.test.ts | 3 +-- packages/dataverse/src/derivations/prism/prism.ts | 2 +- packages/dataverse/src/integration.test.ts | 3 +-- packages/dataverse/src/pointer.ts | 12 ++++++------ packages/dataverse/src/utils/Emitter.ts | 6 +++--- packages/dataverse/src/utils/Tappable.ts | 2 +- theatre/core/src/sheetObjects/SheetObject.test.ts | 3 +-- 17 files changed, 49 insertions(+), 53 deletions(-) diff --git a/packages/dataverse/src/Atom.ts b/packages/dataverse/src/Atom.ts index 4625ff7..a0acacd 100644 --- a/packages/dataverse/src/Atom.ts +++ b/packages/dataverse/src/Atom.ts @@ -30,7 +30,7 @@ export interface IdentityDerivationProvider { /** * Returns a derivation of the value at the provided path. * - * @param path The path to create the derivation at. + * @param path - The path to create the derivation at. */ getIdentityDerivation(path: Array): IDerivation } @@ -139,7 +139,7 @@ export default class Atom /** * Sets the state of the atom. * - * @param newState The new state of the atom. + * @param newState - The new state of the atom. */ setState(newState: State) { const oldState = this._currentState @@ -177,8 +177,8 @@ export default class Atom * someAtom.getIn(['a']) // 2 * ``` * - * @param path The path to call the reducer at. - * @param reducer The function to use for creating the new state. + * @param path - The path to call the reducer at. + * @param reducer - The function to use for creating the new state. */ // TODO: Why is this a property and not a method? reduceState: PathBasedReducer = ( @@ -240,7 +240,7 @@ export default class Atom /** * Returns a new derivation of the value at the provided path. * - * @param path The path to create the derivation at. + * @param path - The path to create the derivation at. */ getIdentityDerivation(path: Array): IDerivation { return new DerivationFromSource<$IntentionalAny>( @@ -256,7 +256,7 @@ const identityDerivationWeakMap = new WeakMap<{}, IDerivation>() * Returns a derivation of the value at the provided pointer. Derivations are * cached per pointer. * - * @param pointer The pointer to return the derivation at. + * @param pointer - The pointer to return the derivation at. */ export const valueDerivation =

>( pointer: P, @@ -297,7 +297,7 @@ function isIdentityChangeProvider( * For pointers, the value is returned by first creating a derivation, so it is * reactive e.g. when used in a `prism`. * - * @param pointerOrDerivationOrPlainValue The argument to return a value from. + * @param pointerOrDerivationOrPlainValue - The argument to return a value from. */ export const val =

( pointerOrDerivationOrPlainValue: P, diff --git a/packages/dataverse/src/Box.ts b/packages/dataverse/src/Box.ts index 813dbae..1b15084 100644 --- a/packages/dataverse/src/Box.ts +++ b/packages/dataverse/src/Box.ts @@ -9,7 +9,7 @@ export interface IBox { /** * Sets the value of the Box. * - * @param v The value to update the Box with. + * @param v - The value to update the Box with. */ set(v: V): void @@ -43,7 +43,7 @@ export default class Box implements IBox { private _emitter = new Emitter() /** - * @param _value The initial value of the Box. + * @param _value - The initial value of the Box. */ constructor( /** @@ -60,7 +60,7 @@ export default class Box implements IBox { /** * Sets the value of the Box. * - * @param v The value to update the Box with. + * @param v - The value to update the Box with. */ set(v: V) { if (v === this._value) return diff --git a/packages/dataverse/src/PointerProxy.ts b/packages/dataverse/src/PointerProxy.ts index 7230e16..a6a4e19 100644 --- a/packages/dataverse/src/PointerProxy.ts +++ b/packages/dataverse/src/PointerProxy.ts @@ -36,7 +36,7 @@ export default class PointerProxy /** * Sets the underlying pointer. - * @param p The pointer to be proxied. + * @param p - The pointer to be proxied. */ setPointer(p: Pointer) { this._currentPointerBox.set(p) @@ -45,7 +45,7 @@ export default class PointerProxy /** * Returns a derivation of the value at the provided sub-path of the proxied pointer. * - * @param path The path to create the derivation at. + * @param path - The path to create the derivation at. */ getIdentityDerivation(path: Array) { return this._currentPointerBox.derivation.flatMap((p) => { diff --git a/packages/dataverse/src/Ticker.ts b/packages/dataverse/src/Ticker.ts index 78de984..42d3218 100644 --- a/packages/dataverse/src/Ticker.ts +++ b/packages/dataverse/src/Ticker.ts @@ -26,7 +26,7 @@ export default class Ticker { * Note that `fn` will be added to a `Set()`. Which means, if you call `onThisOrNextTick(fn)` * with the same fn twice in a single tick, it'll only run once. * - * @param fn The function to be registered. + * @param fn - The function to be registered. * * @see offThisOrNextTick */ @@ -37,7 +37,7 @@ export default class Ticker { /** * Registers a side effect to be called on the next tick. * - * @param fn The function to be registered. + * @param fn - The function to be registered. * * @see onThisOrNextTick * @see offNextTick @@ -49,7 +49,7 @@ export default class Ticker { /** * De-registers a fn to be called either on this tick or the next tick. * - * @param fn The function to be de-registered. + * @param fn - The function to be de-registered. * * @see onThisOrNextTick */ @@ -60,7 +60,7 @@ export default class Ticker { /** * De-registers a fn to be called on the next tick. * - * @param fn The function to be de-registered. + * @param fn - The function to be de-registered. * * @see onNextTick */ @@ -81,7 +81,7 @@ export default class Ticker { /** * Triggers a tick which starts executing the callbacks scheduled for this tick. * - * @param t The time at the tick. + * @param t - The time at the tick. * * @see onThisOrNextTick * @see onNextTick diff --git a/packages/dataverse/src/derivations/AbstractDerivation.ts b/packages/dataverse/src/derivations/AbstractDerivation.ts index 0e37dc4..dcce823 100644 --- a/packages/dataverse/src/derivations/AbstractDerivation.ts +++ b/packages/dataverse/src/derivations/AbstractDerivation.ts @@ -108,8 +108,8 @@ export default abstract class AbstractDerivation implements IDerivation { * Convenience method that taps (subscribes to) the derivation using `this.changes(ticker).tap(fn)` and immediately calls * the callback with the current value. * - * @param ticker The ticker to use for batching. - * @param fn The callback to call on update. + * @param ticker - The ticker to use for batching. + * @param fn - The callback to call on update. * * @see changes */ @@ -122,7 +122,7 @@ export default abstract class AbstractDerivation implements IDerivation { /** * Add a derivation as a dependent of this derivation. * - * @param d The derivation to be made a dependent of this derivation. + * @param d - The derivation to be made a dependent of this derivation. * * @see removeDependent */ @@ -139,7 +139,7 @@ export default abstract class AbstractDerivation implements IDerivation { /** * Remove a derivation as a dependent of this derivation. * - * @param d The derivation to be removed from as a dependent of this derivation. + * @param d - The derivation to be removed from as a dependent of this derivation. * * @see addDependent */ @@ -229,7 +229,7 @@ export default abstract class AbstractDerivation implements IDerivation { * Creates a new derivation from this derivation using the provided mapping function. The new derivation's value will be * `fn(thisDerivation.getValue())`. * - * @param fn The mapping function to use. Note: it accepts a plain value, not a derivation. + * @param fn - The mapping function to use. Note: it accepts a plain value, not a derivation. */ map(fn: (v: V) => T): IDerivation { return map(this, fn) @@ -248,7 +248,7 @@ export default abstract class AbstractDerivation implements IDerivation { * new Box(3).derivation.flatMap((value) => new Box(value).derivation).getValue() * ``` * - * @param fn The mapping function to use. Note: it accepts a plain value, not a derivation. + * @param fn - The mapping function to use. Note: it accepts a plain value, not a derivation. */ flatMap( fn: (v: V) => R, diff --git a/packages/dataverse/src/derivations/ConstantDerivation.ts b/packages/dataverse/src/derivations/ConstantDerivation.ts index 97de197..8d37a5a 100644 --- a/packages/dataverse/src/derivations/ConstantDerivation.ts +++ b/packages/dataverse/src/derivations/ConstantDerivation.ts @@ -7,7 +7,7 @@ export default class ConstantDerivation extends AbstractDerivation { private readonly _v: V /** - * @param v The value of the derivation. + * @param v - The value of the derivation. */ constructor(v: V) { super() diff --git a/packages/dataverse/src/derivations/DerivationEmitter.ts b/packages/dataverse/src/derivations/DerivationEmitter.ts index 3af768b..e4428fe 100644 --- a/packages/dataverse/src/derivations/DerivationEmitter.ts +++ b/packages/dataverse/src/derivations/DerivationEmitter.ts @@ -15,8 +15,8 @@ export default class DerivationEmitter { private _hadTappers: boolean /** - * @param derivation The derivation to emit events for. - * @param ticker The ticker to use to batch events. + * @param derivation - The derivation to emit events for. + * @param ticker - The ticker to use to batch events. */ constructor(derivation: IDerivation, ticker: Ticker) { this._derivation = derivation diff --git a/packages/dataverse/src/derivations/DerivationFromSource.ts b/packages/dataverse/src/derivations/DerivationFromSource.ts index d981a57..52828bc 100644 --- a/packages/dataverse/src/derivations/DerivationFromSource.ts +++ b/packages/dataverse/src/derivations/DerivationFromSource.ts @@ -12,8 +12,8 @@ export default class DerivationFromSource extends AbstractDerivation { private _hasCachedValue: boolean /** - * @param _tapToSource A function that takes a listener and subscribes it to the underlying data source. - * @param _getValueFromSource A function that returns the current value of the data source. + * @param _tapToSource - A function that takes a listener and subscribes it to the underlying data source. + * @param _getValueFromSource - A function that returns the current value of the data source. */ constructor( private readonly _tapToSource: (listener: (newValue: V) => void) => VoidFn, diff --git a/packages/dataverse/src/derivations/IDerivation.ts b/packages/dataverse/src/derivations/IDerivation.ts index b0024e0..dfa72d6 100644 --- a/packages/dataverse/src/derivations/IDerivation.ts +++ b/packages/dataverse/src/derivations/IDerivation.ts @@ -40,8 +40,8 @@ export interface IDerivation { * Convenience method that taps (subscribes to) the derivation using `this.changes(ticker).tap(fn)` and immediately calls * the callback with the current value. * - * @param ticker The ticker to use for batching. - * @param fn The callback to call on update. + * @param ticker - The ticker to use for batching. + * @param fn - The callback to call on update. * * @see changes */ @@ -50,7 +50,7 @@ export interface IDerivation { /** * Add a derivation as a dependent of this derivation. * - * @param d The derivation to be made a dependent of this derivation. + * @param d - The derivation to be made a dependent of this derivation. * * @see removeDependent */ @@ -59,7 +59,7 @@ export interface IDerivation { /** * Remove a derivation as a dependent of this derivation. * - * @param d The derivation to be removed from as a dependent of this derivation. + * @param d - The derivation to be removed from as a dependent of this derivation. * * @see addDependent */ @@ -74,7 +74,7 @@ export interface IDerivation { * Creates a new derivation from this derivation using the provided mapping function. The new derivation's value will be * `fn(thisDerivation.getValue())`. * - * @param fn The mapping function to use. Note: it accepts a plain value, not a derivation. + * @param fn - The mapping function to use. Note: it accepts a plain value, not a derivation. */ map(fn: (v: V) => T): IDerivation @@ -91,7 +91,7 @@ export interface IDerivation { * new Box(3).derivation.flatMap((value) => new Box(value).derivation).getValue() * ``` * - * @param fn The mapping function to use. Note: it accepts a plain value, not a derivation. + * @param fn - The mapping function to use. Note: it accepts a plain value, not a derivation. */ flatMap( fn: (v: V) => R, diff --git a/packages/dataverse/src/derivations/iterateOver.test.ts b/packages/dataverse/src/derivations/iterateOver.test.ts index 39d6f6d..9bbf3d0 100644 --- a/packages/dataverse/src/derivations/iterateOver.test.ts +++ b/packages/dataverse/src/derivations/iterateOver.test.ts @@ -1,5 +1,4 @@ -/** - * // eslint-disable-next-line +/* * @jest-environment jsdom */ import Atom from '../Atom' diff --git a/packages/dataverse/src/derivations/prism/prism.test.ts b/packages/dataverse/src/derivations/prism/prism.test.ts index 85fb416..7aae044 100644 --- a/packages/dataverse/src/derivations/prism/prism.test.ts +++ b/packages/dataverse/src/derivations/prism/prism.test.ts @@ -1,5 +1,4 @@ -/** - // eslint-disable-next-line +/* * @jest-environment jsdom */ import Atom, {val} from '../../Atom' diff --git a/packages/dataverse/src/derivations/prism/prism.ts b/packages/dataverse/src/derivations/prism/prism.ts index 666f4f7..f502f3a 100644 --- a/packages/dataverse/src/derivations/prism/prism.ts +++ b/packages/dataverse/src/derivations/prism/prism.ts @@ -338,7 +338,7 @@ type IPrismFn = { * Creates a derivation from the passed function that adds all derivations referenced * in it as dependencies, and reruns the function when these change. * - * @param fn The function to rerun when the derivations referenced in it change. + * @param fn - The function to rerun when the derivations referenced in it change. */ const prism: IPrismFn = (fn) => { return new PrismDerivation(fn) diff --git a/packages/dataverse/src/integration.test.ts b/packages/dataverse/src/integration.test.ts index 5ee86ef..7bb03a8 100644 --- a/packages/dataverse/src/integration.test.ts +++ b/packages/dataverse/src/integration.test.ts @@ -1,5 +1,4 @@ -/** - // eslint-disable-next-line +/* * @jest-environment jsdom */ import Atom, {val} from './Atom' diff --git a/packages/dataverse/src/pointer.ts b/packages/dataverse/src/pointer.ts index f1f002a..aab663f 100644 --- a/packages/dataverse/src/pointer.ts +++ b/packages/dataverse/src/pointer.ts @@ -80,7 +80,7 @@ const handler = { * Returns the metadata associated with the pointer. Usually the root object and * the path. * - * @param p The pointer. + * @param p - The pointer. */ export const getPointerMeta = ( p: Pointer<$IntentionalAny> | Pointer<{}> | Pointer, @@ -100,7 +100,7 @@ export const getPointerMeta = ( * const {root, path} = getPointerParts(pointer) * ``` * - * @param p The pointer. + * @param p - The pointer. * * @returns An object with two properties: `root`-the root object or the pointer, and `path`-the path of the pointer. `path` is an array of the property-chain. */ @@ -136,11 +136,11 @@ export const getPointerParts = ( * }); * ``` * - * @param args The pointer parameters. - * @param args.root The {@link Atom} the pointer applies to. - * @param args.path The path to the (nested) property the pointer points to. + * @param args - The pointer parameters. + * @param args.root - The {@link Atom} the pointer applies to. + * @param args.path - The path to the (nested) property the pointer points to. * - * @typeParam O The type of the value being pointed to. + * @typeParam O - The type of the value being pointed to. */ function pointer(args: {root: {}; path?: Array}) { const meta: PointerMeta = { diff --git a/packages/dataverse/src/utils/Emitter.ts b/packages/dataverse/src/utils/Emitter.ts index 3db8cb3..289136b 100644 --- a/packages/dataverse/src/utils/Emitter.ts +++ b/packages/dataverse/src/utils/Emitter.ts @@ -49,7 +49,7 @@ export default class Emitter { /** * Emit a value. * - * @param payload The value to be emitted. + * @param payload - The value to be emitted. */ emit(payload: V) { this._tappers.forEach((cb) => { @@ -69,13 +69,13 @@ export default class Emitter { * * @callback Emitter~numberOfTappersChangeHandler * - * @param {number} n The current number of tappers (subscribers). + * @param {number} n - The current number of tappers (subscribers). */ /** * Calls callback when the number of tappers (subscribers) changes. * - * @param {Emitter~requestCallback} cb The function to be called. + * @param {Emitter~requestCallback} cb - The function to be called. */ onNumberOfTappersChange(cb: (n: number) => void) { this._onNumberOfTappersChangeListener = cb diff --git a/packages/dataverse/src/utils/Tappable.ts b/packages/dataverse/src/utils/Tappable.ts index 3201f52..47b067a 100644 --- a/packages/dataverse/src/utils/Tappable.ts +++ b/packages/dataverse/src/utils/Tappable.ts @@ -61,7 +61,7 @@ export default class Tappable { /** * Tap (subscribe to) the data source. * - * @param cb The callback to be called on a change. + * @param cb - The callback to be called on a change. */ tap(cb: Listener): Untap { const tapperId = this._lastTapperId++ diff --git a/theatre/core/src/sheetObjects/SheetObject.test.ts b/theatre/core/src/sheetObjects/SheetObject.test.ts index e97633b..51e8281 100644 --- a/theatre/core/src/sheetObjects/SheetObject.test.ts +++ b/theatre/core/src/sheetObjects/SheetObject.test.ts @@ -1,5 +1,4 @@ -/** - // eslint-disable-next-line tsdoc/syntax +/* * @jest-environment jsdom */ import {setupTestSheet} from '@theatre/shared/testUtils'