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

Comments

@kikoanis
Copy link

@kikoanis 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 label Apr 30, 2016
@kaicataldo kaicataldo added bug rule evaluating and removed triage labels Apr 30, 2016
@kaicataldo
Copy link
Member

@kaicataldo 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

@michaelficarra michaelficarra commented Apr 30, 2016

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

@kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented Apr 30, 2016

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

@kikoanis
Copy link
Author

@kikoanis kikoanis commented Apr 30, 2016

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 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 and removed evaluating labels Apr 30, 2016
kaicataldo added a commit that referenced this issue Apr 30, 2016
@kaicataldo
Copy link
Member

@kaicataldo kaicataldo commented May 1, 2016

PR opened to fix this.

@252405649
Copy link

@252405649 252405649 commented Jun 20, 2016

good

@eslint eslint bot locked and limited conversation to collaborators Feb 6, 2018
@eslint eslint bot added the archived due to age label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.