--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: invalid.ts --- # Input ```ts class X0 { static foo = false; static bar() { } } class X1 { static #foo = false; static bar() {} } const X2 = class { static foo = false; }; const X3 = class A { static foo = false; }; export default class { static foo = false; } class StaticConstants0 { static readonly version = 42; static isProduction() { return Math.random() > 0.5; } } ``` # Diagnostics ``` invalid.ts:1:1 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. > 1 │ class X0 { │ ^^^^^^^^^^ > 2 │ static foo = false; > 3 │ static bar() { } > 4 │ } │ ^ 5 │ 6 │ class X1 { i Prefer using simple functions instead of classes with only static members. ``` ``` invalid.ts:6:1 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. 4 │ } 5 │ > 6 │ class X1 { │ ^^^^^^^^^^ > 7 │ static #foo = false; > 8 │ static bar() {} > 9 │ } │ ^ 10 │ 11 │ const X2 = class { i Prefer using simple functions instead of classes with only static members. ``` ``` invalid.ts:11:12 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. 9 │ } 10 │ > 11 │ const X2 = class { │ ^^^^^^^ > 12 │ static foo = false; > 13 │ }; │ ^ 14 │ 15 │ const X3 = class A { i Prefer using simple functions instead of classes with only static members. ``` ``` invalid.ts:15:12 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. 13 │ }; 14 │ > 15 │ const X3 = class A { │ ^^^^^^^^^ > 16 │ static foo = false; > 17 │ }; │ ^ 18 │ 19 │ export default class { i Prefer using simple functions instead of classes with only static members. ``` ``` invalid.ts:19:16 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. 17 │ }; 18 │ > 19 │ export default class { │ ^^^^^^^ > 20 │ static foo = false; > 21 │ } │ ^ 22 │ 23 │ class StaticConstants0 { i Prefer using simple functions instead of classes with only static members. ``` ``` invalid.ts:23:1 lint/complexity/noStaticOnlyClass ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Avoid classes that contain only static members. 21 │ } 22 │ > 23 │ class StaticConstants0 { │ ^^^^^^^^^^^^^^^^^^^^^^^^ > 24 │ static readonly version = 42; > 25 │ > 26 │ static isProduction() { > 27 │ return Math.random() > 0.5; > 28 │ } > 29 │ } │ ^ 30 │ i Prefer using simple functions instead of classes with only static members. ```