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

Support WeakRefs #13602

Open
mdjermanovic opened this issue Aug 21, 2020 · 2 comments
Open

Support WeakRefs #13602

mdjermanovic opened this issue Aug 21, 2020 · 2 comments

Comments

@mdjermanovic
Copy link
Member

@mdjermanovic mdjermanovic commented Aug 21, 2020

WeakRefs proposal is now Stage 4.

https://github.com/tc39/proposal-weakrefs

(it seems the proposal's repo hasn't been updated yet with tc39/proposal-weakrefs#212, but it was official in tc39/proposals@489f6df and merged in the spec in tc39/ecma262@71c0897).

  • ESLint Update 1 (minor version)
    • new es2021 environment with FinalizationRegistry and WeakRef globals. #13603
  • ESLint Update 2 (major version):
    • no-extend-native

Not sure if the new syntax label is appropriate since this isn't "syntax".

mdjermanovic added a commit that referenced this issue Aug 21, 2020
mdjermanovic added a commit that referenced this issue Aug 24, 2020
@mdjermanovic
Copy link
Member Author

@mdjermanovic mdjermanovic commented Aug 24, 2020

As for no-extend-native, this rule currently doesn't report any errors in the following code:

/* global FinalizationRegistry, WeakRef */

FinalizationRegistry.prototype.foo = bar;
WeakRef.prototype.foo = bar;

It will start reporting this code, but not before the next ESLint major version when we will upgrade the globals package to ^13 or above.

The same applies to a configuration where the new es2021 environment (which contains FinalizationRegistry and WeakRef) is enabled.

So, regardless of user configuration, the no-extend-native rule will not disallow modifying FinalizationRegistry and WeakRef prototypes until ESLint v8.0.0.

This is in line with a similar decision in #11803 for new BigInt globals, where it was seen as a breaking change, and thus postponed for v7.0.0 (though, for most users the change probably happened before v7.0.0, because globals added BigInt globals in a minor version of the package, and we have ^ dependency).

kaicataldo pushed a commit that referenced this issue Aug 29, 2020
* Update: add es2021 environment (refs #13602)

* Add no-undef test
@mdjermanovic mdjermanovic added breaking and removed enhancement labels Sep 5, 2020
@mdjermanovic
Copy link
Member Author

@mdjermanovic mdjermanovic commented Sep 5, 2020

Marked as breaking for Update 2: upgrading globals package, which would cause no-extend-native to report more errors.

@mdjermanovic mdjermanovic self-assigned this Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.