Skip to content

Instantly share code, notes, and snippets.

@louh
Created April 20, 2016 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save louh/0b2e74228c141afc4a34b70d3e944254 to your computer and use it in GitHub Desktop.
Save louh/0b2e74228c141afc4a34b70d3e944254 to your computer and use it in GitHub Desktop.
jscs 3.0.x bug, see issue 2219
.node_modules/.bin/jscs test1.js

Result:

TypeError: Cannot read property 'replace' of undefined
    at renderLine (/Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/errors.js:266:16)
    at Object.Errors.explainError (/Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/errors.js:197:13)
    at /Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/reporters/console.js:16:36
    at Array.forEach (native)
    at /Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/reporters/console.js:14:35
    at Array.forEach (native)
    at Object.module.exports [as writer] (/Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/reporters/console.js:9:22)
    at /Users/lou/Repositories/louh/jscs-test/node_modules/jscs/lib/cli.js:149:18
    at Array.<anonymous> (/Users/lou/Repositories/louh/jscs-test/node_modules/jscs/node_modules/vow/lib/vow.js:712:56)
    at Immediate.callFns [as _onImmediate] (/Users/lou/Repositories/louh/jscs-test/node_modules/jscs/node_modules/vow/lib/vow.js:23:35)

.node_modules/.bin/jscs test2.js

This is okay has no output.

// This causes jscs to exit with an error
export function myFunction ({ foo = false, bar = null } = {}) {
console.log(foo, bar);
}
// This is okay
export function myFunction (foo = false, bar = null) {
console.log(foo, bar);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment