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.

New Rule: `no-empty-static-block`

See original GitHub issue

Rule details

Restricts empty static blocks

Related ECMAScript feature

https://github.com/tc39/proposal-class-static-block

What type of rule is this?

Enforces a formatting/stylistic preference

Example code

class Foo {
  static {
  }
}

Why should this rule be in the core instead of a plugin?

Static blocks is a core feature of ECMAScript

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

https://github.com/eslint/eslint/issues/15016

no-empty (or no-empty-function?) neither, possibly a new rule.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mdjermanoviccommented, Sep 16, 2022

I support this 👍

1reaction
snitin315commented, Sep 18, 2022

I’m 👍🏻 for supporting this rule as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-empty-static-block - ESLint - Pluggable JavaScript Linter
Rule Details. This rule disallows empty static blocks. This rule ignores static blocks which contain a comment. Examples of incorrect code for this...
Read more >
Different static blocks executed in java with an empty main ...
The static block in class Developer is not executed. Is there any logical explanation? java · Share. Share ...
Read more >
ECMAScript class static initialization blocks - TC39
This proposal defines new syntax to perform privleged static initialization of a class. See the proposal repository for background material and ...
Read more >
Static Block in Java | Use, Example - Scientech Easy
2. If the static block is not present in the program, JVM invokes the main method first. How many times Dot class file...
Read more >
CSS static code analysis: Empty blocks should be removed
Unique rules to find Bugs and Code Smells in your CSS code ... Empty blocks should be removed. Code Smell · Strings should...
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