From 2ab92f4635169641bdf56b1c45e571ba5820befb Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 23 Oct 2017 07:43:09 -0700 Subject: [PATCH] enzyme: Fix lint (#20855) --- types/enzyme/index.d.ts | 56 +++-------------------------------------- 1 file changed, 4 insertions(+), 52 deletions(-) diff --git a/types/enzyme/index.d.ts b/types/enzyme/index.d.ts index cb5caa4f3c..101215462f 100644 --- a/types/enzyme/index.d.ts +++ b/types/enzyme/index.d.ts @@ -48,31 +48,26 @@ export type Intercepter = (intercepter: T) => void; export interface CommonWrapper

{ /** * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true. - * @param predicate */ filterWhere(predicate: (wrapper: this) => boolean): this; /** * Returns whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in. - * @param node */ contains(node: ReactElement | string): boolean; /** * Returns whether or not a given react element exists in the shallow render tree. - * @param node */ containsMatchingElement(node: ReactElement): boolean; /** * Returns whether or not all the given react elements exists in the shallow render tree - * @param nodes */ containsAllMatchingElements(nodes: Array>): boolean; /** * Returns whether or not one of the given react elements exists in the shallow render tree. - * @param nodes */ containsAnyMatchingElements(nodes: Array>): boolean; @@ -88,13 +83,11 @@ export interface CommonWrapper

{ /** * Returns whether or not the current node has a className prop including the passed in class name. - * @param className */ hasClass(className: string): boolean; /** * Returns whether or not the current node matches a provided selector. - * @param selector */ is(selector: EnzymeSelector): boolean; @@ -112,7 +105,6 @@ export interface CommonWrapper

{ /** * Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector. * This method is effectively the negation or inverse of filter. - * @param selector */ not(selector: EnzymeSelector): this; @@ -134,7 +126,6 @@ export interface CommonWrapper

{ /** * Returns the node at a given index of the current wrapper. - * @param index */ get(index: number): ReactElement; @@ -165,7 +156,6 @@ export interface CommonWrapper

{ /** * Returns a wrapper around the node at a given index of the current wrapper. - * @param index */ at(index: number): this; @@ -191,7 +181,6 @@ export interface CommonWrapper

{ /** * Returns the state hash for the root node of the wrapper. Optionally pass in a prop name and it will return just that value. - * @param [key] */ state(): S; state(key: K): S[K]; @@ -214,7 +203,6 @@ export interface CommonWrapper

{ * Returns the prop value for the node of the current wrapper with the provided key. * * NOTE: can only be called on a wrapper of a single node. - * @param key */ prop(key: K): P[K]; prop(key: string): T; @@ -228,7 +216,6 @@ export interface CommonWrapper

{ /** * Simulate events. * Returns itself. - * @param event * @param args? */ simulate(event: string, ...args: any[]): this; @@ -242,8 +229,6 @@ export interface CommonWrapper

{ * Returns itself. * * NOTE: can only be called on a wrapper instance that is also the root instance. - * @param state - * @param [callback] */ setState(state: Pick, callback?: () => void): this; @@ -256,7 +241,6 @@ export interface CommonWrapper

{ * Returns itself. * * NOTE: can only be called on a wrapper instance that is also the root instance. - * @param props */ setProps(props: Pick): this; @@ -266,7 +250,6 @@ export interface CommonWrapper

{ * Returns itself. * * NOTE: can only be called on a wrapper instance that is also the root instance. - * @param state */ setContext(context: any): this; @@ -320,40 +303,32 @@ export interface CommonWrapper

{ /** * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node * is passed in as a ShallowWrapper, and is processed from left to right. - * @param fn - * @param initialValue */ reduce(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R; /** * Applies the provided reducing function to every node in the wrapper to reduce to a single value. * Each node is passed in as a ShallowWrapper, and is processed from right to left. - * @param fn - * @param initialValue */ reduceRight(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R; /** * Returns whether or not any of the nodes in the wrapper match the provided selector. - * @param selector */ some(selector: EnzymeSelector): boolean; /** * Returns whether or not any of the nodes in the wrapper pass the provided predicate function. - * @param fn */ someWhere(fn: (wrapper: this) => boolean): boolean; /** * Returns whether or not all of the nodes in the wrapper match the provided selector. - * @param selector */ every(selector: EnzymeSelector): boolean; /** * Returns whether or not all of the nodes in the wrapper pass the provided predicate function. - * @param fn */ everyWhere(fn: (wrapper: this) => boolean): boolean; @@ -378,11 +353,9 @@ export interface CommonWrapper

{ length: number; } -export class ShallowWrapper { +export interface ShallowWrapper

extends CommonWrapper {} +export class ShallowWrapper

{ constructor(nodes: JSX.Element[] | JSX.Element, root?: ShallowWrapper, options?: ShallowRendererProps); -} - -export interface ShallowWrapper

extends CommonWrapper { shallow(options?: ShallowRendererProps): ShallowWrapper; unmount(): this; @@ -404,14 +377,12 @@ export interface ShallowWrapper

extends CommonWrapper { /** * Finds every node in the render tree that returns true for the provided predicate function. - * @param predicate */ findWhere(predicate: (wrapper: ShallowWrapper) => boolean): ShallowWrapper; /** * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector * can be provided and it will filter the children by this selector. - * @param [selector] */ children(component: ComponentClass): ShallowWrapper; children(statelessComponent: StatelessComponent): ShallowWrapper; @@ -420,7 +391,6 @@ export interface ShallowWrapper

extends CommonWrapper { /** * Returns a new wrapper with child at the specified index. - * @param index */ childAt(index: number): ShallowWrapper; childAt(index: number): ShallowWrapper; @@ -428,7 +398,6 @@ export interface ShallowWrapper

extends CommonWrapper { /** * Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result. * NOTE: can only be called on wrapper of a single non-DOM component element node. - * @param [options] */ dive(options?: ShallowRendererProps): ShallowWrapper; @@ -445,7 +414,6 @@ export interface ShallowWrapper

extends CommonWrapper { * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. * * Note: can only be called on a wrapper of a single node. - * @param [selector] */ parents(component: ComponentClass): ShallowWrapper; parents(statelessComponent: StatelessComponent): ShallowWrapper; @@ -457,7 +425,6 @@ export interface ShallowWrapper

extends CommonWrapper { * ancestors in the tree, starting with itself. * * Note: can only be called on a wrapper of a single node. - * @param selector */ closest(component: ComponentClass): ShallowWrapper; closest(statelessComponent: StatelessComponent): ShallowWrapper; @@ -470,11 +437,10 @@ export interface ShallowWrapper

extends CommonWrapper { parent(): ShallowWrapper; } -export class ReactWrapper { +export interface ReactWrapper

extends CommonWrapper {} +export class ReactWrapper

{ constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper, options?: MountRendererProps); -} -export interface ReactWrapper

extends CommonWrapper { unmount(): this; mount(): this; @@ -517,7 +483,6 @@ export interface ReactWrapper

extends CommonWrapper { /** * Finds every node in the render tree that returns true for the provided predicate function. - * @param predicate */ findWhere(predicate: (wrapper: ReactWrapper) => boolean): ReactWrapper; @@ -531,7 +496,6 @@ export interface ReactWrapper

extends CommonWrapper { /** * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector * can be provided and it will filter the children by this selector. - * @param [selector] */ children(component: ComponentClass): ReactWrapper; children(statelessComponent: StatelessComponent): ReactWrapper; @@ -540,7 +504,6 @@ export interface ReactWrapper

extends CommonWrapper { /** * Returns a new wrapper with child at the specified index. - * @param index */ childAt(index: number): ReactWrapper; childAt(index: number): ReactWrapper; @@ -550,7 +513,6 @@ export interface ReactWrapper

extends CommonWrapper { * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. * * Note: can only be called on a wrapper of a single node. - * @param [selector] */ parents(component: ComponentClass): ReactWrapper; parents(statelessComponent: StatelessComponent): ReactWrapper; @@ -562,7 +524,6 @@ export interface ReactWrapper

extends CommonWrapper { * ancestors in the tree, starting with itself. * * Note: can only be called on a wrapper of a single node. - * @param selector */ closest(component: ComponentClass): ReactWrapper; closest(statelessComponent: StatelessComponent): ReactWrapper; @@ -583,8 +544,6 @@ export interface ReactWrapper

extends CommonWrapper { * Returns itself. * * NOTE: can only be called on a wrapper instance that is also the root instance. - * @param props - * @param [callback] */ setProps(props: Pick, callback?: () => void): this; } @@ -618,24 +577,18 @@ export interface MountRendererProps { /** * Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that * your tests aren't indirectly asserting on behavior of child components. - * @param node - * @param [options] */ export function shallow

(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; export function shallow(node: ReactElement

, options?: ShallowRendererProps): ShallowWrapper; /** * Mounts and renders a react component into the document and provides a testing wrapper around it. - * @param node - * @param [options] */ export function mount

(node: ReactElement

, options?: MountRendererProps): ReactWrapper; export function mount(node: ReactElement

, options?: MountRendererProps): ReactWrapper; /** * Render react components to static HTML and analyze the resulting HTML structure. - * @param node - * @param [options] */ export function render(node: ReactElement

, options?: any): Cheerio; @@ -646,6 +599,5 @@ export class EnzymeAdapter { /** * Configure enzyme to use the correct adapter for the react verstion * This is enabling the Enzyme configuration with adapters in TS - * @param options */ export function configure(options: { adapter: EnzymeAdapter }): void;