Comments (3)
You still would need to update to the latest atom-jscs version
from node-jscs.
Need a code example and jscs version
from node-jscs.
I am using https://atom.io/packages/linter-jscs v4.0.4
import {
createStore,
combineReducers,
applyMiddleware,
} from 'redux';
function createReduxStore(options) {
const {
reducers = {},
middlewares = [],
} = options;
if (!createStore || !combineReducers || !applyMiddleware) {
const error = 'Redux is missing. Please install Redux, npm install --save redux';
throw new Error(error);
}
if (Object.keys(reducers).length > 0) {
const combinedReducers = combineReducers(reducers);
const Store = createStore(
combinedReducers,
applyMiddleware(...middlewares)
);
return Store;
}
return null;
}
function reduxMiddleware(options) {
const {
reducers = {},
middlewares = [],
storeName = 'Store',
} = options;
return {
moduleWillLoad(module) {
if (module.reducers) {
if (typeof reducers !== 'object' || typeof module.reducers !== 'object') {
const message = "Module's reducers field should be a map of reducers.";
throw new Error(message);
}
const allReducers = {
...module.reducers,
...reducers,
};
this._reduxReducers = allReducers;
}
},
moduleWillInit() {
let allReducers = this._reduxReducers;
let allMiddlewares = [...middlewares];
if (this._apolloReducer) {
allReducers = {
...allReducers,
apollo: this._apolloReducer,
};
}
if (this._apolloMiddleware) {
allMiddlewares = [
...allMiddlewares,
this._apolloMiddleware,
];
}
const reduxStore = createReduxStore({
reducers: allReducers,
middlewares: allMiddlewares,
});
this.context[storeName] = reduxStore;
this.context.dispatch = reduxStore.dispatch;
},
};
}
export default reduxMiddleware;
from node-jscs.
Related Issues (20)
- jscs exlucdeFiles not Work! HOT 1
- Should have exception for disallowSpacesInFunction for anonymous generators HOT 1
- not possible to include extensions with multiple "." characters HOT 7
- Error running rule requirePaddingNewLinesBeforeLineComments HOT 1
- not possible to ignore '.js' files with fileExtensions #2273
- Destructuring with default values in parameters throws an error. HOT 1
- Cannot find module 'babel-runtime/core-js/object/keys' HOT 8
- Error: Symbol is not defined (first character of file) HOT 3
- Add `templateStrings` as an option for the `allExcept` property of the `maximumLineLength` rule HOT 2
- requireSpaceBeforeDestructuredValues does not work in vanilla JS HOT 3
- maximumLineLength should optionally allow string literals to break the rule HOT 2
- validateIndentation should enforce endbrace at the same indentation as the line containing it's corresponding startbrace HOT 2
- JSCS goes into infinite loop HOT 2
- About jsx curly braces variable HOT 1
- JSCS crashes due to decorators HOT 1
- requireSpaceBetweenArguments doesn't work in constructor of es6. HOT 4
- How to write a rule which makes "case" align to "switch" in switch statement? HOT 1
- jscs.info offline HOT 3
- Disabling Specific Rules For a Single Line not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-jscs.