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

Porting eslint's stdin logic to eslint_d #15

Merged
merged 2 commits into from
Nov 8, 2015

Conversation

doctyper
Copy link
Contributor

@doctyper doctyper commented Nov 8, 2015

Allows IDEs to pass in code via stdin. Fixes #13.

doctyper added a commit to doctyper/SublimeLinter-contrib-eslint_d that referenced this pull request Nov 8, 2015
@@ -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');
Copy link
Owner

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 ;-)

Copy link
Contributor Author

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.

Copy link
Owner

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 😉

@mantoni
Copy link
Owner

mantoni commented Nov 8, 2015

Fantastic! 👍 Just a little tiny micro optimization would be rad, as I commented inline.

mantoni added a commit that referenced this pull request Nov 8, 2015
Porting eslint's stdin logic to eslint_d
@mantoni mantoni merged commit b387adb into mantoni:master Nov 8, 2015
@mantoni
Copy link
Owner

mantoni commented Nov 8, 2015

Released in v2.3.0. Happy linting! 🎉

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

Successfully merging this pull request may close these issues.

2 participants