I want to implement code formatting like this but don't know how to do this or how this is achieved.

var inherits     = require('inherits'),
    stream       = require('stream'),
    Stream       = stream.Stream ,
    events       = require('events'),
    _            = require('underscore')._,
    Connection   = require('../connection'),
    RecordStream = require('../record-stream'),
    CSV          = require('../csv'),
    Promise      = require('../promise');

As you can see ,there is equal spacing between left and right side of assignments

is there any lint/formatter tools that does this? I am currently using sublime text.

Thanks in advance

  • this doesn't answer your question, but are you sure that'd be called javascript? I think those require lines look like nodejs but I think what you've written are parts of nodejs and parts that are unique to nodejs and won't work in regular/actual javascript. – barlop Feb 10 '16 at 11:50
  • 1
    and perhaps a slightly daft question, but what's wrong with the tab key for what you want to do? – barlop Feb 10 '16 at 11:51
  • thanks @barlop for replying, yes the above is nodejs, however I was looking for a tool similar to jsbeautifier that does this type of formatting, that's all. – Mozak Mar 7 '16 at 8:26

Finally I got a utility that does it, however not yet in sublime but in vscode.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.