Skip to content

[indent] Incorrect expected indentation for jsx spread props #12574

@nwoltman

Description

@nwoltman

Tell us about your environment

  • ESLint Version: v6.6.0
  • Node Version: v13.1.0
  • npm Version: v6.12.1

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

babel-eslint@10.0.3

Please show your full configuration:

Configuration
{
  "root": true,
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true
    }
  },
  "env": {
    "browser": true,
    "node": false
  },
  "rules": {
    "indent": [2, 2, {"SwitchCase": 1}]
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

import React from 'React';

export default function Button(props) {
  return (
    <button
      type="button"
      {
        ...props // ESLint is (incorrectly) expecting less indentation here
      }
    />
  );
};
eslint ./index.js

What did you expect to happen?

No errors

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

  8:1  error  Expected indentation of 6 spaces but found 8  indent

Are you willing to submit a pull request to fix this bug?
Sure, if none of the maintainers have time to get to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionbugESLint is working incorrectlyindentRelates to the `indent` ruleruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions