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.

Conflicts between `no-prototype-builtins` and `no-useless-call`

See original GitHub issue

Tell us about your environment

  • ESLint Version: 7.27.0
  • Node Version: 16
  • npm Version: 6
  • Operating System: windows

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?

default(espree)

Please show your full configuration:

Configuration
// I don't think this is useful

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

I want check a property is Object’s own property,

Object.prototype.hasOwnProperty(property);

no-prototype-builtins reports an error.

Object.prototype.hasOwnProperty.call(Object.prototype, property);

no-useless-call reports an error.

What did you expect to happen?

no-useless-call rule should ignore Object.prototype.hasOwnProperty.call(Object.prototype, ...)

What actually happened? Please copy-paste the actual, raw output from ESLint.

N/A

Steps to reproduce this issue:

N/A

Are you willing to submit a pull request to fix this bug?

No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
nzakascommented, Jun 8, 2021

Yeah, I also agree that this is more of an edge case and I can’t see a generic way to solve the conflict that doesn’t cause other problems. When there are as many core rules as ESLint has, it just gets difficult to make them all play together in every configuration.

1reaction
fiskercommented, Jun 4, 2021

I updated expect to

no-useless-call rule should ignore Object.prototype.hasOwnProperty.call(Object.prototype, ...)

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-prototype-builtins - 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-module-utils 2.5.1 broken · Issue #1604 - GitHub
Hey, when using eslint-module-utils 2.5.1, my eslint stops being able to resolve most imports. I receive lots of errors of this type: 1:1 ......
Read more >
Fixing 'The body of a for-in should be wrapped in an if ...
Fixing 'The body of a for-in should be wrapped in an if statement to filter unwanted properties from the prototype' · 1. Never...
Read more >
List of available rules - 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 >
@cling/eslint-config - npm
These rules relate to better ways of doing things to help you avoid problems: disallow lexical declarations in case clauses ( no-case-declarations );...
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