Repository: eslint/eslint
Pull request #15322 (2021-11-16 14:51:49)

feat: update brace-style 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 `brace-style`.

<!--
    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 `brace-style` rule to apply to braces of class static blocks.

#### Is there anything you'd like reviewers to focus on?



Patch:
diff --git a/docs/developer-guide/code-path-analysis.md b/docs/developer-guide/code-path-analysis.md
index 3507ff641..f22eb8f34 100644
--- a/docs/developer-guide/code-path-analysis.md
+++ b/docs/developer-guide/code-path-analysis.md
@@ -27,7 +27,7 @@ This has references of both the initial segment and the final segments of a code
 `CodePath` has the following properties:
 
 * `id` (`string`) - A unique string. Respective rules can use `id` to save additional information for each code path.
-* `origin` (`string`) - The reason that the code path was started. May be `"program"`, `"function"`, or `"class-field-initializer"`.
+* `origin` (`string`) - The reason that the code path was started. May be `"program"`, `"function"`, `"class-field-initializer"`, or `"class-static-block"`.
 * `initialSegment` (`CodePathSegment`) - The initial segment of this code path.
 * `finalSegments` (`CodePathSegment[]`) - The final segments which includes both returned and thrown.
 * `returnedSegments` (`CodePathSegment[]`) - The final segments which includes only returned.
diff --git a/docs/developer-guide/scope-manager-interface.md b/docs/developer-guide/scope-manager-interface.md
index 10ea7446e..2762f74ea 100644
--- a/docs/developer-guide/scope-manager-interface.md
+++ b/docs/developer-guide/scope-manager-interface.md
@@ -77,7 +77,7 @@ Those members are defined but not used in ESLint.
 #### type
 
 * **Type:** `string`
-* **Description:** The type of this scope. This is one of `"block"`, `"catch"`, `"class"`, `"class-field-initializer"`, `"for"`, `"function"`, `"function-expression-name"`, `"global"`, `"module"`, `"switch"`, `"with"`.
+* **Description:** The type of this scope. This is one of `"block"`, `"catch"`, `"class"`, `"class-field-initializer"`, `"class-static-block"`, `"for"`, `"function"`, `"function-expression-name"`, `"global"`, `"module"`, `"switch"`, `"with"`.
 
 #### isStrict
 
@@ -97,9 +97,9 @@ Those members are defined but not used in ESLint.
 #### variableScope
 
 * **Type:** `Scope`
-* **Description:** The nearest ancestor whose `type` is one of `"class-field-initializer"`, `"function"`, `"module"`, or `"program"` . For the aforementioned scopes this is a self-reference.
+* **Description:** The nearest ancestor whose `type` is one of `"class-field-initializer"`, `"class-static-block"`, `"function"`, `"global"`, or `"module"`. For the aforementioned scopes this is a self-reference.
 
-> This represents the lowest enclosing function or top-level scope. Class field initializers are implicit functions. Historically, this was the scope which hosts variables that are defined by `var` declarations, and thus the name `variableScope`.
+> This represents the lowest enclosing function or top-level scope. Class field initializers and class static blocks are implicit functions. Historically, this was the scope which hosts variables that are defined by `var` declarations, and thus the name `variableScope`.
 
 #### block
 
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/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/one-var.md b/docs/rules/one-var.md
index 3c964c4a4..df7ee1f60 100644
--- a/docs/rules/one-var.md
+++ b/docs/rules/one-var.md
@@ -66,7 +66,6 @@ Examples of **incorrect** code for this rule with the default `"always"` option:
 
 ```js
 /*eslint one-var: ["error", "always"]*/
-/*eslint-env es6*/
 
 function foo() {
     var bar;
@@ -89,13 +88,31 @@ function foo() {
         var qux = true;
     }
 }
+
+class C {
+    static {
+        var foo;
+        var bar;
+    }
+
+    static {
+        var foo;
+        if (bar) {
+            var baz = true;
+        }
+    }
+
+    static {
+        let foo;
+        let bar;
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the default `"always"` option:
 
 ```js
 /*eslint one-var: ["error", "always"]*/
-/*eslint-env es6*/
 
 function foo() {
     var bar,
@@ -127,6 +144,30 @@ function foo(){
         let qux;
     }
 }
+
+class C {
+    static {
+        var foo, bar;
+    }
+
+    static {
+        var foo, baz;
+        if (bar) {
+            baz = true;
+        }
+    }
+
+    static {
+        let foo, bar;
+    }
+
+    static {
+        let foo;
+        if (bar) {
+            let baz;
+        }
+    }
+}
 ```
 
 ### never
@@ -135,7 +176,6 @@ Examples of **incorrect** code for this rule with the `"never"` option:
 
 ```js
 /*eslint one-var: ["error", "never"]*/
