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-curly-spacing not respecting objectsInObjects when destructuring #6469

Closed
adamrenklint opened this issue Jun 18, 2016 · 3 comments
Closed
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

@adamrenklint
Copy link
Contributor

What version of ESLint are you using?
2.13.0

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

Please show your full configuration:

{
  "parser": "eslint",
  "extends": "eslint:recommended",
  "rules": {
    "object-curly-spacing": [2, "always", {
      "objectsInObjects": false,
      "arraysInObjects": true
    }]
  }
}

What did you do? Please include the actual source code causing the issue.
Wrote code like const { y: { z }} = x

What did you expect to happen?
No error to be reported

What actually happened? Please include the actual, raw output from ESLint.
Error was reported:

1:17  error  A space is required before '}'  object-curly-spacing

I forked the project to investigate, and will also open a pull request in a few minutes with a proposed fix.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jun 18, 2016
@originalfoo
Copy link
Contributor

Should the rule docs be updated to include var { y: { z }} = x in examples?

@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 Jun 19, 2016
@kaicataldo
Copy link
Member

kaicataldo commented Jun 19, 2016

That definitely seems counter-intuitive - I wonder if this should be lumped into objectsInObjects or if there should be a separate destructure config option, since this also warns for destructuring arrays in objects like so:

const { y: [ z ]} = x;

produces

/Users/kaicataldo/Code/eslint/test/eslint-test/test.js
  1:17  error  A space is required before '}'  object-curly-spacing

✖ 1 problem (1 error, 0 warnings)

@nzakas nzakas added enhancement This change enhances an existing feature of ESLint and removed enhancement This change enhances an existing feature of ESLint labels Jun 20, 2016
@nzakas
Copy link
Member

nzakas commented Jun 20, 2016

Confirmed, looks like a bug. We treat ObjectPattern and ObjectExpression the same in this rule so they should behave the same way throughout.

@nzakas nzakas 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 Jun 20, 2016
@nzakas nzakas closed this as completed in 5668236 Jun 21, 2016
@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