Skip to content

computed-property-spacing errors with parens #12198

@mdjermanovic

Description

@mdjermanovic

Tell us about your environment

  • ESLint Version: 6.3.0
  • Node Version: 10.16.0
  • npm Version: 6.9.0

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

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 2015,
  }
};

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

Demo link

/*eslint computed-property-spacing: ["error", "always"]*/

const foo = {
  [ (a) ]: 1
}
eslint index.js --fix

What did you expect to happen?

No errors.

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

4:5  error  A space is required after '('   computed-property-spacing
4:7  error  A space is required before ')'  computed-property-spacing

Fixed to:

/*eslint computed-property-spacing: ["error", "always"]*/

const foo = {
  [ ( a ) ]: 1
}

Are you willing to submit a pull request to fix this bug?

Yes.

It would be also good to clarify how should the rule handle comments.

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 incorrectlyruleRelates 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