Skip to content

Instantly share code, notes, and snippets.

@mattcollier
Created February 20, 2018 17:30
Show Gist options
  • Save mattcollier/1271484a58d5fdc623a3374242c4de30 to your computer and use it in GitHub Desktop.
Save mattcollier/1271484a58d5fdc623a3374242c4de30 to your computer and use it in GitHub Desktop.
{
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6
}
}
// no error detected on line 9/10
function y(callback) {
setTimeout(() => callback(), 0);
}
function x(a, callback) {
console.log('STEP 1', a);
y(() => {
console.log('STEP 2', a);
const {a} = () => ({a: 5});
callback(null, a);
});
}
x(4, (err, result) => {
console.log('ERROR', err);
console.log('RESULT', result);
});
// properly reports Parsing error: Identifier 'a' has already been declared on line 3
function x(a, callback) {
console.log('STEP 1', a);
const {a} = () => ({a: 5});
callback(null, a);
}
x(4, (err, result) => {
console.log('ERROR', err);
console.log('RESULT', result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment