question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extend no-multi-spaces with allow alignment option

See original GitHub issue

Is it possible to have a rule to allow alignment of = (which introduces multi spaces) without having to turn off no-multi-spaces?

The following would be considered a warning:

var a   = 1;

var a    = 1;
var bar = 1;

The following would not:

var a   = 1;
var bar = 1;

Currently no-multi-space complains about what ESLint calls good coding conventions:

// Good
var count   = 10,
    name    = "Nicholas",
    found   = false,
    empty;

I agree that this is good, but turning off no-multi-spaces completely is a blunt instrument that would hide warnings you want.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:23 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
akre54commented, Apr 26, 2016

What about for aligning literals in function calls?

foo('one',   'two',   'three')
foo('four',  'five',  'six')
foo('seven', 'eight', 'nine')

I think there has to be a smarter option than just ignoring a whole class of node for this type of alignment. Shouldn’t it be possible to compare the start prop of the AST?

1reaction
btmillscommented, Jan 4, 2017

Try astexplorer.net to inspect the syntax tree from a number of popular parsers. @alexilyaev in your case with babel-eslint, it looks like you want ClassProperty.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-multi-spaces - ESLint - Pluggable JavaScript Linter
Options. This rule's configuration consists of an object with the following properties: "ignoreEOLComments": true (defaults to false ) ignores multiple ...
Read more >
eslintrc.json no-multi-spaces value assignment equal sign ...
You want to use the VariableDeclarator option, as explained in the documentation: https://eslint.org/docs/rules/indent#variabledeclarator.
Read more >
Adjust indents and spacing
Choose Justify to align text both left and right, adding space between words (Ctrl+J). Outline level. The level at which the paragraph appears...
Read more >
Align and distribute layers in Adobe Photoshop
Choose Edit > Auto-Align Layers, and choose an alignment option. For stitching together multiple images that share overlapping areas—for example ...
Read more >
CSS Box Alignment - CSS: Cascading Style Sheets | MDN
There needs to be space available in the dimension you wish to align the items in, in order for these keywords to take...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found