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 false positives with new and member expressions #12740

Closed
mdjermanovic opened this issue Jan 4, 2020 · 1 comment · Fixed by #13375
Closed

no-extra-parens false positives with new and member expressions #12740

mdjermanovic opened this issue Jan 4, 2020 · 1 comment · Fixed by #13375
Assignees
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

@mdjermanovic
Copy link
Member

mdjermanovic commented Jan 4, 2020

Tell us about your environment

  • ESLint Version: v6.8.0
  • Node Version: v12.14.0
  • npm Version: v6.13.4

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

default

Please show your full configuration:

Configuration
module.exports = {
    parserOptions: {
        ecmaVersion: 2015
    },
};

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

Online Demo Link

/* eslint no-extra-parens: "error" */

new (a()).b.c;

new (a().b).c;
eslint index.js --fix

What did you expect to happen?

No errors.

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

2 errors, and auto-fixed to:

/* eslint no-extra-parens: "error" */

new a().b.c;

new a().b.c;

The original expressions are both equivalent to new (a().b.c)

The expressions produced in the fix are equivalent to (new a()).b.c, which is a different thing.

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

Yes, but please verify is this a bug.

It seems that MemberExpression(node) should do a better check for both object and parent.

(also, this is not a regression from #12302, it's unrelated).

@mdjermanovic mdjermanovic 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 labels Jan 4, 2020
@kaicataldo kaicataldo 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 Jan 9, 2020
@eslint-deprecated eslint-deprecated bot added the auto closed The bot closed this issue label Apr 5, 2020
@eslint-deprecated
Copy link

Unfortunately, it looks like there wasn't enough interest from the team
or community to implement this change. While we wish we'd be able to
accommodate everyone's requests, we do need to prioritize. We've found
that accepted issues failing to be implemented after 90 days tend to
never be implemented, and as such, we close those issues.
This doesn't mean the idea isn't interesting or useful, just that it's
not something the team can commit to.

Thanks for contributing to ESLint and we appreciate your understanding.

@mdjermanovic mdjermanovic reopened this Apr 5, 2020
@mdjermanovic mdjermanovic self-assigned this Apr 5, 2020
@kaicataldo kaicataldo removed the auto closed The bot closed this issue label Apr 6, 2020
kaicataldo pushed a commit that referenced this issue Jul 3, 2020
…#13375)

* Fix: false positive new with member in no-extra-parens (fixes #12740)

* rename func

* remove duplicate function

* check whole node is wrapped or not

* remove checking whole node

* check member object
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Dec 31, 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 Dec 31, 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 rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants