Disallow empty static blocks
Using the recommended config from @eslint/js in a configuration file enables this rule
Some problems reported by this rule are manually fixable by editor suggestions
Empty static blocks, while not technically errors, usually occur due to refactoring that wasn’t completed. They can cause confusion when reading code.
This rule disallows empty static blocks. This rule ignores static blocks which contain a comment.
Examples of incorrect code for this rule:
/*eslint no-empty-static-block: "error"*/
class Foo {
static
}
Examples of correct code for this rule:
/*eslint no-empty-static-block: "error"*/
class Foo {
static {
bar();
}
}
class Bar {
static {
// comment
}
}
This rule has no options.
This rule should not be used in environments prior to ES2022.
This rule was introduced in ESLint v8.27.0.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/no-empty-static-block