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

Expected property shorthand warning on computed property #6015

Closed
kikoanis opened this issue Apr 30, 2016 · 7 comments
Closed

Expected property shorthand warning on computed property #6015

kikoanis opened this issue Apr 30, 2016 · 7 comments
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

@kikoanis
Copy link

kikoanis commented Apr 30, 2016

What version of ESLint are you using?
2.9.0

What parser (default, Babel-ESLint, etc.) are you using?
babel-eslint = 6.0.4

Please show your full configuration:

rules: {
   ...
   "object-shorthand": 1,
   ...
}

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

const constant = 'foo'
....
const obj = { [constant]: constant }

What did you expect to happen?
This should pass or I am missing something on how to do it.
What actually happened? Please include the actual, raw output from ESLint.
warning Expected property shorthand object-shorthand

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Apr 30, 2016
@kaicataldo kaicataldo added bug ESLint is working incorrectly 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 Apr 30, 2016
@kaicataldo
Copy link
Member

kaicataldo commented Apr 30, 2016

Can you share the config you're using? Do you have the object-shorthand rule turned on? With the information you provided, it looks like you're not using the object shorthand syntax and, assuming you have the rule turned on in your config, this warning is the expected behavior. The shorthand notation would be:

const constant = 'foo'
const obj = { 
  constant
}

@michaelficarra
Copy link
Member

@kaicataldo Look again at the example. The property name is computed.

@kaicataldo
Copy link
Member

Ah, I see. Shouldn't be doing this so late.

@kikoanis
Copy link
Author

Updated my original comment to add the configuration part that is responsible for object-shorthand. I do not see any issue here. I only encountered this after upgrading to 2.9.0 and I suspect it is related to this e2ad1ec

@kaicataldo
Copy link
Member

kaicataldo commented Apr 30, 2016

@kikoanis Yeah, sorry, I shouldn't have been trying to triage so late in the evening. It does seem like a bug introduced in this commit: e2ad1ec.

Edit: Was able to recreate locally with the default parser as well.

@kaicataldo kaicataldo 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 Apr 30, 2016
@kaicataldo
Copy link
Member

PR opened to fix this.

@252405649
Copy link

good

@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 rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

5 participants