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.

daisy-chain indentation leads to over-indentation

See original GitHub issue

Using this via https://github.com/enginespot/js-beautify-sublime

Expected:

object
.foo()
.bar();

Actual:

object
  .foo()
  .bar();

To illustrate the problem: the current indenting can lead to EOFs like this:

      });
    });
})();

That looks like an error to me, and will prompt me to look for the cause – or worse, make me blind to the real ones =(

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:10
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
arthur5005commented, May 8, 2015

I have to +1 this request, this is especially handy when working with Promises.

Promise.resolve()
.then(function() {
  return foo.bar()
})
.then(function() {
  return foo.baz();
})
.then(function() {
 //...
}) //...
//...

This chaining can continue for a while, especially when writing a more involved api end point, and by the time you’re looking at the bottom you’re constantly thrown off guard with how the indentation finishes relative to something close by.

I believe it’s important that all closing indentation be one level of depth difference from the next nearest.

2reactions
klarkccommented, Dec 23, 2015

+1 This is leading to Expected exactly one space between '{a}' and '{b}' errors in jslint.

Example:

gulp.task('changelog', function () {
    return gulp.src('CHANGELOG.md', {
            buffer: false
        })
        .pipe(conventionalChangelog({
            preset: 'angular' // Or to any other commit message convention you use.
        }))
        .pipe(gulp.dest('./'));
});

Errors:

4   Expected 'buffer' at column 9, not column 13.    buffer: false
5   Expected '}' at column 5, not column 9.  })

Correct way (for jslint):

gulp.task('changelog', function () {
    return gulp.src('CHANGELOG.md', {
        buffer: false
    })
        .pipe(conventionalChangelog({
            preset: 'angular' // Or to any other commit message convention you use.
        }))
        .pipe(gulp.dest('./'));
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

js-beautify | Yarn - Package Manager
... Webpack (#1149); daisy-chain indentation leads to over-indentation (#482) ... [bug] Incorrect indentation due to commented line(s) following a function ...
Read more >
mjmlTest/node_modules/js-beautify/CHANGELOG.md - GitLab
... daisy-chain indentation leads to over-indentation (#482) ... HTML pre code indentation (#928); Beautify script/style tags but ignore ...
Read more >
How to Daisy Chain Multiple Monitors Using DisplayPort Multi ...
Daisy chaining describes the ability to connect a series of monitors to a single video output port on your computer or docking station....
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