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

Allow multiple spaces before `=` in variable declarations with standard config #312

Closed
nmai opened this issue Oct 30, 2015 · 5 comments

Comments

@nmai
Copy link

commented Oct 30, 2015

I like to match my = assignment operators when declaring multiple variables at once, like so:

var from    = data.from
var to      = data.to
var subject = data.subject
var cc      = data.cc
var body    = data.envelopeFrom.text

This is the Standard style version:

var from = data.from
var to = data.to
var subject = data.subject
var cc = data.cc
var body = data.envelopeFrom.text

Is there a way we can allow for this type of behavior without disabling the no-multi-spaces rule?

@feross

This comment has been minimized.

Copy link
Member

commented Oct 30, 2015

Please see: https://github.com/feross/standard#i-disagree-with-rule-x-can-you-change-it

If you feel really strongly about aligning your = signs, you can use ESLint directly and extend eslint-config-standard to override this rule.

@feross feross closed this Oct 30, 2015

@nmai

This comment has been minimized.

Copy link
Author

commented Oct 30, 2015

Fair enough, just thought I'd ask.

@arminrosu

This comment has been minimized.

Copy link

commented May 22, 2016

@feross could you elaborate on the reason for this rule, why did you set it like that? e.g. "it is simpler & faster to lint".

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented May 22, 2016

From the FAQ:

At the end of the day you have to 'just pick something', and that's the whole philosophy of standard -- its a bunch of sensible 'just pick something' opinions.

Please refrain from reviving old issues like this - it's not particularly appreciated by maintainers. I hope this answers your question though! If you have any other questions you're welcome to open a fresh issue. Cheers!

@standard standard locked and limited conversation to collaborators May 22, 2016

@feross

This comment has been minimized.

Copy link
Member

commented May 23, 2016

Some practical reasons for not aligning equals signs are:

  • aligning equals signs takes time
  • doesn't improve program correctness
  • it's a lot of work to do by hand without the help of an IDE or text editor plugin
  • if you add a longer variable name to the list, then every single item needs to be realigned, creating more work
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.