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

`object-shorthand` fails on calculated property #2937

Closed
nkbt opened this issue Jul 7, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@nkbt
Copy link

commented Jul 7, 2015

commands = OrderedMap({[id]: id}).concat(commands);
src/stores/CommandStore.js
  78:27  error  Expected property shorthand  object-shorthand

Parser is default, not changed.

@gyandeeps gyandeeps added the triage label Jul 7, 2015

@xjamundx

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2015

I have verified this bug and agree that this is a problem.

Here's what I'm seeing on latest master with this file called test2.js:

var y = "26";
var x = {[y]: y};

Run like this: node ./bin/eslint.js --rule '{object-shorthand: 2}' --env es6 test2.js

  1:1   error  Use the global form of "use strict"  strict
  2:5   error  x is defined but never used          no-unused-vars
  2:10  error  Expected property shorthand          object-shorthand

@gyandeeps gyandeeps added bug rule and removed triage labels Jul 7, 2015

@ilyavolodin ilyavolodin added the accepted label Jul 7, 2015

@xjamundx xjamundx self-assigned this Jul 7, 2015

@xjamundx

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2015

Technically this could be expected to be shorthand var x = {['y']: y}, but I feel like it's too odd to worry about, so I'm just going to exclude all computed properties if that works.

@nzakas nzakas closed this in 74dbc88 Jul 7, 2015

nzakas added a commit that referenced this issue Jul 7, 2015

Merge pull request #2945 from xjamundx/short-hand
Fix: object-shorthand computed props (fixes #2937)

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.