yarn precommmit
не работает {
"scripts": {
"start": "cross-env NODE_ENV=development nodemon --inspect server --ignore client/ --exec babel-node",
"precommit": "lint-staged",
"prepush": "yarn test"
},
"lint-staged": {
"*.{js,jsx}": [
"prettier --write",
"eslint --fix",
"git add"
],
"*.{css,scss}": [
"stylelint --fix",
"git add"
]
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^22.1.0",
"babel-loader": "^7.1.2",
"babel-plugin-react-css-modules": "^3.3.0",
"babel-plugin-react-remove-properties": "^0.2.5",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.23.0",
"babel-preset-react-hmre": "^1.1.1",
"babel-preset-stage-1": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"cssnano": "^3.10.0",
"eslint": "^4.16.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.4",
"eslint-plugin-codeceptjs": "^0.3.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.5.1",
"eslint-watch": "^3.0.1",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.4",
"html-webpack-plugin": "^2.30.1",
"husky": "^0.14.3",
"identity-obj-proxy": "^3.0.0",
"jest": "^22.1.4",
"lint-staged": "^6.0.1",
"nock": "^9.1.6",
"node-sass": "^4.7.2",
"nodemon": "^1.11.0",
"np": "^2.16.0",
"npm": "^5.4.2",
"postcss-loader": "^2.0.6",
"postcss-nested": "^2.1.2",
"postcss-scss": "^1.0.2",
"redux-mock-store": "^1.3.0",
"sass-loader": "^6.0.3",
"style-loader": "^0.18.2",
"stylelint": "^8.4.0",
"stylelint-config-standard": "^18.0.0",
"stylelint-order": "^0.8.0",
"stylelint-scss": "^2.2.0",
"url-loader": "^0.5.9",
"webpack": "^3.6.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-middleware": "^1.12.0",
"webpack-hot-middleware": "^2.19.1"
}
}
export const getIsLoadedSelector = ({ reducer }) => reducer.delete.isLoaded;
Моя ошибка, невнимательность. Написал полную бурду.
const todosReducer = createAsyncReducer([
"TODOS_REQUEST",
"TODOS_SUCCESS",
"TODOS_FAILURE"
]);
const todosReducer2 = createAsyncReducer([
"TODOS_REQUEST2",
"TODOS_SUCCESS2",
"TODOS_FAILURE2"
]);
const withAddTodo = reducer => (state, action) => {
const nextState = reducer(state, action);
switch (action.type) {
case "ADD_TODO":
return {
...nextState,
data: [...nextState.data, action.payload]
};
default:
return nextState;
}
};
const customReducer = withAddTodo(todosReducer);
// надо в customReducer записать todosReducer2
const createAsyncReducer (state, action) => {
switch (action.type) {
case "USER_REQUEST":
return {
...state,
edit: {
...state.edit,
isFetching: true,
}
}
case "USER_SUCCESS":
return {
...state,
edit: {
...state.edit,
isFetching: false,
data: action.payload,
error: void 0,
}
}
case "USER_FAILURE":
return {
...state,
edit: {
...state.edit,
isFetching: false,
error: action.payload
}
}
case "USER_SOME_ACTION":
return {
...state,
edit: {
...state.edit,
isFetching: false,
error: action.payload.some
}
}
case "USER_REQUEST2":
return {
...state,
delete: {
...state.delete,
isFetching: true,
}
}
case "USER_SUCCESS2":
return {
...state,
delete: {
...state.delete,
isFetching: false,
data: action.payload,
error: void 0,
}
}
case "USER_FAILURE2":
return {
...state,
delete: {
...state.delete,
isFetching: false,
error: action.payload
}
}
case "USER_SOME_ACTION2":
return {
...state,
delete: {
...state.delete,
isFetching: false,
error: action.payload.some
}
}
default: return state;
}
}
delete: {
...state.delete,
isFetching: false,
error: action.payload.some
}