-/*eslint-env es6*/
 
 function foo() {
     var bar,
@@ -157,13 +197,19 @@ function foo(){
     let bar = true,
         baz = false;
 }
+
+class C {
+    static {
+        var foo, bar;
+        let baz, qux;
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the `"never"` option:
 
 ```js
 /*eslint one-var: ["error", "never"]*/
-/*eslint-env es6*/
 
 function foo() {
     var bar;
@@ -185,6 +231,15 @@ function foo() {
         let qux = true;
     }
 }
+
+class C {
+    static {
+        var foo;
+        var bar;
+        let baz;
+        let qux;
+    }
+}
 ```
 
 ### consecutive
@@ -193,7 +248,6 @@ Examples of **incorrect** code for this rule with the `"consecutive"` option:
 
 ```js
 /*eslint one-var: ["error", "consecutive"]*/
-/*eslint-env es6*/
 
 function foo() {
     var bar;
@@ -209,14 +263,21 @@ function foo(){
     var qux = 3;
     var quux;
 }
+
+class C {
+    static {
+        var foo;
+        var bar;
+        let baz;
+        let qux;
+    }
+}
 ```
 
 Examples of **correct** code for this rule with the `"consecutive"` option:
 
 ```js
 /*eslint one-var: ["error", "consecutive"]*/
-/*eslint-env es6*/
-
 
 function foo() {
     var bar,
@@ -232,6 +293,16 @@ function foo(){
     var qux = 3,
         quux;
 }
+
+class C {
+    static {
+        var foo, bar;
+        let baz, qux;
+        doSomething();
+        let quux;
+        var quuux;
+    }
+}
 ```
 
 ### var, let, and const
diff --git a/docs/rules/padding-line-between-statements.md b/docs/rules/padding-line-between-statements.md
index 2f2f67ee0..065c7d937 100644
--- a/docs/rules/padding-line-between-statements.md
+++ b/docs/rules/padding-line-between-statements.md
@@ -147,6 +147,13 @@ function foo() {
     const a = 0;
     bar();
 }
+
+class C {
+    static {
+        let a = 0;
+        bar();
+    }
+}
 ```
 
 Examples of **correct** code for the `[{ blankLine: "always", prev: ["const", "let", "var"], next: "*"}, { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"]}]` configuration:
@@ -178,6 +185,15 @@ function foo() {
 
     bar();
 }
+
+class C {
+    static {
+        let a = 0;
+        let b = 0;
+
+        bar();
+    }
+}
 ```
 
 ----
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/docs/user-guide/command-line-interface.md b/docs/user-guide/command-line-interface.md
index 9ee7df474..ad84c37b6 100644
--- a/docs/user-guide/command-line-interface.md
+++ b/docs/user-guide/command-line-interface.md
@@ -473,7 +473,8 @@ This option causes ESLint to exit with exit code 2 if one or more fatal parsing
 
 #### `--debug`
 
-This option outputs debugging information to the console. This information is useful when you're seeing a problem and having a hard time pinpointing it. The ESLint team may ask for this debugging information to help solve bugs.
+This option outputs debugging information to the console. This information is useful when you're seeing a problem and having a hard time pinpointing it. The ESLint team may ask for this debugging information to help solve bugs.  
+Add this flag to an ESLint command line invocation in order to get extra debug information as the command is run (e.g. `eslint --debug test.js` and `eslint test.js --debug` are equivalent)
 
 #### `-h`, `--help`
 
diff --git a/lib/linter/code-path-analysis/code-path-analyzer.js b/lib/linter/code-path-analysis/code-path-analyzer.js
index d66c2f1be..2dcc27348 100644
--- a/lib/linter/code-path-analysis/code-path-analyzer.js
+++ b/lib/linter/code-path-analysis/code-path-analyzer.js
@@ -461,6 +461,10 @@ function processCodePathToEnter(analyzer, node) {
             startCodePath("function");
             break;
 
+        case "StaticBlock":
+            startCodePath("class-static-block");
+            break;
+
         case "ChainExpression":
             state.pushChainContext();
             break;
@@ -706,7 +710,8 @@ function postprocess(analyzer, node) {
         case "Program":
         case "FunctionDeclaration":
         case "FunctionExpression":
-        case "ArrowFunctionExpression": {
+        case "ArrowFunctionExpression":
+        case "StaticBlock": {
             endCodePath();
             break;
         }
diff --git a/lib/linter/code-path-analysis/code-path.js b/lib/linter/code-path-analysis/code-path.js
index f225c09a1..0e6662770 100644
--- a/lib/linter/code-path-analysis/code-path.js
+++ b/lib/linter/code-path-analysis/code-path.js
@@ -40,7 +40,7 @@ class CodePath {
 
         /**
          * The reason that this code path was started. May be "program",
-         * "function", or "class-field-initializer".
+         * "function", "class-field-initializer", or "class-static-block".
          * @type {string}
          */
         this.origin = origin;
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/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/one-var.js b/lib/rules/one-var.js
index 9c78ef87d..daff2d22b 100644
--- a/lib/rules/one-var.js
+++ b/lib/rules/one-var.js
@@ -541,6 +541,8 @@ module.exports = {
             FunctionDeclaration: startFunction,
             FunctionExpression: startFunction,
             ArrowFunctionExpression: startFunction,
+            StaticBlock: startFunction, // StaticBlock creates a new scope for `var` variables
+
             BlockStatement: startBlock,
             ForStatement: startBlock,
             ForInStatement: startBlock,
@@ -552,10 +554,12 @@ module.exports = {
             "ForInStatement:exit": endBlock,
             "SwitchStatement:exit": endBlock,
             "BlockStatement:exit": endBlock,
+
             "Program:exit": endFunction,
             "FunctionDeclaration:exit": endFunction,
             "FunctionExpression:exit": endFunction,
-            "ArrowFunctionExpression:exit": endFunction
+            "ArrowFunctionExpression:exit": endFunction,
+            "StaticBlock:exit": endFunction
         };
 
     }
diff --git a/lib/rules/padding-line-between-statements.js b/lib/rules/padding-line-between-statements.js
index 073940a40..42859dd38 100644
--- a/lib/rules/padding-line-between-statements.js
+++ b/lib/rules/padding-line-between-statements.js
@@ -618,9 +618,11 @@ module.exports = {
             Program: enterScope,
             BlockStatement: enterScope,
             SwitchStatement: enterScope,
+            StaticBlock: enterScope,
             "Program:exit": exitScope,
             "BlockStatement:exit": exitScope,
             "SwitchStatement:exit": exitScope,
+            "StaticBlock:exit": exitScope,
 
             ":statement": verify,
 
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;
 
 /**
diff --git a/lib/rules/utils/ast-utils.js b/lib/rules/utils/ast-utils.js
index 1d02d8a75..17ab533b3 100644
--- a/lib/rules/utils/ast-utils.js
+++ b/lib/rules/utils/ast-utils.js
@@ -35,7 +35,7 @@ const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|g
 const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
 
 // A set of node types that can contain a list of statements
-const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
+const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]);
 
 const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
 
diff --git a/package.json b/package.json
index 1b5558976..697da3abf 100644
--- a/package.json
+++ b/package.json
@@ -56,7 +56,7 @@
     "doctrine": "^3.0.0",
     "enquirer": "^2.3.5",
     "escape-string-regexp": "^4.0.0",
-    "eslint-scope": "^6.0.0",
+    "eslint-scope": "^7.0.0",
     "eslint-utils": "^3.0.0",
     "eslint-visitor-keys": "^3.1.0",
     "espree": "^9.0.0",


Test patch:
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--between-fields.js b/tests/fixtures/code-path-analysis/class-static-blocks--between-fields.js
new file mode 100644
index 000000000..9bf8edfef
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--between-fields.js
@@ -0,0 +1,65 @@
+/*expected
+initial->s2_1->s2_2->s2_3;
+s2_1->s2_3->final;
+*/
+/*expected
+initial->s3_1->s3_2->s3_3->s3_4;
+s3_1->s3_4;
+s3_2->s3_4->final;
+*/
+/*expected
+initial->s4_1->s4_2->s4_3->s4_4->s4_5;
+s4_1->s4_5;
+s4_2->s4_5;
+s4_3->s4_5->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { bar = a || b; static { x || y || z } baz = p || q || r || s; }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="LogicalExpression:enter\nIdentifier (a)"];
+    s2_2[label="Identifier (b)"];
+    s2_3[label="LogicalExpression:exit"];
+    initial->s2_1->s2_2->s2_3;
+    s2_1->s2_3->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"];
+    s3_2[label="Identifier (y)\nLogicalExpression:exit"];
+    s3_3[label="Identifier (z)"];
+    s3_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s3_1->s3_2->s3_3->s3_4;
+    s3_1->s3_4;
+    s3_2->s3_4->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s4_1[label="LogicalExpression:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (p)"];
+    s4_2[label="Identifier (q)\nLogicalExpression:exit"];
+    s4_3[label="Identifier (r)\nLogicalExpression:exit"];
+    s4_4[label="Identifier (s)"];
+    s4_5[label="LogicalExpression:exit"];
+    initial->s4_1->s4_2->s4_3->s4_4->s4_5;
+    s4_1->s4_5;
+    s4_2->s4_5;
+    s4_3->s4_5->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nPropertyDefinition:enter\nIdentifier (bar)\nLogicalExpression\nPropertyDefinition:exit\nStaticBlock\nPropertyDefinition:enter\nIdentifier (baz)\nLogicalExpression\nPropertyDefinition:exit\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--between-methods.js b/tests/fixtures/code-path-analysis/class-static-blocks--between-methods.js
new file mode 100644
index 000000000..a6de6909a
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--between-methods.js
@@ -0,0 +1,65 @@
+/*expected
+initial->s2_1->s2_2->s2_3;
+s2_1->s2_3->final;
+*/
+/*expected
+initial->s3_1->s3_2->s3_3->s3_4;
+s3_1->s3_4;
+s3_2->s3_4->final;
+*/
+/*expected
+initial->s4_1->s4_2->s4_3->s4_4->s4_5;
+s4_1->s4_5;
+s4_2->s4_5;
+s4_3->s4_5->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { bar () { a || b } static { x || y || z } baz() { p || q || r || s } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="FunctionExpression:enter\nBlockStatement:enter\nExpressionStatement:enter\nLogicalExpression:enter\nIdentifier (a)"];
+    s2_2[label="Identifier (b)"];
+    s2_3[label="LogicalExpression:exit\nExpressionStatement:exit\nBlockStatement:exit\nFunctionExpression:exit"];
+    initial->s2_1->s2_2->s2_3;
+    s2_1->s2_3->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"];
+    s3_2[label="Identifier (y)\nLogicalExpression:exit"];
+    s3_3[label="Identifier (z)"];
+    s3_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s3_1->s3_2->s3_3->s3_4;
+    s3_1->s3_4;
+    s3_2->s3_4->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s4_1[label="FunctionExpression:enter\nBlockStatement:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (p)"];
+    s4_2[label="Identifier (q)\nLogicalExpression:exit"];
+    s4_3[label="Identifier (r)\nLogicalExpression:exit"];
+    s4_4[label="Identifier (s)"];
+    s4_5[label="LogicalExpression:exit\nExpressionStatement:exit\nBlockStatement:exit\nFunctionExpression:exit"];
+    initial->s4_1->s4_2->s4_3->s4_4->s4_5;
+    s4_1->s4_5;
+    s4_2->s4_5;
+    s4_3->s4_5->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nMethodDefinition:enter\nIdentifier (bar)\nFunctionExpression\nMethodDefinition:exit\nStaticBlock\nMethodDefinition:enter\nIdentifier (baz)\nFunctionExpression\nMethodDefinition:exit\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--conditional.js b/tests/fixtures/code-path-analysis/class-static-blocks--conditional.js
new file mode 100644
index 000000000..bcdb4a7ec
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--conditional.js
@@ -0,0 +1,29 @@
+/*expected
+initial->s2_1->s2_2->s2_4;
+s2_1->s2_3->s2_4->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { this.bar = a ? b : c; } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nConditionalExpression:enter\nIdentifier (a)"];
+    s2_2[label="Identifier (b)"];
+    s2_4[label="ConditionalExpression:exit\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    s2_3[label="Identifier (c)"];
+    initial->s2_1->s2_2->s2_4;
+    s2_1->s2_3->s2_4->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--empty.js b/tests/fixtures/code-path-analysis/class-static-blocks--empty.js
new file mode 100644
index 000000000..40a1e71ae
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--empty.js
@@ -0,0 +1,24 @@
+/*expected
+initial->s2_1->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static {} }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock"];
+    initial->s2_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--function-inside.js b/tests/fixtures/code-path-analysis/class-static-blocks--function-inside.js
new file mode 100644
index 000000000..49df347f0
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--function-inside.js
@@ -0,0 +1,34 @@
+/*expected
+initial->s3_1->final;
+*/
+/*expected
+initial->s2_1->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { (p) => {} } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s3_1[label="ArrowFunctionExpression:enter\nIdentifier (p)\nBlockStatement\nArrowFunctionExpression:exit"];
+    initial->s3_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nArrowFunctionExpression\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s2_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--if-else.js b/tests/fixtures/code-path-analysis/class-static-blocks--if-else.js
new file mode 100644
index 000000000..7b4a542bc
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--if-else.js
@@ -0,0 +1,29 @@
+/*expected
+initial->s2_1->s2_2->s2_4;
+s2_1->s2_3->s2_4->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { if (bar) { this.baz = 1; } else { this.qux = 2; } } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nIfStatement:enter\nIdentifier (bar)"];
+    s2_2[label="BlockStatement:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (baz)\nMemberExpression:exit\nLiteral (1)\nAssignmentExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"];
+    s2_4[label="IfStatement:exit\nStaticBlock:exit"];
+    s2_3[label="BlockStatement:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (qux)\nMemberExpression:exit\nLiteral (2)\nAssignmentExpression:exit\nExpressionStatement:exit\nBlockStatement:exit"];
+    initial->s2_1->s2_2->s2_4;
+    s2_1->s2_3->s2_4->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--multiple-1.js b/tests/fixtures/code-path-analysis/class-static-blocks--multiple-1.js
new file mode 100644
index 000000000..67365fb2f
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--multiple-1.js
@@ -0,0 +1,34 @@
+/*expected
+initial->s2_1->final;
+*/
+/*expected
+initial->s3_1->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { this.bar = 1; } static { this.baz = 2; } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nLiteral (1)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s2_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (baz)\nMemberExpression:exit\nLiteral (2)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s3_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--multiple-2.js b/tests/fixtures/code-path-analysis/class-static-blocks--multiple-2.js
new file mode 100644
index 000000000..218d18a78
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--multiple-2.js
@@ -0,0 +1,45 @@
+/*expected
+initial->s2_1->s2_2->s2_3->s2_4;
+s2_1->s2_4;
+s2_2->s2_4->final;
+*/
+/*expected
+initial->s3_1->s3_2->s3_3;
+s3_1->s3_3->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { x || y || z } static { p || q } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nLogicalExpression:enter\nIdentifier (x)"];
+    s2_2[label="Identifier (y)\nLogicalExpression:exit"];
+    s2_3[label="Identifier (z)"];
+    s2_4[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s2_1->s2_2->s2_3->s2_4;
+    s2_1->s2_4;
+    s2_2->s2_4->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s3_1[label="StaticBlock:enter\nExpressionStatement:enter\nLogicalExpression:enter\nIdentifier (p)"];
+    s3_2[label="Identifier (q)"];
+    s3_3[label="LogicalExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s3_1->s3_2->s3_3;
+    s3_1->s3_3->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/fixtures/code-path-analysis/class-static-blocks--simple.js b/tests/fixtures/code-path-analysis/class-static-blocks--simple.js
new file mode 100644
index 000000000..06bb73787
--- /dev/null
+++ b/tests/fixtures/code-path-analysis/class-static-blocks--simple.js
@@ -0,0 +1,24 @@
+/*expected
+initial->s2_1->final;
+*/
+/*expected
+initial->s1_1->final;
+*/
+class Foo { static { this.bar = baz; } }
+
+/*DOT
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s2_1[label="StaticBlock:enter\nExpressionStatement:enter\nAssignmentExpression:enter\nMemberExpression:enter\nThisExpression\nIdentifier (bar)\nMemberExpression:exit\nIdentifier (baz)\nAssignmentExpression:exit\nExpressionStatement:exit\nStaticBlock:exit"];
+    initial->s2_1->final;
+}
+digraph {
+    node[shape=box,style="rounded,filled",fillcolor=white];
+    initial[label="",shape=circle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    final[label="",shape=doublecircle,style=filled,fillcolor=black,width=0.25,height=0.25];
+    s1_1[label="Program:enter\nClassDeclaration:enter\nIdentifier (Foo)\nClassBody:enter\nStaticBlock\nClassBody:exit\nClassDeclaration:exit\nProgram:exit"];
+    initial->s1_1->final;
+}
+*/
diff --git a/tests/lib/linter/code-path-analysis/code-path.js b/tests/lib/linter/code-path-analysis/code-path.js
index 42a63a280..760d5b399 100644
--- a/tests/lib/linter/code-path-analysis/code-path.js
+++ b/tests/lib/linter/code-path-analysis/code-path.js
@@ -106,6 +106,12 @@ describe("CodePathAnalyzer", () => {
 
             assert.strictEqual(codePath.origin, "class-field-initializer");
         });
+
+        it("should be 'class-static-block' when code path starts inside a class static block", () => {
+            const codePath = parseCodePaths("class Foo { static { this.a=1; } }")[1];
+
+            assert.strictEqual(codePath.origin, "class-static-block");
+        });
     });
 
     describe(".traverseSegments()", () => {
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/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/no-shadow.js b/tests/lib/rules/no-shadow.js
index 036c65262..13c4c1100 100644
--- a/tests/lib/rules/no-shadow.js
+++ b/tests/lib/rules/no-shadow.js
@@ -58,7 +58,12 @@ ruleTester.run("no-shadow", rule, {
         { code: "var Object = 0;", options: [{ builtinGlobals: true }] },
         { code: "var top = 0;", options: [{ builtinGlobals: true }], env: { browser: true } },
         { code: "function foo(cb) { (function (cb) { cb(42); })(cb); }", options: [{ allow: ["cb"] }] },
-        { code: "class C { foo; foo() { let foo; } }", parserOptions: { ecmaVersion: 2022 } }
+        { code: "class C { foo; foo() { let foo; } }", parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { var x; } static { var x; } }", parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { let x; } static { let x; } }", parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { var x; { var x; /* redeclaration */ } } }", parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { { var x; } { var x; /* redeclaration */ } } }", parserOptions: { ecmaVersion: 2022 } },
+        { code: "class C { static { { let x; } { let x; } } }", parserOptions: { ecmaVersion: 2022 } }
     ],
     invalid: [
         {
@@ -716,6 +721,144 @@ ruleTester.run("no-shadow", rule, {
                 line: 1,
                 column: 31
             }]
+        },
+        {
+            code: "class C { static { let a; { let a; } } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 24
+                },
+                type: "Identifier",
+                line: 1,
+                column: 33
+            }]
+        },
+        {
+            code: "class C { static { var C; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "C",
+                    shadowedLine: 1,
+                    shadowedColumn: 7
+                },
+                type: "Identifier",
+                line: 1,
+                column: 24
+            }]
+        },
+        {
+            code: "class C { static { let C; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "C",
+                    shadowedLine: 1,
+                    shadowedColumn: 7
+                },
+                type: "Identifier",
+                line: 1,
+                column: 24
+            }]
+        },
+        {
+            code: "var a; class C { static { var a; } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 5
+                },
+                type: "Identifier",
+                line: 1,
+                column: 31
+            }]
+        },
+        {
+            code: "class C { static { var a; } } var a;",
+            options: [{ hoist: "all" }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 35
+                },
+                type: "Identifier",
+                line: 1,
+                column: 24
+            }]
+        },
+        {
+            code: "class C { static { let a; } } let a;",
+            options: [{ hoist: "all" }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 35
+                },
+                type: "Identifier",
+                line: 1,
+                column: 24
+            }]
+        },
+        {
+            code: "class C { static { var a; } } let a;",
+            options: [{ hoist: "all" }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 35
+                },
+                type: "Identifier",
+                line: 1,
+                column: 24
+            }]
+        },
+        {
+            code: "class C { static { var a; class D { static { var a; } } } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 24
+                },
+                type: "Identifier",
+                line: 1,
+                column: 50
+            }]
+        },
+        {
+            code: "class C { static { let a; class D { static { let a; } } } }",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "noShadow",
+                data: {
+                    name: "a",
+                    shadowedLine: 1,
+                    shadowedColumn: 24
+                },
+                type: "Identifier",
+                line: 1,
+                column: 50
+            }]
         }
     ]
 });
diff --git a/tests/lib/rules/no-undef.js b/tests/lib/rules/no-undef.js
index 43697ec95..956bbc991 100644
--- a/tests/lib/rules/no-undef.js
+++ b/tests/lib/rules/no-undef.js
@@ -91,6 +91,67 @@ ruleTester.run("no-undef", rule, {
         {
             code: "import.meta",
             parserOptions: { ecmaVersion: 2020, sourceType: "module" }
+        },
+
+        // class static blocks
+        {
+            code: "let a; class C { static {} } a;",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "undef", data: { name: "a" } }]
+        },
+        {
+            code: "var a; class C { static {} } a;",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "undef", data: { name: "a" } }]
+        },
+        {
+            code: "a; class C { static {} } var a;",
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "undef", data: { name: "a" } }]
+        },
+        {
+            code: "class C { static { C; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "const C = class { static { C; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; } } var a;",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; } } let a;",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { var a; a; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; var a; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; { var a; } } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { let a; a; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; let a; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { function a() {} a; } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
+        },
+        {
+            code: "class C { static { a; function a() {} } }",
+            parserOptions: { ecmaVersion: 2022, sourceType: "module" }
         }
     ],
     invalid: [
@@ -114,6 +175,99 @@ ruleTester.run("no-undef", rule, {
                 ecmaVersion: 2018
             },
             errors: [{ messageId: "undef", data: { name: "b" } }]
+        },
+
+        // class static blocks
+        {
+            code: "class C { static { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" } }]
+        },
+        {
+            code: "class C { static { { let a; } a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 31 }]
+        },
+        {
+            code: "class C { static { { function a() {} } a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 40 }]
+        },
+        {
+            code: "class C { static { function foo() { var a; }  a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 47 }]
+        },
+        {
+            code: "class C { static { var a; } static { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 38 }]
+        },
+        {
+            code: "class C { static { let a; } static { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 38 }]
+        },
+        {
+            code: "class C { static { function a(){} } static { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 46 }]
+        },
+        {
+            code: "class C { static { var a; } foo() { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 37 }]
+        },
+        {
+            code: "class C { static { let a; } foo() { a; } }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 37 }]
+        },
+        {
+            code: "class C { static { var a; } [a]; }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 30 }]
+        },
+        {
+            code: "class C { static { let a; } [a]; }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 30 }]
+        },
+        {
+            code: "class C { static { function a() {} } [a]; }",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 39 }]
+        },
+        {
+            code: "class C { static { var a; } } a;",
+            parserOptions: {
+                ecmaVersion: 2022
+            },
+            errors: [{ messageId: "undef", data: { name: "a" }, column: 31 }]
         }
     ]
 });
diff --git a/tests/lib/rules/one-var.js b/tests/lib/rules/one-var.js
index b7ed53438..935c464b3 100644
--- a/tests/lib/rules/one-var.js
+++ b/tests/lib/rules/one-var.js
@@ -493,6 +493,143 @@ ruleTester.run("one-var", rule, {
         {
             code: "var foo = 1;\nlet bar = function() { var x; };\nvar baz = 2;",
             options: [{ var: "never" }]
+        },
+
+        // class static blocks
+        {
+            code: "class C { static { var a; let b; const c = 0; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "const a = 0; class C { static { const b = 0; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { const b = 0; } } const a = 0; ",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "let a; class C { static { let b; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let b; } } let a;",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "var a; class C { static { var b; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var b; } } var a; ",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "var a; class C { static { if (foo) { var b; } } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { if (foo) { var b; } } } var a; ",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { const a = 0; if (foo) { const b = 0; } } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; if (foo) { let b; } } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { const a = 0; const b = 0; } }",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; let b; } }",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var a; var b; } }",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; foo; let b; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; const b = 0; let c; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var a; foo; var b; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var a; let b; var c; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; if (foo) { let b; } } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { if (foo) { let b; } let a;  } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { const a = 0; if (foo) { const b = 0; } } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { if (foo) { const b = 0; } const a = 0; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var a; if (foo) var b; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { if (foo) var b; var a; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { if (foo) { var b; } var a; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let a; let b = 0; } }",
+            options: [{ initialized: "consecutive" }],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { var a; var b = 0; } }",
+            options: [{ initialized: "consecutive" }],
+            parserOptions: { ecmaVersion: 2022 }
         }
     ],
     invalid: [
@@ -2118,6 +2255,129 @@ ruleTester.run("one-var", rule, {
                 data: { type: "var" },
                 type: "VariableDeclaration"
             }]
+        },
+
+        // class static blocks
+        {
+            code: "class C { static { let x, y; } }",
+            output: "class C { static { let x; let y; } }",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "split",
+                data: { type: "let" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var x, y; } }",
+            output: "class C { static { var x; var y; } }",
+            options: ["never"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "split",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { let x; let y; } }",
+            output: "class C { static { let x,  y; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "let" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var x; var y; } }",
+            output: "class C { static { var x,  y; } }",
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { let x; foo; let y; } }",
+            output: null,
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "let" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var x; foo; var y; } }",
+            output: null,
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var x; if (foo) { var y; } } }",
+            output: null,
+            options: ["always"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { let x; let y; } }",
+            output: "class C { static { let x,  y; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "let" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var x; var y; } }",
+            output: "class C { static { var x,  y; } }",
+            options: ["consecutive"],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combine",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { let a = 0; let b = 1; } }",
+            output: "class C { static { let a = 0,  b = 1; } }",
+            options: [{ initialized: "consecutive" }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combineInitialized",
+                data: { type: "let" },
+                type: "VariableDeclaration"
+            }]
+        },
+        {
+            code: "class C { static { var a = 0; var b = 1; } }",
+            output: "class C { static { var a = 0,  b = 1; } }",
+            options: [{ initialized: "consecutive" }],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{
+                messageId: "combineInitialized",
+                data: { type: "var" },
+                type: "VariableDeclaration"
+            }]
         }
     ]
 });
diff --git a/tests/lib/rules/padding-line-between-statements.js b/tests/lib/rules/padding-line-between-statements.js
index 931cdd24c..51ddf0eb3 100644
--- a/tests/lib/rules/padding-line-between-statements.js
+++ b/tests/lib/rules/padding-line-between-statements.js
@@ -2626,6 +2626,114 @@ ruleTester.run("padding-line-between-statements", rule, {
             options: [
                 { blankLine: "always", prev: "block-like", next: "block-like" }
             ]
+        },
+
+        // class static blocks
+        {
+            code: "class C {\n static {\n let x;\n\n foo();\n }\n }",
+            options: [
+                { blankLine: "always", prev: "let", next: "expression" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n }\n }",
+            options: [
+                { blankLine: "never", prev: "let", next: "expression" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n }\n }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n const y = 1;\n }\n }",
+            options: [
+                { blankLine: "never", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n const z = 1;\n }\n }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n const y = 1;\n const z = 1;\n }\n }",
+            options: [
+                { blankLine: "never", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C {\n static {\n let a = 0;\n let b =0;\n\n bar();\n }\n }",
+            options: [
+                { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
+                { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let x; { let y; } let z; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { method() { let x; } static { let y; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let y; } method() { let x; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let x; } static { let y; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "let x; class C { static { let y; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let x; } } let y;",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { let x; } }",
+            options: [
+                { blankLine: "always", prev: "class", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
+        },
+        {
+            code: "class C { static { 'use strict'; let x; } }", // 'use strict'; is "espression", because class static blocks don't have directives
+            options: [
+                { blankLine: "always", prev: "directive", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 }
         }
     ],
     invalid: [
@@ -4976,6 +5084,117 @@ ruleTester.run("padding-line-between-statements", rule, {
                 { messageId: "expectedBlankLine" },
                 { messageId: "expectedBlankLine" }
             ]
+        },
+
+        // class static blocks
+        {
+            code: "class C {\n static {\n let x;\n foo();\n }\n }",
+            output: "class C {\n static {\n let x;\n\n foo();\n }\n }",
+            options: [
+                { blankLine: "always", prev: "let", next: "expression" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let x;\n\n foo();\n }\n }",
+            output: "class C {\n static {\n let x;\n foo();\n }\n }",
+            options: [
+                { blankLine: "never", prev: "let", next: "expression" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "unexpectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n const y = 1;\n }\n }",
+            output: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n }\n }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n }\n }",
+            output: "class C {\n static {\n let x;\n foo();\n const y = 1;\n }\n }",
+            options: [
+                { blankLine: "never", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "unexpectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n const y = 1;\n const z = 1;\n }\n }",
+            output: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n const z = 1;\n }\n }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let x;\n foo();\n\n const y = 1;\n const z = 1;\n }\n }",
+            output: "class C {\n static {\n let x;\n foo();\n const y = 1;\n const z = 1;\n }\n }",
+            options: [
+                { blankLine: "never", prev: "expression", next: "const" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "unexpectedBlankLine" }]
+        },
+        {
+            code: "class C {\n static {\n let a = 0;\n bar();\n }\n }",
+            output: "class C {\n static {\n let a = 0;\n\n bar();\n }\n }",
+            options: [
+                { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
+                { blankLine: "any", prev: ["const", "let", "var"], next: ["const", "let", "var"] }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C { static { let x; { let y; let z; } let q; } }",
+            output: "class C { static { let x; { let y;\n\n let z; } let q; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C { static { { let x; } let y; let z; } }",
+            output: "class C { static { { let x; } let y;\n\n let z; } }",
+            options: [
+                { blankLine: "always", prev: "let", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C { static { foo(); if (bar) {} } }",
+            output: "class C { static { foo();\n\n if (bar) {} } }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "block-like" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C { static { let x; } } let y;",
+            output: "class C { static { let x; } }\n\n let y;",
+            options: [
+                { blankLine: "always", prev: "class", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
+        },
+        {
+            code: "class C { static { 'use strict'; let x; } }", // 'use strict'; is "espression", because class static blocks don't have directives
+            output: "class C { static { 'use strict';\n\n let x; } }",
+            options: [
+                { blankLine: "always", prev: "expression", next: "let" }
+            ],
+            parserOptions: { ecmaVersion: 2022 },
+            errors: [{ messageId: "expectedBlankLine" }]
         }
     ]
 });
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" }
+            ]
         }
     ]
 });