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

Update: fix no-extra-parens CallExpression#callee false negatives #12743

Merged
merged 1 commit into from Jan 9, 2020

Conversation

mdjermanovic
Copy link
Member

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

[X] Bug fix

This bug fix produces more warnings.

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.

Online Demo Link

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

(a().b)();

What did you expect to happen?

Error and auto-fix to:

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

a().b();

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

No errors.

What changes did you make? (Give an overview)

Fixed the condition that prevents reporting code such as new (a().b)(), but it didn't account for the fact that the same checkCallNew() function is also used to check CallExpression nodes.

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

These tests were already invalid. Added them because it seems that the existing tests were mostly for NewExpression:

invalid("(a)()", "a()", "Identifier"),
invalid("(a.b)()", "a.b()", "MemberExpression"),
invalid("(a())()", "a()()", "CallExpression"),
invalid("(a.b())()", "a.b()()", "CallExpression"),

These are new errors after this PR:

invalid("(a().b)()", "a().b()", "MemberExpression"),
invalid("(a().b.c)()", "a().b.c()", "MemberExpression"),

@mdjermanovic mdjermanovic added bug ESLint is working incorrectly enhancement This change enhances an existing feature of ESLint 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 5, 2020
@mdjermanovic
Copy link
Member Author

This isn't related to #12740, it's a different bug.

@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
@kaicataldo kaicataldo merged commit b2c6209 into master Jan 9, 2020
@kaicataldo kaicataldo deleted the noextraparens-callexprcallee branch January 9, 2020 22:06
@kaicataldo
Copy link
Member

Thanks for contributing to ESLint!

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jul 9, 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 Jul 9, 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 this pull request may close these issues.

None yet

3 participants