Error running rule requireDollarBeforejQueryAssignment
purplecones opened this issue · 3 comments
purplecones commented
I keep getting this message on line 1 of the file. I use Atom 1.8.0.
<linter-message-line><span class="badge badge-flexible">internalError</span> Error running rule requireDollarBeforejQueryAssignment: This is an issue with JSCS and not your codebase.
Please file an issue (with the stack trace below) at: https://github.com/jscs-dev/node-jscs/issues/new
TypeError: Cannot read property 'name' of undefined
at /Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/rules/require-dollar-before-jquery-assignment.js:142:30
at Array.forEach (native)
at Object.<anonymous> (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/rules/require-dollar-before-jquery-assignment.js:139:23)
at Array.forEach (native)
at Object.JsFile.iterateNodesByType (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/js-file.js:331:42)
at Object.module.exports.check (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/rules/require-dollar-before-jquery-assignment.js:72:14)
at [object Object].<anonymous> (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/string-checker.js:189:22)
at Array.forEach (native)
at [object Object].StringChecker._checkJsFile (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/string-checker.js:185:31)
at [object Object].StringChecker.checkString (/Users/mirzajoldic/.atom/packages/linter-jscs/node_modules/jscs/lib/string-checker.js:92:14)
at Object.lint (/Users/mirzajoldic/.atom/packages/linter-jscs/src/linter-jscs.js:207:14)
at promises.push.Promise.then._this.emitter.emit.linter (/Users/mirzajoldic/.atom/packages/linter/lib/linter-registry.js:63:26)
at /Users/mirzajoldic/.atom/packages/linter/lib/linter-registry.js:62:23
at Set.forEach (native)
at LinterRegistry.lint (/Users/mirzajoldic/.atom/packages/linter/lib/linter-registry.js:60:18)
at /Users/mirzajoldic/.atom/packages/linter/lib/linter.coffee:98:16
at Function.module.exports.Emitter.simpleDispatch (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:25:14)
at Emitter.module.exports.Emitter.emit (/Applications/Atom.app/Contents/Resources/app.asar/node_modules/event-kit/lib/emitter.js:125:28)
at /Users/mirzajoldic/.atom/packages/linter/lib/editor-linter.js:86:22
at /Users/mirzajoldic/.atom/packages/linter/lib/helpers.coffee:25:18</anonymous></anonymous></linter-message-line>
markelog commented
Need a code example and jscs version
purplecones commented
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;
markelog commented
You still would need to update to the latest atom-jscs version