From ccb3f2f07040561b8ae4b307767f745be3b9cc96 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Tue, 2 Feb 2016 17:59:55 +0000 Subject: [PATCH] Fix lodash imports and linting --- src/instrument.js | 4 ++-- src/persistState.js | 4 ++-- test/instrument.spec.js | 4 ++-- test/persistState.spec.js | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/instrument.js b/src/instrument.js index 3d8f924e..7195979a 100644 --- a/src/instrument.js +++ b/src/instrument.js @@ -1,4 +1,4 @@ -import {difference} from 'lodash/array'; +import difference from 'lodash/difference'; export const ActionTypes = { PERFORM_ACTION: 'PERFORM_ACTION', @@ -344,7 +344,7 @@ export default function instrument(monitorReducer = () => null) { function liftReducer(r) { if (typeof r !== 'function') { - if (r && typeof r['default'] === 'function') { + if (r && typeof r.default === 'function') { throw new Error( 'Expected the reducer to be a function. ' + 'Instead got an object with a "default" field. ' + diff --git a/src/persistState.js b/src/persistState.js index 95a5b397..af7f6ac4 100644 --- a/src/persistState.js +++ b/src/persistState.js @@ -1,5 +1,5 @@ -import {mapValues} from 'lodash/object'; -import {identity} from 'lodash/utility'; +import mapValues from 'lodash/mapValues'; +import identity from 'lodash/identity'; export default function persistState(sessionId, deserializeState = identity, deserializeAction = identity) { if (!sessionId) { diff --git a/test/instrument.spec.js b/test/instrument.spec.js index 72cebdf6..c8abc4af 100644 --- a/test/instrument.spec.js +++ b/test/instrument.spec.js @@ -339,7 +339,7 @@ describe('instrument', () => { it('warns if the reducer is not a function but has a default field that is', () => { expect(() => - createStore(({ default: () => {} }), instrument()) + createStore(({ 'default': () => {} }), instrument()) ).toThrow( 'Expected the reducer to be a function. ' + 'Instead got an object with a "default" field. ' + @@ -350,7 +350,7 @@ describe('instrument', () => { it('throws if there are more than one instrument enhancer included', () => { expect(() => { - createStore(counter, compose(instrument(), instrument())) + createStore(counter, compose(instrument(), instrument())); }).toThrow( 'DevTools instrumentation should not be applied more than once. ' + 'Check your store configuration.' diff --git a/test/persistState.spec.js b/test/persistState.spec.js index 90bf4c60..763b6da7 100644 --- a/test/persistState.spec.js +++ b/test/persistState.spec.js @@ -91,7 +91,7 @@ describe('persistState', () => { it('should warn if read from localStorage fails', () => { const spy = expect.spyOn(console, 'warn'); delete global.localStorage.getItem; - const store = createStore(reducer, compose(instrument(), persistState('id'))); + createStore(reducer, compose(instrument(), persistState('id'))); expect(spy.calls).toContain( /Could not read debug session from localStorage/,