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

feat: Add prefer-object-has-own rule. #15206

Closed
wants to merge 3 commits into from

Conversation

Gautam-Arora24
Copy link
Contributor

Fixes #14939

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

[ ] Documentation update
[ ] Bug fix (template)
[X] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

What changes did you make? (Give an overview)

This PR focuses on adding a new rule called prefer-object-has-own. The PR adheres to the guidelines provided and has tests and documentation included. This rule requires using Object.hasOwn instead of Object.prototype.hasOwnProperty.

Is there anything you'd like reviewers to focus on?

Caveats ->
The PR doesn't contain any fixes for the rule.

Fixes #14939

@eslint-github-bot eslint-github-bot bot added the triage An ESLint team member will look at this issue soon label Oct 24, 2021
@eslint-github-bot
Copy link

Hi @Gautam-Arora24!, thanks for the Pull Request

The first commit message isn't properly formatted. We ask that you update the message to match this format, as we use it to generate changelogs and automate releases.

  • The commit message tag must be one of the following:

    The Tag is one of the following:

    • Fix - for a bug fix.
    • Update - either for a backwards-compatible enhancement or for a rule change that adds reported problems.
    • New - implements a new feature.
    • Breaking - for a backwards-incompatible enhancement or feature.
    • Docs - changes to documentation only.
    • Build - changes to build process only.
    • Upgrade - for a dependency upgrade.
    • Chore - for anything that isn't user-facing (for example, refactoring, adding tests, etc.).

    You can use the labels of the issue you are working on to determine the best tag.

  • There should be a space following the initial tag and colon, for example 'New: Message'.

  • The first letter of the tag should be in uppercase

Read more about contributing to ESLint here

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 24, 2021

CLA Signed

The committers are authorized under a signed CLA.

@Gautam-Arora24 Gautam-Arora24 changed the title feat: Add prefer-object-has-own rule. New: Add prefer-object-has-own rule. Oct 24, 2021
@aladdin-add aladdin-add added accepted There is consensus among the team that this change meets the criteria for inclusion feature This change adds a new feature to ESLint rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Oct 25, 2021
Copy link
Member

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR! I've left a few questions.

docs/rules/prefer-object-has-own.md Show resolved Hide resolved
tests/lib/rules/prefer-object-has-own.js Outdated Show resolved Hide resolved
tests/lib/rules/prefer-object-has-own.js Outdated Show resolved Hide resolved
tests/lib/rules/prefer-object-has-own.js Show resolved Hide resolved
lib/rules/prefer-object-has-own.js Outdated Show resolved Hide resolved
@mdjermanovic mdjermanovic changed the title New: Add prefer-object-has-own rule. feat: Add prefer-object-has-own rule. Oct 26, 2021
@mdjermanovic
Copy link
Member

@Gautam-Arora24 you can run npm test locally to see the linting errors and other errors that should be fixed.

https://eslint.org/docs/developer-guide/unit-tests

@Gautam-Arora24
Copy link
Contributor Author

The latest changes contain ->

  • Object-style test cases to assert invalid test cases.
  • Reporting to all cases mentioned here.
  • All checks successful.
  • All changes mentioned above in the review.

@nzakas
Copy link
Member

nzakas commented Nov 20, 2021

@Gautam-Arora24 are you still working on this?

@Gautam-Arora24
Copy link
Contributor Author

Sorry @nzakas for the delay. I will create followup commits soon :)

@Gautam-Arora24
Copy link
Contributor Author

Sorry @nzakas but I am not getting enough time for this PR. If someone wants to pick it up, he/she can feel free to do so :)

@snitin315
Copy link
Contributor

I will fininsh it 👍

@snitin315
Copy link
Contributor

closing in favor of the new PR #15206

@snitin315 snitin315 closed this Nov 23, 2021
@ljharb
Copy link
Sponsor Contributor

ljharb commented Nov 23, 2021

I think you meant #15346

@snitin315
Copy link
Contributor

I think you meant #15346

Definitely 👍

@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators May 23, 2022
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label May 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A rule suggesting to replace Object.prototype.hasOwnProperty.call with Object.hasOwn
6 participants