question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a --fix option for new-parens

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mysticateacommented, Aug 28, 2016

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.

0reactions
vitorbalcommented, Sep 3, 2016

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

new-parens - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
ESLint v3.5.0 released - ESLint中文文档
This release adds some new features and fixes several bugs found in the previous release. ... Eight rules gained support for the --fix...
Read more >
Configuring TSLint - Palantir Open Source
When using the CLI or many third-party tools, a file named tslint.json or tslint.yaml is used to configure which rules get run and...
Read more >
eslint/eslint - Gitter
hello, this is the first time i use eslint. it seems i have some issues fixable by eslint ( --fix option) i type:...
Read more >
@sailshq/eslint | Yarn - Package Manager
3ff5d11 Fix: no-invalid-regexp not understand variable for flags (fixes #10112) ... 0360cc2 Chore: Adding debug logs on successful plugin loads (#10100) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found