From 5308be3ba636b04e65c64b3d5fed9aa6b90b5320 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 17 Sep 2023 11:28:57 -0700 Subject: [PATCH] wip: code formatting nits continued --- src/debounce.ts | 9 ++++++--- test/conforms-methods.spec.js | 4 ++-- test/flatMapDepth.spec.js | 6 +++--- test/omit.spec.js | 6 +++--- test/overEvery.spec.js | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/debounce.ts b/src/debounce.ts index a985d76fa..83004215f 100644 --- a/src/debounce.ts +++ b/src/debounce.ts @@ -98,17 +98,19 @@ function debounce(func, wait, options) { return result; } - function startTimer(pendingFunc, wait) { + function startTimer(pendingFunc, milliseconds) { if (useRAF) { root.cancelAnimationFrame(timerId); return root.requestAnimationFrame(pendingFunc); } - return setTimeout(pendingFunc, wait); + // eslint-disable-next-line @typescript-eslint/no-implied-eval + return setTimeout(pendingFunc, milliseconds); } function cancelTimer(id) { if (useRAF) { - return root.cancelAnimationFrame(id); + root.cancelAnimationFrame(id); + return; } clearTimeout(id); } @@ -152,6 +154,7 @@ function debounce(func, wait, options) { } // Restart the timer. timerId = startTimer(timerExpired, remainingWait(time)); + return undefined; } function trailingEdge(time) { diff --git a/test/conforms-methods.spec.js b/test/conforms-methods.spec.js index 6e288db33..4826bd2c7 100644 --- a/test/conforms-methods.spec.js +++ b/test/conforms-methods.spec.js @@ -28,7 +28,7 @@ describe('conforms methods', () => { }); let actual = lodashStable.filter(objects, par); - expect(actual, [objects[0]).toEqual(objects[2]]); + expect(actual).toEqual([objects[0], objects[2]]); par = conforms({ b: function (value) { @@ -62,7 +62,7 @@ describe('conforms methods', () => { const par = conforms(new Foo()); const actual = lodashStable.filter(objects, par); - expect(actual, [objects[1]).toEqual(objects[2]]); + expect(actual).toEqual([objects[1], objects[2]]); }); it(`\`_.${methodName}\` should not invoke \`source\` predicates for missing \`object\` properties`, () => { diff --git a/test/flatMapDepth.spec.js b/test/flatMapDepth.spec.js index 64aa5acbe..244acd3a4 100644 --- a/test/flatMapDepth.spec.js +++ b/test/flatMapDepth.spec.js @@ -6,7 +6,7 @@ describe('flatMapDepth', () => { const array = [1, [2, [3, [4]], 5]]; it('should use a default `depth` of `1`', () => { - expect(flatMapDepth(array, identity), [1, 2, [3, [4]]).toEqual(5]); + expect(flatMapDepth(array, identity)).toEqual([1, 2, [3, [4]], 5]); }); it('should use `_.identity` when `iteratee` is nullish', () => { @@ -22,11 +22,11 @@ describe('flatMapDepth', () => { it('should treat a `depth` of < `1` as a shallow clone', () => { lodashStable.each([-1, 0], (depth) => { - expect(flatMapDepth(array, identity, depth), [1, [2, [3, [4]]).toEqual(5]]); + expect(flatMapDepth(array, identity, depth)).toEqual([1, [2, [3, [4]], 5]]); }); }); it('should coerce `depth` to an integer', () => { - expect(flatMapDepth(array, identity, 2.2), [1, 2, 3, [4]).toEqual(5]); + expect(flatMapDepth(array, identity, 2.2)).toEqual([1, 2, 3, [4], 5]); }); }); diff --git a/test/omit.spec.js b/test/omit.spec.js index 4dd2a8056..7a1b10067 100644 --- a/test/omit.spec.js +++ b/test/omit.spec.js @@ -8,12 +8,12 @@ describe('omit', () => { const nested = { a: 1, b: { c: 2, d: 3 } }; it('should flatten `paths`', () => { - expect(omit(object, 'a', 'c'), { b: 2).toEqual(d: 4 }); + expect(omit(object, 'a', 'c')).toEqual({ b: 2, d: 4 }); expect(omit(object, ['a', 'd'], 'c')).toEqual({ b: 2 }); }); it('should support deep paths', () => { - expect(omit(nested, 'b.c'), { a: 1).toEqual(b: { d: 3 } }); + expect(omit(nested, 'b.c')).toEqual({ a: 1, b: { d: 3 } }); }); it('should support path arrays', () => { @@ -55,7 +55,7 @@ describe('omit', () => { }); it('should work with `arguments` object `paths`', () => { - expect(omit(object, args), { b: 2).toEqual(d: 4 }); + expect(omit(object, args)).toEqual({ b: 2, d: 4 }); }); it('should not mutate `object`', () => { diff --git a/test/overEvery.spec.js b/test/overEvery.spec.js index 9210e6466..b611fe8bb 100644 --- a/test/overEvery.spec.js +++ b/test/overEvery.spec.js @@ -80,7 +80,7 @@ describe('overEvery', () => { }); over('a', 'b', 'c'); - expect(args, ['a', 'b').toEqual('c']); + expect(args).toEqual(['a', 'b', 'c']); }); it('should use `this` binding of function for `predicates`', () => {