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

Add a --fix option for new-parens #6994

Closed
not-an-aardvark opened this issue Aug 28, 2016 · 6 comments
Closed

Add a --fix option for new-parens #6994

not-an-aardvark opened this issue Aug 28, 2016 · 6 comments
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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules

Comments

@not-an-aardvark
Copy link
Member

I'm using Node v6.4.0 and ESLint v3.4.0.

It would be useful to have an autofix option for the new-parens rule. The fixer would simply add () to all places where the rule reports an error.

var x = new Foo;
var y = new foo.Bar;
var z = (new Foo).bar;

// gets corrected to:

var x = new Foo();
var y = new foo.Bar();
var z = (new Foo()).bar;

I would be willing to add this if the issue is accepted.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 28, 2016
@platinumazure
Copy link
Member

Thanks for the issue!

This seems reasonable to me. I'll champion this enhancement.

@platinumazure platinumazure added 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 and removed triage An ESLint team member will look at this issue soon labels Aug 28, 2016
@platinumazure platinumazure self-assigned this Aug 28, 2016
@mysticatea
Copy link
Member

👍

And I'd like to suggest one more case.

  • new (Foo)new (Foo)() (it will add parentheses to outside of parentheses which enclose callee.)

@not-an-aardvark
Copy link
Member Author

@mysticatea: I agree with that, but it seems like new-parens does not currently report new (Foo) as an issue. I suppose that's a separate bug.

@mysticatea
Copy link
Member

Oh, it's a bug!

Currently, new-parens rule seems to check whether there are 2 or more parentheses in a NewExpression node. It does not check whether the parentheses is for arguments or not.

I will open an issue.

@nzakas
Copy link
Member

nzakas commented Aug 29, 2016

👍

@vitorbal
Copy link
Member

vitorbal commented Sep 3, 2016

👍

@platinumazure platinumazure 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 Sep 3, 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 enhancement This change enhances an existing feature of ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

No branches or pull requests

6 participants