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: update no-use-before-define for class static blocks #15312

merged 1 commit into from Nov 21, 2021


Copy link

@mdjermanovic mdjermanovic commented Nov 14, 2021

Prerequisites checklist

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

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

Refs #15016, fixes no-use-before-define.

What changes did you make? (Give an overview)

Updated logic related to class definition evaluation with class static blocks.

/* eslint no-use-before-define: "error" */

class C {
    static {
        C.x = 42; // ok

const D = class {
    static {
        D.x = 42; // TDZ error

class E {
    static {
        a; // TDZ error
let a;

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

This is ready for review but marked as draft since it's using eslint-scope from GitHub.

Updates logic related to class definition evaluation with class static blocks.

Refs #15016
@mdjermanovic mdjermanovic force-pushed the staticblocks-nousebeforedefine branch from bb6e846 to 8c333ee Nov 17, 2021
@mdjermanovic mdjermanovic marked this pull request as ready for review Nov 17, 2021
Copy link

@btmills btmills left a comment

Thanks for implementing a whole bunch of these, @mdjermanovic!

@btmills btmills merged commit 79278a1 into main Nov 21, 2021
14 checks passed
@btmills btmills deleted the staticblocks-nousebeforedefine branch Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants