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

primordials access check can be improved #35449

Closed
Leko opened this issue Oct 1, 2020 · 1 comment
Closed

primordials access check can be improved #35449

Leko opened this issue Oct 1, 2020 · 1 comment
Labels
build Issues and PRs related to build files or the CI.

Comments

@Leko
Copy link
Contributor

Leko commented Oct 1, 2020

Problems

Proposal

I created a new draft PR that includes a new custom ESLint rule for that.
#35448

  • It'll report accessing global built-in objects that aren't using primordials such Array or Symbol
  • It'll report static methods such as Array.from or Symbol.for
  • It won't report prototype methods to prevent false-positive reporting. It will need static type information.

Here is the result of make lint-js with new rule on the commit 4d7015f.

If we have a special reason for using the built-in object, we can add an inline comment such as eslint-disable node-core/prefer-primordials.

Pros

  • Improve security
  • Improve performance
  • Reduce reviewing cost
  • No need PRs that replace codes with primordials anymore.

Concerns

I'm not sure whether all codes in lib/ should be replaced with primordials.

What do you think?

@watilde watilde added the build Issues and PRs related to build files or the CI. label Oct 16, 2020
@aduh95
Copy link
Contributor

aduh95 commented Dec 12, 2020

Fixed by cef1444.

@aduh95 aduh95 closed this as completed Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants