appfolio / eslint-rails

MIT License
39 stars 22 forks source link

rake eslint:run_all or rake eslint:run[filename] not working #35

Open ganeshkumar opened 7 years ago

ganeshkumar commented 7 years ago

Please note that i am using node version 0.12.4

filename: is the exact file path of js file.

when i run rake eslint:run_all/ rake eslint:run[filename] below error is throwing up

ExecJS::ProgramError: TypeError: Cannot read property 'firebug' of undefined Function.useColors (eval at <anonymous> ((execjs):1:266), <anonymous>:13435:75) createDebug (eval at <anonymous> ((execjs):1:266), <anonymous>:13688:29) Object.debug (eval at <anonymous> ((execjs):1:266), <anonymous>:49889:29) s (eval at <anonymous> ((execjs):1:266), <anonymous>:12502:620) eval (eval at <anonymous> ((execjs):1:266), <anonymous>:12502:671) Object../debug-helpers (eval at <anonymous> ((execjs):1:266), <anonymous>:47845:13) s (eval at <anonymous> ((execjs):1:266), <anonymous>:12502:620) eval (eval at <anonymous> ((execjs):1:266), <anonymous>:12502:671) Object../code-path-segment (eval at <anonymous> ((execjs):1:266), <anonymous>:48117:23) s (eval at <anonymous> ((execjs):1:266), <anonymous>:12502:620) Tasks: TOP => eslint:run_all

Please let me know anything is wrong? trying with latest version 1.3.0 and 1.2.2 getting same error.

but 1.2.1 works only for js files not es6 files.

joaumg commented 6 years ago

OK, found where and how to fix this one...

First thought of mine was to pass another runtime to ExecJS...

EXECJS_RUNTIME='Node' rake eslint:run_all

Which didn't work since the runtime is hard coded...

https://github.com/appfolio/eslint-rails/blob/97c5b53311e729397916cd703ee74a5acdb12ce4/lib/tasks/eslint.rake#L1

So, the solution is to add gem "therubyracer" to your Gemfile, run bundle install, and you're done.

What is weird is that therubyracer is a dev dependency and not a common dependency...

https://github.com/appfolio/eslint-rails/blob/master/eslint-rails.gemspec#L29

Maybe a pull request to fix that would be accepted?