-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Porting eslint's stdin logic to eslint_d #15
Conversation
@@ -31,7 +31,16 @@ if (cmd === 'start') { | |||
} else { | |||
var commands = ['stop', 'status', 'restart']; | |||
if (commands.indexOf(cmd) === -1) { | |||
client.lint(process.argv.slice(2)); | |||
var concat = require('concat-stream'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the reason why I'm putting require statements into conditionals in this project (and in this project only), is because that is what makes eslint slow and I want to add as little overhead as possible. In this case, you could move it into the if (stdin)
block or, even better, don't use a dependency at all ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Re: Using concat-stream, eslint uses the same dependency, so technically it's not any slower than eslint. It handles a lot of use cases, and if I'm honest, I'm not comfortable enough with streams to attempt to do it myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The background is this: The only reason why eslint_d
is any faster than eslint
is because it's loading all the dependencies in the server process. This code here is executed on the client process which should be as lightweight as possible. Therefore, I might try to remove the dependency in the future again, but for now it's better to have this feature implemented than squeezing the last 5 milliseconds out of it 😉
Fantastic! 👍 Just a little tiny micro optimization would be rad, as I commented inline. |
Porting eslint's stdin logic to eslint_d
Released in |
Allows IDEs to pass in code via stdin. Fixes #13.