close
The Wayback Machine - https://web.archive.org/web/20220124163631/https://github.com/nodejs/node/pull/41664
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

test: use Object.hasOwn() where applicable #41664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

@Trott
Copy link
Member

@Trott Trott commented Jan 23, 2022

Replace Object.prototpye.hasOwnProperty() with Object.hasOwn() where
applicable.

Replace Object.prototpye.hasOwnProperty() with Object.hasOwn() where
applicable.
@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 23, 2022

Copy link
Member

@benjamingr benjamingr left a comment

Sure, but why? I get the value of hasOwn when interacting with objects whose prototype you can't be certain of but these are our own tests

aduh95
aduh95 approved these changes Jan 23, 2022
Copy link
Contributor

@aduh95 aduh95 left a comment

The goal is to enforce it with a lint rule in the future? I'm all for it.

@Trott
Copy link
Member Author

@Trott Trott commented Jan 23, 2022

Sure, but why? I get the value of hasOwn when interacting with objects whose prototype you can't be certain of but these are our own tests

The goal is to enforce it with a lint rule in the future? I'm all for it.

These are all flagged by the no-prototype-builtins rule which is included in the eslint:recommended configuration and which we then explicitly disable. I would like to remove that exception and enable the rule. These account for most of the code flagged, but there are still a few others.

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 23, 2022

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 23, 2022

@nodejs-github-bot
Copy link
Contributor

@nodejs-github-bot nodejs-github-bot commented Jan 23, 2022

bnb
bnb approved these changes Jan 24, 2022
Copy link
Member

@bnb bnb left a comment

:))))))))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants