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

eslint 3.12.0 indent validation failure with object on new line in function call, expects extra 11 indents #7733

Closed
jdforrester opened this issue Dec 9, 2016 · 2 comments
Assignees
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly patch candidate This issue may necessitate a patch release in the next few days regression Something broke rule Relates to ESLint's core rules

Comments

@jdforrester
Copy link

Tell us about your environment

  • ESLint Version: 3.12.0
  • Node Version: 7.1.0
  • npm Version: 4.0.3

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

Please show your full configuration: Using eslint-config-wikimedia 0.3.0 (which I maintain) via grunt-eslint 19.0.0; no other rules.

package.json:

{
  "private": true,
  "scripts": {
    "test": "grunt"
  },
  "devDependencies": {
    "eslint-config-wikimedia": "0.3.0",
    "grunt": "1.0.1",
    "grunt-eslint": "19.0.0"
  }
}

.estlintrc.json:

{
    "extends": "wikimedia"
}

What did you do? Please include the actual source code causing the issue.

/* global window */

window.foo( 'Foo', function () {
	var foo = [
		{
			foo: function () {
				window.foo( 'foo',
					{
						foo: 'bar',
						bar: {
							foo: 'bar'
						}
					}
				);
			}
		}
	];

	window.console.log( foo );
} );

(Simplified from the real code as much as I could to keep the failure there.)

What did you expect to happen?
WIth eslint 3.11.1 this was validating fine.

What actually happened? Please include the actual, raw output from ESLint.

Running "eslint:main" (eslint) task

/Users/jdforrester/code/scratch/test.js
   8:6  error  Expected indentation of 16 tabs but found 5  indent
   9:7  error  Expected indentation of 17 tabs but found 6  indent
  10:7  error  Expected indentation of 17 tabs but found 6  indent
  13:6  error  Expected indentation of 16 tabs but found 5  indent

✖ 4 problems (4 errors, 0 warnings)

Warning: Task "eslint:main" failed. Use --force to continue.

Aborted due to warnings.

Note that moving 'foo' into an indented item makes this pass; presumably it's thinking that the indentation should be based from the last inline parameter, rather than the beginning of the function? I've worked around it for now but I imagine this isn't intended behaviour in the fix for #7473 ?

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Dec 9, 2016
@not-an-aardvark not-an-aardvark added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly patch candidate This issue may necessitate a patch release in the next few days rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Dec 9, 2016
@not-an-aardvark
Copy link
Member

Thanks for the report. I can reproduce this issue.

@roastlechon
Copy link

I can reproduce this too....

in this situation it prefers 39 spaces instead of 8 spaces for the first object curly brace as specified by the arrow comment

const mainLinks = React.Children.map(children,
      (child, i) => React.cloneElement(child,
        { // <---------------------------------------------------
          index: i,
          isHidden: isDroppedToOne ? true : !this.isVisibleIndex(i)
        }
      )
    );

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly patch candidate This issue may necessitate a patch release in the next few days regression Something broke rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

4 participants