Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing fs.existsSync #32

Open
init-js opened this issue Oct 16, 2014 · 1 comment
Open

Missing fs.existsSync #32

init-js opened this issue Oct 16, 2014 · 1 comment

Comments

@init-js
Copy link

init-js commented Oct 16, 2014

Running on a relatively old node instance (0.6.12), I am missing fs.existsSync

/home/foo/src/jshint-mode/jshint-mode.js:69
  return filePath && fs.existsSync(filePath) ?
                        ^
TypeError: Object #<Object> has no method 'existsSync'
    at _loadAndParseConfig (/home/foo/src/jshint-mode/jshint-mode.js:69:25)
    at _getConfig (/home/foo/src/jshint-mode/jshint-mode.js:77:31)
    at /home/foo/src/jshint-mode/jshint-mode.js:93:20
    at IncomingForm.<anonymous> (/home/foo/src/jshint-mode/node_modules/formidable/lib/incoming_form.js:118:9)
    at IncomingForm.emit (events.js:67:17)
    at IncomingForm._error (/home/foo/src/jshint-mode/node_modules/formidable/lib/incoming_form.js:248:8)
    at IncomingMessage.<anonymous> (/home/foo/src/jshint-mode/node_modules/formidable/lib/incoming_form.js:104:14)
    at IncomingMessage.emit (events.js:64:17)
    at HTTPParser.onMessageComplete (http.js:137:23)
    at Socket.ondata (http.js:1410:22)
@init-js
Copy link
Author

init-js commented Oct 16, 2014

Quick patch for it.

diff --git a/jshint-mode.js b/jshint-mode.js
index b8c4bba..22025c8 100644
--- a/jshint-mode.js
+++ b/jshint-mode.js
@@ -14,6 +14,10 @@ var http = require('http'),
     JSLINT = require('./jslint'),
     JSHINT = require('./jshint');

+if (!fs.existsSync) {
+    fs.existsSync = require('path').existsSync;
+}
+
 var hinters = {
   jshint: JSHINT.JSHINT,
   jslint: JSLINT.JSLINT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant