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

Fix: quote-props shouldn't report object pattern properties #12046



Copy link

mdjermanovic commented Aug 1, 2019

What is the purpose of this pull request? (put an "X" next to item)

[X] Bug fix

Tell us about your environment

  • ESLint Version: 6.1.0
  • Node Version: 10.16.0
  • npm Version: 6.9.0

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


Please show your full configuration:

module.exports = {
  parserOptions: {
    ecmaVersion: 6,

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

/*eslint quote-props: ["error", "always"]*/
({'a': foo, b: bar} = baz)
/*eslint quote-props: ["error", "as-needed"]*/
({'a': foo, b: bar} = baz)
/*eslint quote-props: ["error", "consistent"]*/
({'a': foo, b: bar} = baz)
/*eslint quote-props: ["error", "consistent-as-needed"]*/
({'a': foo, b: bar} = baz)

What did you expect to happen?

No warnings. By the documentation for this rule it targets object literals, these are object patterns.
Also, there are no test cases with patterns.

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

2 warnings, for always and as-needed.

No warnings for consistent and consistent-as-needed.

What changes did you make? (Give an overview)

Skip the check if the Property is not a property of an ObjectExpression.

Is there anything you'd like reviewers to focus on?

I guess this should be treated as a bug rather than as an undocumented behavior because it doesn't work well - some options report warnings, some not.


This comment has been minimized.

Copy link

kaicataldo commented Dec 14, 2019

@mdjermanovic How would you like to proceed with this? Is this a WIP?


This comment has been minimized.

Copy link
Member Author

mdjermanovic commented Dec 14, 2019

Closing this for the same reasons as #12047.

Further analysis in #12048

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.