Repository: eslint/eslint
Pull request #15333 (2021-11-18 12:29:02)

feat: update padded-blocks for class static blocks
<!--
    Thank you for contributing!

    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

#### Prerequisites checklist

- [x] I have read the [contributing guidelines](https://github.com/eslint/eslint/blob/HEAD/CONTRIBUTING.md).

#### What is the purpose of this pull request? (put an "X" next to an item)

<!--
    The following template is intentionally not a markdown checkbox list for the reasons
    explained in https://github.com/eslint/eslint/pull/12848#issuecomment-580302888
-->

[ ] Documentation update
[ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/HEAD/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/HEAD/templates/rule-proposal.md))
[x] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/HEAD/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Refs #15016, fixes `padded-blocks`.

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

#### What changes did you make? (Give an overview)

Updated the `padded-blocks` rule to apply to class static blocks.

```js
/* eslint padded-blocks: ["error", "always"] */

if (foo) { // applies to block statements
  bar();
}

class C {
  
  method() { // applies to function and method bodies
    bar();
  }
  
  static { // should apply to class static blocks, too
    bar();
  }
  
}
```

When the object option is used, the existing `"blocks"` applies to class static blocks, as it already applies to both block statements and function bodies.

```js
/* eslint padded-blocks: ["error", { "blocks": "always" }] */

if (foo) { // applies to block statements
  bar();
}

class C {
  
  method() { // applies to function and method bodies
    bar();
  }
  
  static { // should apply to class static blocks, too
    bar();
  }
  
}

```


#### Is there anything you'd like reviewers to focus on?



