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.

Proposal: "first" option for `indent/MemberExpression`

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.8.0
  • Node Version: 8.6.0
  • npm Version: yarn-1.1.0

What parser (default, Babel-ESLint, etc.) are you using? default

What rule do you want to change? indent

Does this change cause the rule to produce more or fewer warnings? nope

How will the change be implemented? (New option, new default behavior, etc.)? Option { "MemberExpression": "first" } will allow member expressions to be indented just as the first member expression.

Please provide some example code that this change will affect:

foo.bar
   .baz
   .qux

What does the rule currently do for this code? Depends on configuration, but .baz & .qux are indented by fixed number of spaces.

What will the rule do after it’s changed? .baz & .qux will be indented as shown, i. e. dots before member name will be on the same column.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:29 (17 by maintainers)

github_iconTop GitHub Comments

3reactions
AlexandreBonneaucommented, Jan 15, 2018

About the simplest cases:

// 1)
this.someObject.someMethod()
               .someOtherMethod();
someObject.someMethod()
          .someOtherMethod();

or

// 2)
this.someObject.someMethod()
    .someOtherMethod()

it seems to me that 1) is the most used case, and that if the alignment should be on the very first dot, then 2) could/should be reformatted to:

// 2b)
this.someObject
    .someMethod()
    .someOtherMethod();
3reactions
platinumazurecommented, Oct 3, 2017

Sounds good to me. I’ll champion.

@eslint/eslint-team Any 👍s for this proposal?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Which ESLint rule applies to Promise/Arrow function indent?
Which indent rule object option does apply here (has to be changed) as I want to keep the indentation as is? I don't...
Read more >
indent - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
jscodeshift example | Better world by better software
We just use it as the first argument (the target object) to the j.memberExpression . The transformation prints the result: require('./calc').add ...
Read more >
@babel/plugin-transform-member-expression-literals | Yarn
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >
Attribution - Sandtime.io
... @babel/plugin-proposal-json-strings · @babel/plugin-proposal-logical-assignment-operators ... @babel/plugin-transform-member-expression-literals ...
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