Fix lodash imports and linting

This commit is contained in:
Dan Abramov 2016-02-02 17:59:55 +00:00
parent 778803eb97
commit ccb3f2f070
4 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import {difference} from 'lodash/array'; import difference from 'lodash/difference';
export const ActionTypes = { export const ActionTypes = {
PERFORM_ACTION: 'PERFORM_ACTION', PERFORM_ACTION: 'PERFORM_ACTION',
@ -344,7 +344,7 @@ export default function instrument(monitorReducer = () => null) {
function liftReducer(r) { function liftReducer(r) {
if (typeof r !== 'function') { if (typeof r !== 'function') {
if (r && typeof r['default'] === 'function') { if (r && typeof r.default === 'function') {
throw new Error( throw new Error(
'Expected the reducer to be a function. ' + 'Expected the reducer to be a function. ' +
'Instead got an object with a "default" field. ' + 'Instead got an object with a "default" field. ' +

View File

@ -1,5 +1,5 @@
import {mapValues} from 'lodash/object'; import mapValues from 'lodash/mapValues';
import {identity} from 'lodash/utility'; import identity from 'lodash/identity';
export default function persistState(sessionId, deserializeState = identity, deserializeAction = identity) { export default function persistState(sessionId, deserializeState = identity, deserializeAction = identity) {
if (!sessionId) { if (!sessionId) {

View File

@ -339,7 +339,7 @@ describe('instrument', () => {
it('warns if the reducer is not a function but has a default field that is', () => { it('warns if the reducer is not a function but has a default field that is', () => {
expect(() => expect(() =>
createStore(({ default: () => {} }), instrument()) createStore(({ 'default': () => {} }), instrument())
).toThrow( ).toThrow(
'Expected the reducer to be a function. ' + 'Expected the reducer to be a function. ' +
'Instead got an object with a "default" field. ' + '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', () => { it('throws if there are more than one instrument enhancer included', () => {
expect(() => { expect(() => {
createStore(counter, compose(instrument(), instrument())) createStore(counter, compose(instrument(), instrument()));
}).toThrow( }).toThrow(
'DevTools instrumentation should not be applied more than once. ' + 'DevTools instrumentation should not be applied more than once. ' +
'Check your store configuration.' 'Check your store configuration.'

View File

@ -91,7 +91,7 @@ describe('persistState', () => {
it('should warn if read from localStorage fails', () => { it('should warn if read from localStorage fails', () => {
const spy = expect.spyOn(console, 'warn'); const spy = expect.spyOn(console, 'warn');
delete global.localStorage.getItem; delete global.localStorage.getItem;
const store = createStore(reducer, compose(instrument(), persistState('id'))); createStore(reducer, compose(instrument(), persistState('id')));
expect(spy.calls).toContain( expect(spy.calls).toContain(
/Could not read debug session from localStorage/, /Could not read debug session from localStorage/,