Patch:
diff --git a/docs/rules/brace-style.md b/docs/rules/brace-style.md
index 1a5bf00aa..c22c790ec 100644
--- a/docs/rules/brace-style.md
+++ b/docs/rules/brace-style.md
@@ -85,6 +85,14 @@ if (foo) {
 else {
   baz();
 }
+
+class C
+{
+    static
+    {
+        foo();
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the default `"1tbs"` option:
@@ -112,6 +120,12 @@ try {
   handleError();
 }
 
+class C {
+    static {
+        foo();
+    }
+}
+
 // when there are no braces, there are no problems
 if (foo) bar();
 else if (baz) boom();
@@ -150,6 +164,12 @@ if (foo) { baz(); } else if (bar) {
 try { somethingRisky(); } catch(e) {
   handleError();
 }
+
+class C {
+    static { foo(); }
+}
+
+class D { static { foo(); } }
 ```
 
 ### stroustrup
@@ -177,6 +197,14 @@ try
   handleError();
 }
 
+class C
+{
+    static
+    {
+        foo();
+    }
+}
+
 if (foo) {
   bar();
 } else {
@@ -211,6 +239,12 @@ catch(e) {
   handleError();
 }
 
+class C {
+    static {
+        foo();
+    }
+}
+
 // when there are no braces, there are no problems
 if (foo) bar();
 else if (baz) boom();
@@ -230,6 +264,12 @@ else { baz(); }
 
 try { somethingRisky(); }
 catch(e) { handleError(); }
+
+class C {
+    static { foo(); }
+}
+
+class D { static { foo(); } }
 ```
 
 ### allman
@@ -255,6 +295,12 @@ try
   handleError();
 }
 
+class C {
+    static {
+        foo();
+    }
+}
+
 if (foo) {
   bar();
 } else {
@@ -295,6 +341,14 @@ catch(e)
   handleError();
 }
 
+class C
+{
+    static
+    {
+        foo();
+    }
+}
+
 // when there are no braces, there are no problems
 if (foo) bar();
 else if (baz) boom();
@@ -314,6 +368,16 @@ else { baz(); }
 
 try { somethingRisky(); }
 catch(e) { handleError(); }
+
+class C
+{
+    static { foo(); }
+
+    static
+    { foo(); }
+}
+
+class D { static { foo(); } }
 ```
 
 ## When Not To Use It
diff --git a/docs/rules/complexity.md b/docs/rules/complexity.md
index f6413d6c5..7955d1a28 100644
--- a/docs/rules/complexity.md
+++ b/docs/rules/complexity.md
@@ -57,7 +57,7 @@ function b() {
 }
 ```
 
-Class field initializers are implicit functions. Therefore, their complexity is calculated separately for each initializer, and it doesn't contribute to the complexity of the enclosing code.
+Class field initializers and class static blocks are implicit functions. Therefore, their complexity is calculated separately for each initializer and each static block, and it doesn't contribute to the complexity of the enclosing code.
 
 Examples of additional **incorrect** code for a maximum of 2:
 
@@ -67,6 +67,14 @@ Examples of additional **incorrect** code for a maximum of 2:
 class C {
     x = a || b || c; // this initializer has complexity = 3
 }
+
+class D { // this static block has complexity = 3
+    static {
+        if (foo) {
+            bar = baz || qux;
+        }
+    }
+}
 ```
 
 Examples of additional **correct** code for a maximum of 2:
@@ -82,6 +90,16 @@ function foo() { // this function has complexity = 1
 
         static p = g || h; // this initializer has complexity = 2
         static q = i ? j : k; // this initializer has complexity = 2
+
+        static { // this static block has complexity = 2
+            if (foo) {
+                baz = bar;
+            }
+        }
+
+        static { // this static block has complexity = 2
+            qux = baz || quux;
+        }
     }
 }
 ```
diff --git a/docs/rules/indent.md b/docs/rules/indent.md
index 2a626604e..74fb0e7e2 100644
--- a/docs/rules/indent.md
+++ b/docs/rules/indent.md
@@ -79,6 +79,8 @@ This rule has an object option:
 * `"FunctionExpression"` takes an object to define rules for function expressions.
     * `parameters` (default: 1) enforces indentation level for parameters in a function expression. This can either be a number indicating indentation level, or the string `"first"` indicating that all parameters of the expression must be aligned with the first parameter. This can also be set to `"off"` to disable checking for FunctionExpression parameters.
     * `body` (default: 1) enforces indentation level for the body of a function expression.
+* `"StaticBlock"` takes an object to define rules for class static blocks.
+    * `body` (default: 1) enforces indentation level for the body of a class static block.
 * `"CallExpression"` takes an object to define rules for function call expressions.
     * `arguments` (default: 1) enforces indentation level for arguments in a call expression. This can either be a number indicating indentation level, or the string `"first"` indicating that all arguments of the expression must be aligned with the first argument. This can also be set to `"off"` to disable checking for CallExpression arguments.
 * `"ArrayExpression"` (default: 1) enforces indentation level for elements in arrays. It can also be set to the string `"first"`, indicating that all the elements in the array should be aligned with the first element. This can also be set to `"off"` to disable checking for array elements.
@@ -484,6 +486,56 @@ var foo = function(bar, baz,
 }
 ```
 
+### StaticBlock
+
+Examples of **incorrect** code for this rule with the `2, { "StaticBlock": {"body": 1} }` option:
+
+```js
+/*eslint indent: ["error", 2, { "StaticBlock": {"body": 1} }]*/
+
+class C {
+  static {
+      foo();
+  }
+}
+```
+
+Examples of **correct** code for this rule with the `2, { "StaticBlock": {"body": 1} }` option:
+
+```js
+/*eslint indent: ["error", 2, { "StaticBlock": {"body": 1} }]*/
+
+class C {
+  static {
+    foo();
+  }
+}
+```
+
+Examples of **incorrect** code for this rule with the `2, { "StaticBlock": {"body": 2} }` option:
+
+```js
+/*eslint indent: ["error", 2, { "StaticBlock": {"body": 2} }]*/
+
+class C {
+  static {
+    foo();
+  }
+}
+```
+
+Examples of **correct** code for this rule with the `2, { "StaticBlock": {"body": 2} }` option:
+
+```js
+/*eslint indent: ["error", 2, { "StaticBlock": {"body": 2} }]*/
+
+class C {
+  static {
+      foo();
+  }
+}
+```
+
 ### CallExpression
 
 Examples of **incorrect** code for this rule with the `2, { "CallExpression": {"arguments": 1} }` option:
diff --git a/docs/rules/lines-around-comment.md b/docs/rules/lines-around-comment.md
index ae543bd83..fb0161102 100644
--- a/docs/rules/lines-around-comment.md
+++ b/docs/rules/lines-around-comment.md
@@ -15,8 +15,8 @@ This rule has an object option:
 * `"afterBlockComment": true` requires an empty line after block comments
 * `"beforeLineComment": true` requires an empty line before line comments
 * `"afterLineComment": true` requires an empty line after line comments
-* `"allowBlockStart": true` allows comments to appear at the start of block statements
-* `"allowBlockEnd": true` allows comments to appear at the end of block statements
+* `"allowBlockStart": true` allows comments to appear at the start of block statements, function bodies, classes, and class static blocks
+* `"allowBlockEnd": true` allows comments to appear at the end of block statements, function bodies, classes, and class static blocks
 * `"allowObjectStart": true` allows comments to appear at the start of object literals
 * `"allowObjectEnd": true` allows comments to appear at the end of object literals
 * `"allowArrayStart": true` allows comments to appear at the start of array literals
@@ -133,6 +133,25 @@ function foo(){
     var day = "great"
     return day;
 }
+
+if (bar) {
+    // what a great and wonderful day
+    foo();
+}
+
+class C {
+    // what a great and wonderful day
+
+    method() {
+        // what a great and wonderful day
+        foo();
+    }
+
+    static {
+        // what a great and wonderful day
+        foo();
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the `{ "beforeBlockComment": true, "allowBlockStart": true }` options:
@@ -145,6 +164,25 @@ function foo(){
     var day = "great"
     return day;
 }
+
+if (bar) {
+    /* what a great and wonderful day */
+    foo();
+}
+
+class C {
+    /* what a great and wonderful day */
+
+    method() {
+        /* what a great and wonderful day */
+        foo();
+    }
+
+    static {
+        /* what a great and wonderful day */
+        foo();
+    }
+}
 ```
 
 ### allowBlockEnd
@@ -159,6 +197,26 @@ function foo(){
     return day;
     // what a great and wonderful day
 }
+
+if (bar) {
+    foo();
+    // what a great and wonderful day
+}
+
+class C {
+
+    method() {
+        foo();
+        // what a great and wonderful day
+    }
+
+    static {
+        foo();
+        // what a great and wonderful day
+    }
+
+    // what a great and wonderful day
+}
 ```
 
 Examples of **correct** code for this rule with the `{ "afterBlockComment": true, "allowBlockEnd": true }` option:
@@ -172,6 +230,29 @@ function foo(){
 
     /* what a great and wonderful day */
 }
+
+if (bar) {
+    foo();
+
+    /* what a great and wonderful day */
+}
+
+class C {
+
+    method() {
+        foo();
+
+        /* what a great and wonderful day */
+    }
+
+    static {
+        foo();
+
+        /* what a great and wonderful day */
+    }
+
+    /* what a great and wonderful day */
+}
 ```
 
 ### allowClassStart
diff --git a/docs/rules/max-statements.md b/docs/rules/max-statements.md
index 6ef87c2f8..c2a673310 100644
--- a/docs/rules/max-statements.md
+++ b/docs/rules/max-statements.md
@@ -112,6 +112,30 @@ let foo = () => {
 }
 ```
 
+Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
+
+Examples of **correct** code for this rule with `{ "max": 2 }` option:
+
+```js
+/*eslint max-statements: ["error", 2]*/
+
+function foo() {
+    let one;
+    let two = class {
+        static {
+            let three;
+            let four;
+            let five;
+            if (six) {
+                let seven;
+                let eight;
+                let nine;
+            }
+        }
+    };
+}
+```
+
 ### ignoreTopLevelFunctions
 
 Examples of additional **correct** code for this rule with the `{ "max": 10 }, { "ignoreTopLevelFunctions": true }` options:
diff --git a/docs/rules/padded-blocks.md b/docs/rules/padded-blocks.md
index d8b855ed3..85c0a8b9c 100644
--- a/docs/rules/padded-blocks.md
+++ b/docs/rules/padded-blocks.md
@@ -27,12 +27,12 @@ The second one is an object option, it can allow exceptions.
 
 String option:
 
-* `"always"` (default) requires empty lines at the beginning and ending of block statements and classes
-* `"never"` disallows empty lines at the beginning and ending of block statements and classes
+* `"always"` (default) requires empty lines at the beginning and ending of block statements, function bodies, class static blocks, classes, and `switch` statements.
+* `"never"` disallows empty lines at the beginning and ending of block statements, function bodies, class static blocks, classes, and `switch` statements.
 
 Object option:
 
-* `"blocks"` require or disallow padding within block statements
+* `"blocks"` require or disallow padding within block statements, function bodies, and class static blocks
 * `"classes"` require or disallow padding within classes
 * `"switches"` require or disallow padding within `switch` statements
 
@@ -68,6 +68,12 @@ if (a) {
     b();
 
 }
+
+class C {
+    static {
+        a();
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the default `"always"` option:
@@ -93,6 +99,16 @@ if (a) {
     // comment
     b();
 
+}
+
+class C {
+
+    static {
+
+        a();
+
+    }
+
 }
 ```
 
@@ -124,6 +140,16 @@ if (a) {
 if (a) {
     b();
 
+}
+
+class C {
+
+    static {
+
+        a();
+
+    }
+
 }
 ```
 
@@ -140,6 +166,12 @@ if (a)
 {
     b();
 }
+
+class C {
+    static {
+        a();
+    }
+}
 ```
 
 ### blocks
@@ -174,6 +206,14 @@ if (a) {
     // comment
     b();
 
+}
+
+class C {
+
+    static {
+        a();
+    }
+
 }
 ```
 
@@ -200,6 +240,25 @@ if (a) {
     // comment
     b();
 
+}
+
+class C {
+
+    static {
+
+        a();
+
+    }
+
+}
+
+class D {
+    static {
+
+        a();
+
+    }
+
 }
 ```
 
@@ -230,6 +289,14 @@ if (a) {
     b();
 
 }
+
+class C {
+    static {
+
+        a();
+
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the `{ "blocks": "never" }` option:
@@ -245,6 +312,20 @@ if (a)
 {
     b();
 }
+
+class C {
+    static {
+        a();
+    }
+}
+
+class D {
+
+    static {
+        a();
+    }
+
+}
 ```
 
 ### classes
diff --git a/docs/rules/prefer-const.md b/docs/rules/prefer-const.md
index 3e5a5d0c3..3cdba9e4d 100644
--- a/docs/rules/prefer-const.md
+++ b/docs/rules/prefer-const.md
@@ -12,7 +12,6 @@ Examples of **incorrect** code for this rule:
 
 ```js
 /*eslint prefer-const: "error"*/
-/*eslint-env es6*/
 
 // it's initialized and never reassigned.
 let a = 3;
@@ -22,6 +21,14 @@ let a;
 a = 0;
 console.log(a);
 
+class C {
+    static {
+        let a;
+        a = 0;
+        console.log(a);
+    }
+}
+
 // `i` is redefined (not reassigned) on each loop step.
 for (let i in [1, 2, 3]) {
     console.log(i);
@@ -37,7 +44,6 @@ Examples of **correct** code for this rule:
 
 ```js
 /*eslint prefer-const: "error"*/
-/*eslint-env es6*/
 
 // using const.
 const a = 0;
@@ -59,6 +65,15 @@ if (true) {
 }
 console.log(a);
 
+// it's initialized in a different scope.
+let a;
+class C {
+    #x;
+    static {
+        a = obj => obj.#x;
+    }
+}
+
 // it's initialized at a place that we cannot write a variable declaration.
 let a;
 if (true) a = 0;
diff --git a/lib/rules/brace-style.js b/lib/rules/brace-style.js
index 60aa53269..89f9ba559 100644
--- a/lib/rules/brace-style.js
+++ b/lib/rules/brace-style.js
@@ -155,6 +155,12 @@ module.exports = {
                     validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node));
                 }
             },
+            StaticBlock(node) {
+                validateCurlyPair(
+                    sourceCode.getFirstToken(node, { skip: 1 }), // skip the `static` token
+                    sourceCode.getLastToken(node)
+                );
+            },
             ClassBody(node) {
                 validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node));
             },
diff --git a/lib/rules/complexity.js b/lib/rules/complexity.js
index b833aafc0..a24703976 100644
--- a/lib/rules/complexity.js
+++ b/lib/rules/complexity.js
@@ -124,20 +124,28 @@ module.exports = {
 
                 /*
                  * This rule only evaluates complexity of functions, so "program" is excluded.
-                 * Class field initializers are implicit functions. Therefore, they shouldn't contribute
-                 * to the enclosing function's complexity, but their own complexity should be evaluated.
+                 * Class field initializers and class static blocks are implicit functions. Therefore,
+                 * they shouldn't contribute to the enclosing function's complexity, but their
+                 * own complexity should be evaluated.
                  */
                 if (
                     codePath.origin !== "function" &&
-                    codePath.origin !== "class-field-initializer"
+                    codePath.origin !== "class-field-initializer" &&
+                    codePath.origin !== "class-static-block"
                 ) {
                     return;
                 }
 
                 if (complexity > THRESHOLD) {
-                    const name = codePath.origin === "class-field-initializer"
-                        ? "class field initializer"
-                        : astUtils.getFunctionNameWithKind(node);
+                    let name;
+
+                    if (codePath.origin === "class-field-initializer") {
+                        name = "class field initializer";
+                    } else if (codePath.origin === "class-static-block") {
+                        name = "class static block";
+                    } else {
+                        name = astUtils.getFunctionNameWithKind(node);
+                    }
 
                     context.report({
                         node,
diff --git a/lib/rules/indent.js b/lib/rules/indent.js
index 7b17e3e54..f4dbfff27 100644
--- a/lib/rules/indent.js
+++ b/lib/rules/indent.js
@@ -68,6 +68,7 @@ const KNOWN_NODES = new Set([
     "ReturnStatement",
     "SequenceExpression",
     "SpreadElement",
+    "StaticBlock",
     "Super",
     "SwitchCase",
     "SwitchStatement",
@@ -583,6 +584,16 @@ module.exports = {
                         },
                         additionalProperties: false
                     },
+                    StaticBlock: {
+                        type: "object",
+                        properties: {
+                            body: {
+                                type: "integer",
+                                minimum: 0
+                            }
+                        },
+                        additionalProperties: false
+                    },
                     CallExpression: {
                         type: "object",
                         properties: {
@@ -646,6 +657,9 @@ module.exports = {
                 parameters: DEFAULT_PARAMETER_INDENT,
                 body: DEFAULT_FUNCTION_BODY_INDENT
             },
+            StaticBlock: {
+                body: DEFAULT_FUNCTION_BODY_INDENT
+            },
             CallExpression: {
                 arguments: DEFAULT_PARAMETER_INDENT
             },
@@ -1397,6 +1411,13 @@ module.exports = {
                 }
             },
 
+            StaticBlock(node) {
+                const openingCurly = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+                const closingCurly = sourceCode.getLastToken(node);
+
+                addElementListIndent(node.body, openingCurly, closingCurly, options.StaticBlock.body);
+            },
+
             SwitchStatement(node) {
                 const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken);
                 const closingCurly = sourceCode.getLastToken(node);
diff --git a/lib/rules/lines-around-comment.js b/lib/rules/lines-around-comment.js
index 79bcbb7fc..513d19622 100644
--- a/lib/rules/lines-around-comment.js
+++ b/lib/rules/lines-around-comment.js
@@ -185,10 +185,39 @@ module.exports = {
         /**
          * Returns the parent node that contains the given token.
          * @param {token} token The token to check.
-         * @returns {ASTNode} The parent node that contains the given token.
+         * @returns {ASTNode|null} The parent node that contains the given token.
          */
         function getParentNodeOfToken(token) {
-            return sourceCode.getNodeByRangeIndex(token.range[0]);
+            const node = sourceCode.getNodeByRangeIndex(token.range[0]);
+
+            /*
+             * For the purpose of this rule, the comment token is in a `StaticBlock` node only
+             * if it's inside the braces of that `StaticBlock` node.
+             *
+             * Example where this function returns `null`:
+             *
+             *   static
+             *   // comment
+             *   {
+             *   }
+             *
+             * Example where this function returns `StaticBlock` node:
+             *
+             *   static
+             *   {
+             *   // comment
+             *   }
+             *
+             */
+            if (node && node.type === "StaticBlock") {
+                const openingBrace = sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+
+                return token.range[0] >= openingBrace.range[0]
+                    ? node
+                    : null;
+            }
+
+            return node;
         }
 
         /**
@@ -200,8 +229,15 @@ module.exports = {
         function isCommentAtParentStart(token, nodeType) {
             const parent = getParentNodeOfToken(token);
 
-            return parent && isParentNodeType(parent, nodeType) &&
-                    token.loc.start.line - parent.loc.start.line === 1;
+            if (parent && isParentNodeType(parent, nodeType)) {
+                const parentStartNodeOrToken = parent.type === "StaticBlock"
+                    ? sourceCode.getFirstToken(parent, { skip: 1 }) // opening brace of the static block
+                    : parent;
+
+                return token.loc.start.line - parentStartNodeOrToken.loc.start.line === 1;
+            }
+
+            return false;
         }
 
         /**
@@ -213,7 +249,7 @@ module.exports = {
         function isCommentAtParentEnd(token, nodeType) {
             const parent = getParentNodeOfToken(token);
 
-            return parent && isParentNodeType(parent, nodeType) &&
+            return !!parent && isParentNodeType(parent, nodeType) &&
                     parent.loc.end.line - token.loc.end.line === 1;
         }
 
@@ -223,7 +259,12 @@ module.exports = {
          * @returns {boolean} True if the comment is at block start.
          */
         function isCommentAtBlockStart(token) {
-            return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase");
+            return (
+                isCommentAtParentStart(token, "ClassBody") ||
+                isCommentAtParentStart(token, "BlockStatement") ||
+                isCommentAtParentStart(token, "StaticBlock") ||
+                isCommentAtParentStart(token, "SwitchCase")
+            );
         }
 
         /**
@@ -232,7 +273,13 @@ module.exports = {
          * @returns {boolean} True if the comment is at block end.
          */
         function isCommentAtBlockEnd(token) {
-            return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement");
+            return (
+                isCommentAtParentEnd(token, "ClassBody") ||
+                isCommentAtParentEnd(token, "BlockStatement") ||
+                isCommentAtParentEnd(token, "StaticBlock") ||
+                isCommentAtParentEnd(token, "SwitchCase") ||
+                isCommentAtParentEnd(token, "SwitchStatement")
+            );
         }
 
         /**
diff --git a/lib/rules/max-statements.js b/lib/rules/max-statements.js
index 6f48c9218..969e40bbd 100644
--- a/lib/rules/max-statements.js
+++ b/lib/rules/max-statements.js
@@ -123,6 +123,14 @@ module.exports = {
         function endFunction(node) {
             const count = functionStack.pop();
 
+            /*
+             * This rule does not apply to class static blocks, but we have to track them so
+             * that stataments in them do not count as statements in the enclosing function.
+             */
+            if (node.type === "StaticBlock") {
+                return;
+            }
+
             if (ignoreTopLevelFunctions && functionStack.length === 0) {
                 topLevelFunctions.push({ node, count });
             } else {
@@ -148,12 +156,14 @@ module.exports = {
             FunctionDeclaration: startFunction,
             FunctionExpression: startFunction,
             ArrowFunctionExpression: startFunction,
+            StaticBlock: startFunction,
 
             BlockStatement: countStatements,
 
             "FunctionDeclaration:exit": endFunction,
             "FunctionExpression:exit": endFunction,
             "ArrowFunctionExpression:exit": endFunction,
+            "StaticBlock:exit": endFunction,
 
             "Program:exit"() {
                 if (topLevelFunctions.length === 1) {
diff --git a/lib/rules/padded-blocks.js b/lib/rules/padded-blocks.js
index ca83f11fc..de75e8d2d 100644
--- a/lib/rules/padded-blocks.js
+++ b/lib/rules/padded-blocks.js
@@ -106,6 +106,12 @@ module.exports = {
             if (node.type === "SwitchStatement") {
                 return sourceCode.getTokenBefore(node.cases[0]);
             }
+
+            if (node.type === "StaticBlock") {
+                return sourceCode.getFirstToken(node, { skip: 1 }); // skip the `static` token
+            }
+
+            // `BlockStatement` or `ClassBody`
             return sourceCode.getFirstToken(node);
         }
 
@@ -172,6 +178,7 @@ module.exports = {
         function requirePaddingFor(node) {
             switch (node.type) {
                 case "BlockStatement":
+                case "StaticBlock":
                     return options.blocks;
                 case "SwitchStatement":
                     return options.switches;
@@ -282,6 +289,7 @@ module.exports = {
                 }
                 checkPadding(node);
             };
+            rule.StaticBlock = rule.BlockStatement;
         }
 
         if (Object.prototype.hasOwnProperty.call(options, "classes")) {
diff --git a/lib/rules/prefer-const.js b/lib/rules/prefer-const.js
index b44bd7592..38ec973fc 100644
--- a/lib/rules/prefer-const.js
+++ b/lib/rules/prefer-const.js
@@ -17,7 +17,7 @@ const astUtils = require("./utils/ast-utils");
 //------------------------------------------------------------------------------
 
 const PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u;
-const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|SwitchCase)$/u;
+const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u;
 const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u;
 
 /**


Test patch:
diff --git a/tests/lib/rules/brace-style.js b/tests/lib/rules/brace-style.js
index 70211608b..9629f42fc 100644
--- a/tests/lib/rules/brace-style.js
+++ b/tests/lib/rules/brace-style.js
@@ -10,7 +10,8 @@
 //------------------------------------------------------------------------------
 
 const rule = require("../../../lib/rules/brace-style"),
-    { RuleTester } = require("../../../lib/rule-tester");
+    { RuleTester } = require("../../../lib/rule-tester"),
+    { unIndent } = require("../../_utils");
 
 //------------------------------------------------------------------------------
 // Tests
@@ -204,7 +205,125 @@ ruleTester.run("brace-style", rule, {
         `
           if (foo) bar = function() {}
           else baz()
-        `
+        `,
+
+        // class static blocks
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo;
+                    }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {}
+
+                    static {
+                    }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static { foo; }
+                }
+            `,
+            options: ["1tbs", { allowSingleLine: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo;
+                    }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {}
+
+                    static {
+                    }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static { foo; }
+                }
+            `,
+            options: ["stroustrup", { allowSingleLine: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static
+                    {
+                        foo;
+                    }
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static
+                    {}
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static {}
+
+                    static { foo; }
+
+                    static
+                    { foo; }
+                }
+            `,
+            options: ["allman", { allowSingleLine: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        {
+                            foo;
+                        }
+                    }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 }
+        }
     ],
 
     invalid: [
@@ -664,6 +783,334 @@ ruleTester.run("brace-style", rule, {
                 { messageId: "nextLineOpen", type: "Punctuator" },
                 { messageId: "nextLineClose", type: "Punctuator" }
             ]
+        },
+
+        /*
+         * class static blocks
+         *
+         * Note about the autofix: this rule only inserts linebreaks and removes linebreaks.
+         * It does not aim to produce code with a valid indentation. Indentation and other formatting issues
+         * are expected to be fixed by `indent` and other rules in subsequent iterations.
+         */
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo;
+                    }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                foo;
+                    }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "blockSameLine", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo;}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo;
+                }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {foo;}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                foo;
+                }
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" },
+                { messageId: "blockSameLine", type: "Punctuator" },
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {}
+                }
+            `,
+            options: ["1tbs"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo;
+                    }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                foo;
+                    }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "blockSameLine", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo;}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo;
+                }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {foo;}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                foo;
+                }
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" },
+                { messageId: "blockSameLine", type: "Punctuator" },
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {}
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {}
+                }
+            `,
+            options: ["stroustrup"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "nextLineOpen", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static{
+                        foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C
+                {
+                    static
+                {
+                        foo;
+                    }
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "sameLineOpen", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static
+                    {foo;
+                    }
+                }
+            `,
+            output: unIndent`
+                class C
+                {
+                    static
+                    {
+                foo;
+                    }
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "blockSameLine", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static
+                    {
+                        foo;}
+                }
+            `,
+            output: unIndent`
+                class C
+                {
+                    static
+                    {
+                        foo;
+                }
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static{foo;}
+                }
+            `,
+            output: unIndent`
+                class C
+                {
+                    static
+                {
+                foo;
+                }
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "sameLineOpen", type: "Punctuator" },
+                { messageId: "blockSameLine", type: "Punctuator" },
+                { messageId: "singleLineClose", type: "Punctuator" }
+            ]
+        },
+        {
+            code: unIndent`
+                class C
+                {
+                    static{}
+                }
+            `,
+            output: unIndent`
+                class C
+                {
+                    static
+                {}
+                }
+            `,
+            options: ["allman"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "sameLineOpen", type: "Punctuator" }
+            ]
         }
     ]
 });
diff --git a/tests/lib/rules/complexity.js b/tests/lib/rules/complexity.js
index badde8a71..d6feb8a2f 100644
--- a/tests/lib/rules/complexity.js
+++ b/tests/lib/rules/complexity.js
@@ -104,6 +104,25 @@ ruleTester.run("complexity", rule, {
         { code: "class C { x = a || class { y = b || c; z = d || e; }; }", options: [2], parserOptions: { ecmaVersion: 2022 } },
         { code: "class C { x; y = a; static z; static q = b; }", options: [1], parserOptions: { ecmaVersion: 2022 } },
 
+        // class static blocks
+        { code: "function foo() { class C { static { a || b; } static { c || d; } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "function foo() { a || b; class C { static { c || d; } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "function foo() { class C { static { a || b; } } c || d; }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "function foo() { class C { static { a || b; } } class D { static { c || d; } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; } static { c || d; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; } static { c || d; } static { e || f; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { () => a || b; c || d; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; () => c || d; } static { c || d; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a } }", options: [1], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a } static { b } }", options: [1], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; } } class D { static { c || d; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; } static c = d || e; }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static a = b || c; static { c || d; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; } c = d || e; }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { a = b || c; static { d || e; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { a || b; c || d; } }", options: [3], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { if (a || b) c = d || e; } }", options: [4], parserOptions: { ecmaVersion: 2022 } },
+
         // object property options
         { code: "function b(x) {}", options: [{ max: 1 }] }
     ],
@@ -369,6 +388,139 @@ ruleTester.run("complexity", rule, {
             ]
         },
 
+        // class static blocks
+        {
+            code: "function foo () { a || b; class C { static {} } c || d; }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Function 'foo'", 3, 2)]
+        },
+        {
+            code: "function foo () { a || b; class C { static { c || d; } } e || f; }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Function 'foo'", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; }  }",
+            options: [1],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 2, 1)]
+        },
+        {
+            code: "class C { static { a || b || c; }  }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; c || d; }  }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; c || d; e || f; }  }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 4, 3)]
+        },
+        {
+            code: "class C { static { a || b; c || d; { e || f; } }  }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 4, 3)]
+        },
+        {
+            code: "class C { static { if (a || b) c = d || e; } }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 4, 3)]
+        },
+        {
+            code: "class C { static { if (a || b) c = (d => e || f)() || (g => h || i)(); } }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 4, 3)]
+        },
+        {
+            code: "class C { x(){ a || b; } static { c || d || e; } z() { f || g; } }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 3, 2)]
+        },
+        {
+            code: "class C { x = a || b; static { c || d || e; } y = f || g; }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 3, 2)]
+        },
+        {
+            code: "class C { static x = a || b; static { c || d || e; } static y = f || g; }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Class static block", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; } static(){ c || d || e; } static { f || g; } }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Method 'static'", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; } static static(){ c || d || e; } static { f || g; } }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [makeError("Static method 'static'", 3, 2)]
+        },
+        {
+            code: "class C { static { a || b; } static x = c || d || e; static { f || g; } }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                ...makeError("Class field initializer", 3, 2),
+                column: 41,
+                endColumn: 52
+            }]
+        },
+        {
+            code: "class C { static { a || b || c || d; } static { e || f || g; } }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                ...makeError("Class static block", 4, 3),
+                column: 11,
+                endColumn: 39
+            }]
+        },
+        {
+            code: "class C { static { a || b || c; } static { d || e || f || g; } }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                ...makeError("Class static block", 4, 3),
+                column: 35,
+                endColumn: 63
+            }]
+        },
+        {
+            code: "class C { static { a || b || c || d; } static { e || f || g || h; } }",
+            options: [3],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                {
+                    ...makeError("Class static block", 4, 3),
+                    column: 11,
+                    endColumn: 39
+                },
+                {
+                    ...makeError("Class static block", 4, 3),
+                    column: 40,
+                    endColumn: 68
+                }
+            ]
+        },
+
         // object property options
         { code: "function a(x) {}", options: [{ max: 0 }], errors: [makeError("Function 'a'", 1, 0)] }
     ]
diff --git a/tests/lib/rules/indent.js b/tests/lib/rules/indent.js
index 03086ce13..394767914 100644
--- a/tests/lib/rules/indent.js
+++ b/tests/lib/rules/indent.js
@@ -5847,6 +5847,241 @@ ruleTester.run("indent", rule, {
                                                         ar2){}
             `,
             options: [2, { FunctionDeclaration: { parameters: "first" }, FunctionExpression: { parameters: "first" } }]
+        },
+        {
+            code: unIndent`
+                class C {
+                  static {
+                    foo();
+                    bar();
+                  }
+                }
+            `,
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                            foo();
+                            bar();
+                    }
+                }
+            `,
+            options: [4, { StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                    foo();
+                    bar();
+                    }
+                }
+            `,
+            options: [4, { StaticBlock: { body: 0 } }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                \tstatic {
+                \t\tfoo();
+                \t\tbar();
+                \t}
+                }
+            `,
+            options: ["tab"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                \tstatic {
+                \t\t\tfoo();
+                \t\t\tbar();
+                \t}
+                }
+            `,
+            options: ["tab", { StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        var x,
+                            y;
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        var x,
+                            y;
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        if (foo) {
+                            bar;
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        {
+                            bar;
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {}
+
+                    static {
+                    }
+
+                    static
+                    {
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+
+                    static {
+                        foo;
+                    }
+
+                    static {
+                        bar;
+                    }
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+
+                    x = 1;
+
+                    static {
+                        foo;
+                    }
+
+                    y = 2;
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+
+                    method1(param) {
+                        foo;
+                    }
+
+                    static {
+                        bar;
+                    }
+
+                    method2(param) {
+                        foo;
+                    }
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                function f() {
+                    class C {
+                        static {
+                            foo();
+                            bar();
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    method() {
+                            foo;
+                    }
+                    static {
+                            bar;
+                    }
+                }
+            `,
+            options: [4, { FunctionExpression: { body: 2 }, StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 }
         }
     ],
 
@@ -11814,6 +12049,580 @@ ruleTester.run("indent", rule, {
                 [4, 8, 0, "Keyword"],
                 [5, 4, 0, "Punctuator"]
             ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                  static {
+                    foo();
+                    bar();
+                  }
+                }
+            `,
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 2, 0, "Keyword"],
+                [3, 4, 0, "Identifier"],
+                [4, 4, 0, "Identifier"],
+                [5, 2, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 8, 0, "Identifier"],
+                [4, 8, 0, "Identifier"],
+                [5, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                        static {
+                    foo();
+                bar();
+                        }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 8, "Keyword"],
+                [3, 8, 4, "Identifier"],
+                [4, 8, 0, "Identifier"],
+                [5, 4, 8, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                            foo();
+                            bar();
+                    }
+                }
+            `,
+            options: [4, { StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 12, 0, "Identifier"],
+                [4, 12, 0, "Identifier"],
+                [5, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                    foo();
+                    bar();
+                    }
+                }
+            `,
+            options: [4, { StaticBlock: { body: 0 } }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 4, 0, "Identifier"],
+                [4, 4, 0, "Identifier"],
+                [5, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                \tstatic {
+                \t\tfoo();
+                \t\tbar();
+                \t}
+                }
+            `,
+            options: ["tab"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors("tab", [
+                [2, 1, 0, "Keyword"],
+                [3, 2, 0, "Identifier"],
+                [4, 2, 0, "Identifier"],
+                [5, 1, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                \tstatic {
+                \t\t\tfoo();
+                \t\t\tbar();
+                \t}
+                }
+            `,
+            options: ["tab", { StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors("tab", [
+                [2, 1, 0, "Keyword"],
+                [3, 3, 0, "Identifier"],
+                [4, 3, 0, "Identifier"],
+                [5, 1, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static
+                {
+                foo();
+                bar();
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static
+                    {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 4, 0, "Punctuator"],
+                [4, 8, 0, "Identifier"],
+                [5, 8, 0, "Identifier"],
+                [6, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                        {
+                        foo();
+                        bar();
+                        }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static
+                    {
+                        foo();
+                        bar();
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [3, 4, 8, "Punctuator"],
+                [6, 4, 8, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                var x,
+                y;
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        var x,
+                            y;
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 8, 0, "Keyword"],
+                [4, 12, 0, "Identifier"],
+                [5, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static
+                {
+                var x,
+                y;
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static
+                    {
+                        var x,
+                            y;
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 4, 0, "Punctuator"],
+                [4, 8, 0, "Keyword"],
+                [5, 12, 0, "Identifier"],
+                [6, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                if (foo) {
+                bar;
+                }
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        if (foo) {
+                            bar;
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 8, 0, "Keyword"],
+                [4, 12, 0, "Identifier"],
+                [5, 8, 0, "Punctuator"],
+                [6, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {
+                {
+                bar;
+                }
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {
+                        {
+                            bar;
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 8, 0, "Punctuator"],
+                [4, 12, 0, "Identifier"],
+                [5, 8, 0, "Punctuator"],
+                [6, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                static {}
+
+                static {
+                }
+
+                static
+                {
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    static {}
+
+                    static {
+                    }
+
+                    static
+                    {
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [4, 4, 0, "Keyword"],
+                [5, 4, 0, "Punctuator"],
+                [7, 4, 0, "Keyword"],
+                [8, 4, 0, "Punctuator"],
+                [9, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+
+                static {
+                    foo;
+                }
+
+                static {
+                    bar;
+                }
+
+                }
+            `,
+            output: unIndent`
+                class C {
+
+                    static {
+                        foo;
+                    }
+
+                    static {
+                        bar;
+                    }
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [3, 4, 0, "Keyword"],
+                [4, 8, 4, "Identifier"],
+                [5, 4, 0, "Punctuator"],
+                [7, 4, 0, "Keyword"],
+                [8, 8, 4, "Identifier"],
+                [9, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+
+                x = 1;
+
+                static {
+                    foo;
+                }
+
+                y = 2;
+
+                }
+            `,
+            output: unIndent`
+                class C {
+
+                    x = 1;
+
+                    static {
+                        foo;
+                    }
+
+                    y = 2;
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [3, 4, 0, "Identifier"],
+                [5, 4, 0, "Keyword"],
+                [6, 8, 4, "Identifier"],
+                [7, 4, 0, "Punctuator"],
+                [9, 4, 0, "Identifier"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+
+                method1(param) {
+                    foo;
+                }
+
+                static {
+                    bar;
+                }
+
+                method2(param) {
+                    foo;
+                }
+
+                }
+            `,
+            output: unIndent`
+                class C {
+
+                    method1(param) {
+                        foo;
+                    }
+
+                    static {
+                        bar;
+                    }
+
+                    method2(param) {
+                        foo;
+                    }
+
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [3, 4, 0, "Identifier"],
+                [4, 8, 4, "Identifier"],
+                [5, 4, 0, "Punctuator"],
+                [7, 4, 0, "Keyword"],
+                [8, 8, 4, "Identifier"],
+                [9, 4, 0, "Punctuator"],
+                [11, 4, 0, "Identifier"],
+                [12, 8, 4, "Identifier"],
+                [13, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                function f() {
+                class C {
+                static {
+                foo();
+                bar();
+                }
+                }
+                }
+            `,
+            output: unIndent`
+                function f() {
+                    class C {
+                        static {
+                            foo();
+                            bar();
+                        }
+                    }
+                }
+            `,
+            options: [4],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Keyword"],
+                [3, 8, 0, "Keyword"],
+                [4, 12, 0, "Identifier"],
+                [5, 12, 0, "Identifier"],
+                [6, 8, 0, "Punctuator"],
+                [7, 4, 0, "Punctuator"]
+            ])
+        },
+        {
+            code: unIndent`
+                class C {
+                method() {
+                foo;
+                }
+                static {
+                bar;
+                }
+                }
+            `,
+            output: unIndent`
+                class C {
+                    method() {
+                            foo;
+                    }
+                    static {
+                            bar;
+                    }
+                }
+            `,
+            options: [4, { FunctionExpression: { body: 2 }, StaticBlock: { body: 2 } }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: expectedErrors([
+                [2, 4, 0, "Identifier"],
+                [3, 12, 0, "Identifier"],
+                [4, 4, 0, "Punctuator"],
+                [5, 4, 0, "Keyword"],
+                [6, 12, 0, "Identifier"],
+                [7, 4, 0, "Punctuator"]
+            ])
         }
     ]
 });
diff --git a/tests/lib/rules/lines-around-comment.js b/tests/lib/rules/lines-around-comment.js
index a4fd3dd70..2687f1458 100644
--- a/tests/lib/rules/lines-around-comment.js
+++ b/tests/lib/rules/lines-around-comment.js
@@ -9,7 +9,8 @@
 //------------------------------------------------------------------------------
 
 const rule = require("../../../lib/rules/lines-around-comment"),
-    { RuleTester } = require("../../../lib/rule-tester");
+    { RuleTester } = require("../../../lib/rule-tester"),
+    { unIndent } = require("../../_utils");
 
 //------------------------------------------------------------------------------
 // Tests
@@ -262,6 +263,106 @@ ruleTester.run("lines-around-comment", rule, {
                 allowBlockStart: true
             }]
         },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        // line comment
+                    }
+
+                    static {
+                        // line comment
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeLineComment: true,
+                allowBlockStart: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        // line comment
+                    }
+
+                    static
+                    {
+                        // line comment
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeLineComment: true,
+                allowBlockStart: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        /* block comment */
+                    }
+
+                    static {
+                        /* block
+                           comment */
+                    }
+
+                    static {
+                        /* block comment */
+                        foo();
+                    }
+
+                    static {
+                        /* block
+                           comment */
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                allowBlockStart: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    {
+                        /* block comment */
+                    }
+
+                    static
+                    {
+                        /* block
+                        comment */
+                    }
+
+                    static
+                    {
+                        /* block comment */
+                        foo();
+                    }
+
+                    static
+                    {
+                        /* block
+                        comment */
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                allowBlockStart: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
 
         // check for block end comments
         {
@@ -472,6 +573,54 @@ ruleTester.run("lines-around-comment", rule, {
                 allowBlockEnd: true
             }]
         },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        // line comment
+                    }
+
+                    static {
+                        foo();
+                        // line comment
+                    }
+                }`,
+            options: [{
+                afterLineComment: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        /* block comment */
+                    }
+
+                    static {
+                        /* block
+                           comment */
+                    }
+
+                    static {
+                        foo();
+                        /* block comment */
+                    }
+
+                    static {
+                        foo();
+                        /* block
+                           comment */
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: false, // default is `true`
+                afterBlockComment: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
 
         // check for object start comments
         {
@@ -1049,6 +1198,346 @@ ruleTester.run("lines-around-comment", rule, {
             }],
             errors: [{ messageId: "after", type: "Line", line: 8 }]
         },
+        {
+            code: unIndent`
+                class C {
+                    // line comment
+                    static{}
+                }`,
+            output: unIndent`
+                class C {
+                    // line comment
+
+                    static{}
+                }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "after", type: "Line", line: 2 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    /* block
+                       comment */
+                    static{}
+                }`,
+            output: unIndent`
+                class C {
+                    /* block
+                       comment */
+
+                    static{}
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "after", type: "Block", line: 2 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    // line comment
+                    {}
+                }`,
+            output: unIndent`
+            class C {
+                static
+
+                // line comment
+
+                {}
+            }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Line", line: 3 },
+                { messageId: "after", type: "Line", line: 3 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static
+                    /* block
+                       comment */
+                    {}
+                }`,
+            output: unIndent`
+            class C {
+                static
+
+                /* block
+                   comment */
+
+                {}
+            }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Block", line: 3 },
+                { messageId: "after", type: "Block", line: 3 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        // line comment
+                        foo();
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        // line comment
+
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "after", type: "Line", line: 3 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        /* block
+                           comment */
+                        foo();
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        /* block
+                           comment */
+
+                        foo();
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "after", type: "Block", line: 3 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo();
+                        // line comment
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+
+                        // line comment
+                    }
+                }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Line", line: 4 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo();
+                        /* block
+                           comment */
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+
+                        /* block
+                           comment */
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Block", line: 4 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo();
+                        // line comment
+                        bar();
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+
+                        // line comment
+
+                        bar();
+                    }
+                }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Line", line: 4 },
+                { messageId: "after", type: "Line", line: 4 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static {
+                        foo();
+                        /* block
+                           comment */
+                        bar();
+                    }
+                }`,
+            output: unIndent`
+                class C {
+                    static {
+                        foo();
+
+                        /* block
+                           comment */
+
+                        bar();
+                    }
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Block", line: 4 },
+                { messageId: "after", type: "Block", line: 4 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static{}
+                    // line comment
+                }`,
+            output: unIndent`
+                class C {
+                    static{}
+
+                    // line comment
+                }`,
+            options: [{
+                beforeLineComment: true,
+                afterLineComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Line", line: 3 }
+            ]
+        },
+        {
+            code: unIndent`
+                class C {
+                    static{}
+                    /* block
+                       comment */
+                }`,
+            output: unIndent`
+                class C {
+                    static{}
+
+                    /* block
+                       comment */
+                }`,
+            options: [{
+                beforeBlockComment: true,
+                afterBlockComment: true,
+                allowBlockStart: true,
+                allowBlockEnd: true,
+                allowClassStart: true,
+                allowClassEnd: true
+            }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "before", type: "Block", line: 3 }
+            ]
+        },
 
         // object start comments
         {
diff --git a/tests/lib/rules/max-statements.js b/tests/lib/rules/max-statements.js
index fd939e592..decdd8a56 100644
--- a/tests/lib/rules/max-statements.js
+++ b/tests/lib/rules/max-statements.js
@@ -33,7 +33,33 @@ ruleTester.run("max-statements", rule, {
         { code: "var foo = { thing() { var bar = 1; var baz = 2; } }", options: [2], parserOptions: { ecmaVersion: 6 } },
         { code: "var foo = { ['thing']() { var bar = 1; var baz = 2; } }", options: [2], parserOptions: { ecmaVersion: 6 } },
         { code: "var foo = { thing: () => { var bar = 1; var baz = 2; } }", options: [2], parserOptions: { ecmaVersion: 6 } },
-        { code: "var foo = { thing: function() { var bar = 1; var baz = 2; } }", options: [{ max: 2 }] }
+        { code: "var foo = { thing: function() { var bar = 1; var baz = 2; } }", options: [{ max: 2 }] },
+
+        // this rule does not apply to class static blocks, and statements in them should not count as statements in the enclosing function
+        { code: "class C { static { one; two; three; { four; five; six; } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "function foo() { class C { static { one; two; three; { four; five; six; } } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { one; two; three; function foo() { 1; 2; } four; five; six; } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { { one; two; three; function foo() { 1; 2; } four; five; six; } } }", options: [2], parserOptions: { ecmaVersion: 2022 } },
+        {
+            code: "function top_level() { 1; /* 2 */ class C { static { one; two; three; { four; five; six; } } } 3;}",
+            options: [2, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "function top_level() { 1; 2; } class C { static { one; two; three; { four; five; six; } } }",
+            options: [1, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { one; two; three; { four; five; six; } } } function top_level() { 1; 2; } ",
+            options: [1, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "function foo() { let one; let two = class { static { let three; let four; let five; if (six) { let seven; let eight; let nine; } } }; }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 }
+        }
     ],
     invalid: [
         {
@@ -143,6 +169,30 @@ ruleTester.run("max-statements", rule, {
             code: "function foo() { 1; }",
             options: [{ max: 0 }],
             errors: [{ messageId: "exceed", data: { name: "Function 'foo'", count: 1, max: 0 } }]
+        },
+        {
+            code: "function foo() { foo_1; /* foo_ 2 */ class C { static { one; two; three; four; { five; six; seven; eight; } } } foo_3 }",
+            options: [2],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "exceed", data: { name: "Function 'foo'", count: 3, max: 2 } }]
+        },
+        {
+            code: "class C { static { one; two; three; four; function not_top_level() { 1; 2; 3; } five; six; seven; eight; } }",
+            options: [2, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "exceed", data: { name: "Function 'not_top_level'", count: 3, max: 2 } }]
+        },
+        {
+            code: "class C { static { { one; two; three; four; function not_top_level() { 1; 2; 3; } five; six; seven; eight; } } }",
+            options: [2, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "exceed", data: { name: "Function 'not_top_level'", count: 3, max: 2 } }]
+        },
+        {
+            code: "class C { static { { one; two; three; four; } function not_top_level() { 1; 2; 3; } { five; six; seven; eight; } } }",
+            options: [2, { ignoreTopLevelFunctions: true }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "exceed", data: { name: "Function 'not_top_level'", count: 3, max: 2 } }]
         }
     ]
 });
diff --git a/tests/lib/rules/padded-blocks.js b/tests/lib/rules/padded-blocks.js
index 76cfcda51..3dd0dc97e 100644
--- a/tests/lib/rules/padded-blocks.js
+++ b/tests/lib/rules/padded-blocks.js
@@ -88,7 +88,109 @@ ruleTester.run("padded-blocks", rule, {
 
         // Ignore class statements if not configured
         { code: "class A{\nfoo(){}\n}", options: [{ blocks: "always" }], parserOptions: { ecmaVersion: 6 } },
-        { code: "class A{\n\nfoo(){}\n\n}", options: [{ blocks: "never" }], parserOptions: { ecmaVersion: 6 } }
+        { code: "class A{\n\nfoo(){}\n\n}", options: [{ blocks: "never" }], parserOptions: { ecmaVersion: 6 } },
+
+        // class static blocks
+        {
+            code: "class C {\n\n static {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {// comment\n\nfoo;\n\n/* comment */} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {\n\n// comment\nfoo;\n// comment\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {\n\n// comment\n\nfoo;\n\n// comment\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static { foo; } \n\n}",
+            options: ["always", { allowSingleLineBlocks: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static\n { foo; } \n\n}",
+            options: ["always", { allowSingleLineBlocks: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {} static {\n} static {\n\n} \n\n}", // empty blocks are ignored
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static\n\n { foo; } \n\n}",
+            options: ["always", { allowSingleLineBlocks: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n\nfoo;\n\n} \n}",
+            options: [{ blocks: "always", classes: "never" }], // "blocks" applies to static blocks
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {foo;} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static\n {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static\n\n {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static\n\n {foo;} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {// comment\nfoo;\n/* comment */} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n// comment\nfoo;\n// comment\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {} static {\n} static {\n\n} \n}", // empty blocks are ignored
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {\nfoo;\n} \n\n}",
+            options: [{ blocks: "never", classes: "always" }], // "blocks" applies to static blocks
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n\n static {\nfoo;\n} static {\n\nfoo;\n\n} \n\n}",
+            options: [{ classes: "always" }], // if there's no "blocks" in the object option, static blocks are ignored
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\nfoo;\n} static {\n\nfoo;\n\n} \n}",
+            options: [{ classes: "never" }], // if there's no "blocks" in the object option, static blocks are ignored
+            parserOptions: { ecmaVersion: 2022 }
+        }
 
     ],
     invalid: [
@@ -764,6 +866,164 @@ ruleTester.run("padded-blocks", rule, {
             options: ["never"],
             parserOptions: { ecmaVersion: 2022 },
             errors: [{ messageId: "neverPadBlock" }, { messageId: "neverPadBlock" }]
+        },
+
+        // class static blocks
+        {
+            code: "class C {\n\n static {\nfoo;\n\n} \n\n}",
+            output: "class C {\n\n static {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "alwaysPadBlock" }]
+        },
+        {
+            code: "class C {\n\n static\n {\nfoo;\n\n} \n\n}",
+            output: "class C {\n\n static\n {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "alwaysPadBlock" }]
+        },
+        {
+            code: "class C {\n\n static\n\n {\nfoo;\n\n} \n\n}",
+            output: "class C {\n\n static\n\n {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "alwaysPadBlock" }]
+        },
+        {
+            code: "class C {\n\n static {\n\nfoo;\n} \n\n}",
+            output: "class C {\n\n static {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "alwaysPadBlock" }]
+        },
+        {
+            code: "class C {\n\n static {foo;} \n\n}",
+            output: "class C {\n\n static {\nfoo;\n} \n\n}", // this is still not padded, the subsequent fix below will add another pair of `\n`.
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n\n static {\nfoo;\n} \n\n}",
+            output: "class C {\n\n static {\n\nfoo;\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n\n static {// comment\nfoo;\n/* comment */} \n\n}",
+            output: "class C {\n\n static {// comment\n\nfoo;\n\n/* comment */} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n\n static {\n// comment\nfoo;\n// comment\n} \n\n}",
+            output: "class C {\n\n static {\n\n// comment\nfoo;\n// comment\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n\n static {\n// comment\n\nfoo;\n\n// comment\n} \n\n}",
+            output: "class C {\n\n static {\n\n// comment\n\nfoo;\n\n// comment\n\n} \n\n}",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n static {\nfoo;\n} \n}",
+            output: "class C {\n static {\n\nfoo;\n\n} \n}",
+            options: [{ blocks: "always", classes: "never" }], // "blocks" applies to static blocks
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "alwaysPadBlock" },
+                { messageId: "alwaysPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n static {\n\nfoo;\n} \n}",
+            output: "class C {\n static {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "neverPadBlock" }]
+        },
+        {
+            code: "class C {\n static\n {\n\nfoo;\n} \n}",
+            output: "class C {\n static\n {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "neverPadBlock" }]
+        },
+        {
+            code: "class C {\n static\n\n {\n\nfoo;\n} \n}",
+            output: "class C {\n static\n\n {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "neverPadBlock" }]
+        },
+        {
+            code: "class C {\n static {\nfoo;\n\n} \n}",
+            output: "class C {\n static {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "neverPadBlock" }]
+        },
+        {
+            code: "class C {\n static {\n\nfoo;\n\n} \n}",
+            output: "class C {\n static {\nfoo;\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "neverPadBlock" },
+                { messageId: "neverPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n static {// comment\n\nfoo;\n\n/* comment */} \n}",
+            output: "class C {\n static {// comment\nfoo;\n/* comment */} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "neverPadBlock" },
+                { messageId: "neverPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n static {\n\n// comment\nfoo;\n// comment\n\n} \n}",
+            output: "class C {\n static {\n// comment\nfoo;\n// comment\n} \n}",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "neverPadBlock" },
+                { messageId: "neverPadBlock" }
+            ]
+        },
+        {
+            code: "class C {\n\n static {\n\nfoo;\n\n} \n\n}",
+            output: "class C {\n\n static {\nfoo;\n} \n\n}",
+            options: [{ blocks: "never", classes: "always" }], // "blocks" applies to static blocks
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "neverPadBlock" },
+                { messageId: "neverPadBlock" }
+            ]
         }
     ]
 });
diff --git a/tests/lib/rules/prefer-const.js b/tests/lib/rules/prefer-const.js
index c591d2365..0a44b0bd0 100644
--- a/tests/lib/rules/prefer-const.js
+++ b/tests/lib/rules/prefer-const.js
@@ -173,7 +173,56 @@ ruleTester.run("prefer-const", rule, {
 
         // https://github.com/eslint/eslint/issues/10520
         "const x = [1,2]; let y; [,y] = x; y = 0;",
-        "const x = [1,2,3]; let y, z; [y,,z] = x; y = 0; z = 0;"
+        "const x = [1,2,3]; let y, z; [y,,z] = x; y = 0; z = 0;",
+
+        {
+            code: "class C { static { let a = 1; a = 2; } }",
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; a = 1; a = 2; } }",
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "let a; class C { static { a = 1; } }",
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; if (foo) { a = 1; } } }",
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; if (foo) a = 1; } }",
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a, b; if (foo) { ({ a, b } = foo); } } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" },
+                { messageId: "useConst", data: { name: "b" }, type: "Identifier" }
+            ]
+        },
+        {
+            code: "class C { static { let a, b; if (foo) ({ a, b } = foo); } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" },
+                { messageId: "useConst", data: { name: "b" }, type: "Identifier" }
+            ]
+        },
+        {
+            code: "class C { static { a; } } let a = 1; ",
+            options: [{ ignoreReadBeforeAssign: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { () => a; let a = 1; } };",
+            options: [{ ignoreReadBeforeAssign: true }],
+            parserOptions: { ecmaVersion: 2022 }
+        }
     ],
     invalid: [
         {
@@ -555,6 +604,86 @@ ruleTester.run("prefer-const", rule, {
             code: "/*eslint no-undef-init:error*/ let foo = undefined;",
             output: "/*eslint no-undef-init:error*/ const foo = undefined;",
             errors: 2
+        },
+
+        {
+            code: "let a = 1; class C { static { a; } }",
+            output: "const a = 1; class C { static { a; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+
+            // this is a TDZ error with either `let` or `const`, but that isn't a concern of this rule
+            code: "class C { static { a; } } let a = 1;",
+            output: "class C { static { a; } } const a = 1;",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+            code: "class C { static { let a = 1; } }",
+            output: "class C { static { const a = 1; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+            code: "class C { static { if (foo) { let a = 1; } } }",
+            output: "class C { static { if (foo) { const a = 1; } } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+            code: "class C { static { let a = 1; if (foo) { a; } } }",
+            output: "class C { static { const a = 1; if (foo) { a; } } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+            code: "class C { static { if (foo) { let a; a = 1; } } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier" }]
+        },
+        {
+            code: "class C { static { let a; a = 1; } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "useConst", data: { name: "a" }, type: "Identifier", column: 27 }]
+        },
+        {
+            code: "class C { static { let { a, b } = foo; } }",
+            output: "class C { static { const { a, b } = foo; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" },
+                { messageId: "useConst", data: { name: "b" }, type: "Identifier" }
+            ]
+        },
+        {
+            code: "class C { static { let a, b; ({ a, b } = foo); } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" },
+                { messageId: "useConst", data: { name: "b" }, type: "Identifier" }
+            ]
+        },
+        {
+            code: "class C { static { let a; let b; ({ a, b } = foo); } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" },
+                { messageId: "useConst", data: { name: "b" }, type: "Identifier" }
+            ]
+        },
+        {
+            code: "class C { static { let a; a = 0; console.log(a); } }",
+            output: null,
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [
+                { messageId: "useConst", data: { name: "a" }, type: "Identifier" }
+            ]
         }
     ]
 });