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.

`no-new-object` to allow argument

See original GitHub issue

What rule do you want to change?

no-new-object

Does this change cause the rule to produce more or fewer warnings?

Fewer warnings.

How will the change be implemented? (New option, new default behavior, etc.)?

New default behavior.

Please provide some example code that this change will affect:

new Object(BigInt('1n'))

What does the rule currently do for this code?

Reports an error.

What will the rule do after it’s changed?

Not report anything.

Are you willing to submit a pull request to implement this change?

Yes.

As per the above example, there are uses for wrapping some items within a new Object() (or within the equivalent, Object(), but some prefer the style of requiring new in such cases, as per unicorn/new-for-builtins).

If it is thought that people will like to make this optional, I can modify to something like allowWithArguments.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
brettz9commented, Jun 7, 2019

Btw, the reason I originally suggested the behavior as the default is because the only rationale given in the docs for avoiding new Object is that it is equivalent to the object literal, but in this case it isn’t.

However, I understand people don’t always want to allow such more obscure uses.

0reactions
eslint-deprecated[bot]commented, Jul 8, 2019

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 issues failing to reach accepted status after 21 days tend to never be accepted, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python TypeError: object() takes no arguments Solution
The “TypeError: object() takes no arguments” error is raised when you do not declare a method called __init__ in a class that accepts...
Read more >
I'm getting a TypeError. How do I fix it? - Stack Overflow
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list' TypeError: a bytes-like object is required, ...
Read more >
The arguments object - JavaScript - MDN Web Docs - Mozilla
The arguments object is a local variable available within all non-arrow functions. You can refer to a function's arguments inside that ...
Read more >
ArgumentNullException Class (System) - Microsoft Learn
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it...
Read more >
argparse — Parser for command-line options, arguments and ...
If you change the parent parsers after the child parser, those changes will not be reflected in the child. formatter_class¶. ArgumentParser objects allow...
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