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

Version 3.9.0 broke multiline array indentation #7473

Closed
cyrus-and opened this issue Oct 28, 2016 · 11 comments
Closed

Version 3.9.0 broke multiline array indentation #7473

cyrus-and opened this issue Oct 28, 2016 · 11 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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@cyrus-and
Copy link

Tell us about your environment

  • ESLint Version: v3.9.0
  • Node Version: v7.0.0-pre
  • npm Version: 3.10.8

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

Please show your full configuration:

{
    "rules": {
        "indent": [
            "error",
            4
        ]
    }
}

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

var array = [1,
             2,
             3];

What did you expect to happen?

This was considered valid before this release. It would be great to have the first option for arrays too.

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

2:14  error  Expected indentation of 4 spaces but found 13  indent
3:14  error  Expected indentation of 4 spaces but found 13  indent
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Oct 28, 2016
@not-an-aardvark not-an-aardvark added enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Oct 28, 2016
@not-an-aardvark
Copy link
Member

not-an-aardvark commented Oct 28, 2016

Thanks for the suggestion. I agree that this would be a useful option.

Previously, the indentation of array elements was not checked at all in these cases, so the change in v3.9.0 was a bugfix for that case. But it seems reasonable to have an option to customize this.

@ilyavolodin ilyavolodin added regression Something broke patch candidate This issue may necessitate a patch release in the next few days labels Oct 29, 2016
@not-an-aardvark
Copy link
Member

not-an-aardvark commented Oct 29, 2016

@ilyavolodin: I saw that you added the "regression"/"patch candidate" labels. However, I disagree that this is a regression; the bugfix is working as intended, which in this case means that more errors are reported. If we added an additional option, it would be semver-minor, not semver-patch.

@ianlyons
Copy link

ianlyons commented Oct 30, 2016

I'm experiencing something similar, and it seems that this is, indeed, a regression. I would expect the following to be valid:

Actual code causing the error:

const fn = function(events) {
  return IfThen(
    'If in review go to review',
    [{
      type: conditionTypes.FIELD_RESPONSE,
    }],
    [{
      property: 'property'
    }].concat(events)
  );
};

Actual error:

  73:5  error  Expected indentation of 2 spaces but found 4  indent

The key here, interestingly, is the concat method being called on the third argument, the second array... when removed, it no longer triggers as invalid.

@not-an-aardvark
Copy link
Member

@ianlyons Hmm, that part does seem like unintended behavior. Would you mind creating a new issue for it so that we can track it separately?

@ianlyons
Copy link

ianlyons commented Oct 30, 2016

@not-an-aardvark will do.

Edit: done - #7484.

@ilyavolodin
Copy link
Member

@not-an-aardvark Fair enough.

@ilyavolodin ilyavolodin removed patch candidate This issue may necessitate a patch release in the next few days regression Something broke labels Oct 31, 2016
@YarnSphere
Copy link

Note: version 3.9.0 also broke multi-line object indentation.

My two cents on this issue:

Indentation checking is disabled by default on function parameters and call expression arguments. Why must it be enabled by default on arrays/objects? The change broke a lot of my code (where broke reads as: ESLint now complains about it).

I agree that the option to indent array elements and object properties should be added, possibly with a first option, but with consistency in mind, it should probably be disabled by default.

jgraham added a commit to mozilla/treeherder that referenced this issue Nov 4, 2016
Downgrade eslint to 3.8 to avoid eslint/eslint#7473
@not-an-aardvark not-an-aardvark self-assigned this Nov 6, 2016
@not-an-aardvark
Copy link
Member

I'll champion this proposal.

@not-an-aardvark
Copy link
Member

@eslint/eslint-team We need one more +1 to accept this issue; any takers?

@nunocastromartins Ideally, I think nothing would be disabled by default. The user shouldn't have to specify ten different config options just to check indentation.

@ilyavolodin ilyavolodin added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Nov 7, 2016
@ilyavolodin
Copy link
Member

@not-an-aardvark We have 3 + champion (me, @platinumazure and @mysticatea). So marking as accepted.

@jacksonrayhamilton
Copy link
Contributor

I know I'm late to the game on this, but having just noticed this, I agree with @nunocastromartins. This was effectively a breaking change and should have been denoted as such with semver.

jacksonrayhamilton added a commit to jacksonrayhamilton/tern-jsx that referenced this issue Aug 23, 2017
@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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

7 participants