internalError running disallowUnusedParams
dmartinezg opened this issue · 2 comments
dmartinezg commented
We get this error when upgrading jscs from ~2.11.0
to ~3.0.3
.
We are running on Mac, but it fails in travis (which I guess is some flavour of linux)
internalError: Error running rule disallowUnusedParams: 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 'forEach' of undefined
at Object.<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/rules/disallow-unused-params.js:176:32)
at Array.forEach (native)
at Object.JsFile.iterateNodesByType (/Users/damian/projects/repository-service/node_modules/jscs/lib/js-file.js:331:42)
at Object.module.exports.check (/Users/damian/projects/repository-service/node_modules/jscs/lib/rules/disallow-unused-params.js:152:14)
at [object Object].<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:154:22)
at Array.forEach (native)
at [object Object].StringChecker._checkJsFile (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:150:31)
at [object Object].StringChecker.checkString (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:92:14)
at [object Object].<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/checker.js:56:21)
at Array.<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/node_modules/vow/lib/vow.js:712:39) at src/repositories/assetRepository.js :
1 |let _ = require('lodash');
--------^
2 |let flat = require('flat');
3 |let uuid = require('uuid');
And apparently jscs, has a thing for that file, because if I comment out those first three lines I get:
internalError: Error running rule disallowUnusedParams: 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 'forEach' of undefined
at Object.<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/rules/disallow-unused-params.js:179:32)
at Array.forEach (native)
at Object.JsFile.iterateNodesByType (/Users/damian/projects/repository-service/node_modules/jscs/lib/js-file.js:331:42)
at Object.module.exports.check (/Users/damian/projects/repository-service/node_modules/jscs/lib/rules/disallow-unused-params.js:152:14)
at [object Object].<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:154:22)
at Array.forEach (native)
at [object Object].StringChecker._checkJsFile (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:150:31)
at [object Object].StringChecker.checkString (/Users/damian/projects/repository-service/node_modules/jscs/lib/string-checker.js:92:14)
at [object Object].<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/lib/checker.js:56:21)
at Array.<anonymous> (/Users/damian/projects/repository-service/node_modules/jscs/node_modules/vow/lib/vow.js:712:39) at src/repositories/assetRepository.js :
1 |//let _ = require('lodash');
--------^
2 |//let flat = require('flat');
3 |//let uuid = require('uuid');
markelog commented
Code example?
dmartinezg commented
Hi @markelog, I thought the stack trace was enough, I apologize for that.
This code seems to break it (apparently the default parameter value is the problem):
let _ = require('lodash');
module.exports = function assetRepository() {
function get(context, where, options = {}) {
}
};
Thanks for looking into this