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

[camelcase] False positive when using leading underscore when destructuring with computed object property name. #13022

Closed
apples opened this issue Mar 10, 2020 · 1 comment · Fixed by #13023
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 rule Relates to ESLint's core rules

Comments

@apples
Copy link

apples commented Mar 10, 2020

Tell us about your environment

  • ESLint Version: v6.8.0
  • Node Version: v12.16.1
  • npm Version: v6.14.2

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

default

Please show your full configuration:

Configuration
{
    "parserOptions": {
        "ecmaVersion": 2020
    },
    "rules": {
        "camelcase": "error"
    }
}

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

const obj = {};

const { ['foo']: _foo } = obj;
eslint ./main.js

What did you expect to happen?

No error.

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

Error:

<redacted>\main.js
  4:18  error  Identifier '_foo' is not in camel case  camelcase

✖ 1 problem (1 error, 0 warnings)

Seems to be caused by the computed object property name in the { ['foo']: _foo } destructuring syntax. There is no error if it is changed to { foo: _foo }.

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

Not at this time.

@apples apples added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Mar 10, 2020
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Mar 10, 2020
@mdjermanovic
Copy link
Member

Hi @apples, thanks for the bug report!

Confirmed in our online demo, I'm working on this.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 8, 2020
@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 Sep 8, 2020
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 rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants