jscs-dev / babel-jscs

(deprecated) JSCS has merged with ESLint, so check out babel-eslint!
https://github.com/babel/babel-eslint
MIT License
27 stars 6 forks source link

parseError: undefined on function declaraion #6

Closed okonet closed 9 years ago

okonet commented 9 years ago

For this source file:

var a = 1;
function() {} // will fail
function () {} // will fail

I'm getting following parseError:

./node_modules/.bin/jscs ./babel-jscs-sample.js                   2 ↵
parseError: undefined at ./babel-jscs-sample.js :
     1 |var a = 1;
     2 |function() {} // will fail
----------------^
     3 |function () {} // will fail
     4 |

1 code style error found.
mdevils commented 9 years ago

Hello @okonet, you are getting parse error because your JavaScript code contains syntax error. Run this code in Chrome/Firefox, for instance. Function expressions cannot be used as function declarations.

okonet commented 9 years ago

Yes, I've just realized my example is a faulty one. Sorry for inconvenience.