diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index a8d170c4a7d0..39262c6fbb4e 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -654,7 +654,7 @@ class Foo { ` class TestIntersection { private prop: number = 3; - + test() { const that = {} as this & { _foo: 'bar' }; that.prop = 1; @@ -664,7 +664,7 @@ class Foo { ` class TestUnion { private prop: number = 3; - + test() { const that = {} as this | (this & { _foo: 'bar' }); that.prop = 1; @@ -674,7 +674,7 @@ class Foo { ` class TestStaticIntersection { private static prop: number; - + test() { const that = {} as typeof TestStaticIntersection & { _foo: 'bar' }; that.prop = 1; @@ -684,7 +684,7 @@ class Foo { ` class TestStaticUnion { private static prop: number = 1; - + test() { const that = {} as | typeof TestStaticUnion @@ -697,7 +697,7 @@ class Foo { class TestBothIntersection { private prop1: number = 1; private static prop2: number; - + test() { const that = {} as typeof TestBothIntersection & this; that.prop1 = 1; @@ -709,7 +709,7 @@ class Foo { class TestBothIntersection { private prop1: number = 1; private static prop2: number; - + test() { const that = {} as this & typeof TestBothIntersection; that.prop1 = 1; @@ -2048,7 +2048,7 @@ function ClassWithName {}>(Base: TBase) { code: ` class Test { private prop: number = 3; - + test() { const that = {} as this & { _foo: 'bar' }; that._foo = 1; @@ -2057,11 +2057,11 @@ function ClassWithName {}>(Base: TBase) { `, output: ` class Test { - private readonly prop: number = 3 + private readonly prop: number = 3; test() { - const that = {} as this & {_foo: 'bar'} - that._foo = 1 + const that = {} as this & { _foo: 'bar' }; + that._foo = 1; } } `, @@ -2079,7 +2079,7 @@ function ClassWithName {}>(Base: TBase) { code: ` class Test { private prop: number = 3; - + test() { const that = {} as this | (this & { _foo: 'bar' }); that.prop; @@ -2088,11 +2088,11 @@ function ClassWithName {}>(Base: TBase) { `, output: ` class Test { - private readonly prop: number = 3 + private readonly prop: number = 3; test() { - const that = {} as this | (this & {_foo: 'bar'}) - that.prop + const that = {} as this | (this & { _foo: 'bar' }); + that.prop; } } `, @@ -2110,7 +2110,7 @@ function ClassWithName {}>(Base: TBase) { code: ` class Test { private prop: number; - + constructor() { const that = {} as this & { _foo: 'bar' }; that.prop = 1; @@ -2119,11 +2119,11 @@ function ClassWithName {}>(Base: TBase) { `, output: ` class Test { - private readonly prop: number + private readonly prop: number; constructor() { - const that = {} as this & {_foo: 'bar'} - that.prop = 1 + const that = {} as this & { _foo: 'bar' }; + that.prop = 1; } } `,