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

no-extra-parens ignores param and destructuring defaults #11893

Closed
mdjermanovic opened this issue Jun 24, 2019 · 1 comment · Fixed by #11909
Closed

no-extra-parens ignores param and destructuring defaults #11893

mdjermanovic opened this issue Jun 24, 2019 · 1 comment · Fixed by #11909
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@mdjermanovic
Copy link
Member

Tell us about your environment

  • ESLint Version: 6.0.0 (same with 5.16.0)
  • Node Version: 10.16.0
  • npm Version: 6.9.0

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

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 6,
  },
  rules: {
    "no-extra-parens": "error",
  }
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

function foo(a = (b)) {}

const bar = (a = (b)) => a;

const [a = (b)] = [];

const {c = (d)} = {};
eslint index.js

What did you expect to happen?

4 errors.

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

Nothing, no errors.

Are you willing to submit a pull request to fix this bug?

Yes, I'll do it.

Inner expressions are fine (e.g. ((b * c) + d)) would be reported), only the top level is missing.

Found this while working on #11848, the "AssignmentPattern" handler is missing. It should check its .right.

Just need help with the analysis:

comma operator ("SequenceExpression") inside should be checked for sure.

Is there any other case where these parens could be necessary?

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Jun 24, 2019
@mysticatea mysticatea added accepted There is consensus among the team that this change meets the criteria for inclusion enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Jun 25, 2019
@mysticatea
Copy link
Member

Thank you for your report.

I confirmed it.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 15, 2020
@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 15, 2020
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants