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.

Rule Change: prevent new-cap from flagging the caller because of third-party modules

See original GitHub issue

What rule do you want to change?

new-cap

What change to do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new default behavior

Example code

import { Deserialize } from 'cerialize';

// ...
const someObj = Deserialize(someJson, SomeType);

What does the rule currently do for this code?

Currently new-cap flags the code because Deserialize() is not camelCased, despite it being a third party module.

What will the rule do after it’s changed?

One of the followings:

  1. Check the naming rule at the point of definition (callee), rather than at the point of invocation (caller).
  2. Ignore ESM imported function calls from being checked.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

See #15722 for the previous Q&A.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Apr 23, 2022

I’d be a new option, as it’s also likely to be incorrect usage. e.g.

import { Foo } from "foo";

var foo = Foo(); // should be new Foo();

making it the default will ignore these errors?

I think this rule is intended to enforce naming conventions, not to catch errors (though, it can catch errors).

0reactions
nzakascommented, May 5, 2022

Fair enough. Given that we don’t agree that this is a bug, we can close this.

@nedsociety it looks like you have some options to work around this limitation already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Combating Spoofed Robocalls with Caller ID Authentication
This technology is critical to protecting Americans from scams using spoofed robocalls because it erodes the ability of callers to illegally spoof a...
Read more >
Triage - GitHub
Rule Change : prevent new-cap from flagging the caller because of third-party modules. 1 task. eslint#15724 opened by nedsociety archived due to age...
Read more >
Complying with the Telemarketing Sales Rule
Any call from a consumer that is not placed in response to a solicitation by the seller, charitable organization, or telemarketer is exempt...
Read more >
Announcements | U.S. Department of Labor
This presentation will provide a detailed overview of how the 2022 H-2A rule will affect filing and processing including preparations to the FLAG...
Read more >
Why Are My Business Calls Being Blocked or Flagged as ...
The carrier's analytics software can't tell the difference between legitimate calls and robocalling. In an effort to protect its customers, the ...
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