question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support class static blocks (stage-4)

See original GitHub issue

What is the name of the syntax to implement? class static blocks

Please provide the TC39 URL for the syntax proposal: https://github.com/tc39/proposal-class-static-block

Please provide some example code for the new syntax:

// with static blocks:
class C {
  static x = ...;
  static y;
  static z;
  static {
    try {
      const obj = doSomethingWith(this.x);
      this.y = obj.y;
      this.z = obj.z;
    }
    catch {
      this.y = ...;
      this.z = ...;
    }
  }
}

Implementation Checklist

Please check off all items that have already been completed. Be sure to paste the pull request URLs next to each item so we can verify the work as done.

Are you willing to submit a pull request to implement this syntax? y

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:6
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
nzakascommented, Sep 2, 2021

This looks like it will need a new scope in eslint-scope and a new code path type.

1reaction
btmillscommented, Nov 21, 2021

All currently-known work to implement class static blocks just shipped in ESLint v8.3.0!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ES2022 feature: class static initialization blocks - 2ality
The ECMAScript proposal “Class static initialization blocks” by Ron Buckton is at stage 4 and scheduled to be included in ECMAScript 2022.
Read more >
Static initialization blocks - JavaScript - MDN Web Docs
Static blocks allow statements to be evaluated during initialization, which allows initializations that (for example) include try...catch or set multiple fields ...
Read more >
Class Static Block details - ECMAScript Proposals
Class static blocks provide a mechanism to perform additional static initialization during class definition evaluation. This is not intended as a replacement ...
Read more >
ES2022: A Complete Guide on Private Class Fields, Methods ...
Static blocks allow us to address different use cases for class initialization. In the following example, the class D's static block can access ......
Read more >
Intent to Ship: Class static initializer blocks - Google Groups
This is a stage 3 proposal in TC39, which is a solid indication of support. Assuming that the answer to the testing question...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found