Skip to content

chore: fix test formatting in prefer-readonly.test.ts #8223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions packages/eslint-plugin/tests/rules/prefer-readonly.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class Foo {
`
class TestIntersection {
private prop: number = 3;

test() {
const that = {} as this & { _foo: 'bar' };
that.prop = 1;
Expand All @@ -664,7 +664,7 @@ class Foo {
`
class TestUnion {
private prop: number = 3;

test() {
const that = {} as this | (this & { _foo: 'bar' });
that.prop = 1;
Expand All @@ -674,7 +674,7 @@ class Foo {
`
class TestStaticIntersection {
private static prop: number;

test() {
const that = {} as typeof TestStaticIntersection & { _foo: 'bar' };
that.prop = 1;
Expand All @@ -684,7 +684,7 @@ class Foo {
`
class TestStaticUnion {
private static prop: number = 1;

test() {
const that = {} as
| typeof TestStaticUnion
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -2048,7 +2048,7 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(Base: TBase) {
code: `
class Test {
private prop: number = 3;

test() {
const that = {} as this & { _foo: 'bar' };
that._foo = 1;
Expand All @@ -2057,11 +2057,11 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(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;
}
}
`,
Expand All @@ -2079,7 +2079,7 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(Base: TBase) {
code: `
class Test {
private prop: number = 3;

test() {
const that = {} as this | (this & { _foo: 'bar' });
that.prop;
Expand All @@ -2088,11 +2088,11 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(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;
}
}
`,
Expand All @@ -2110,7 +2110,7 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(Base: TBase) {
code: `
class Test {
private prop: number;

constructor() {
const that = {} as this & { _foo: 'bar' };
that.prop = 1;
Expand All @@ -2119,11 +2119,11 @@ function ClassWithName<TBase extends new (...args: any[]) => {}>(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;
}
}
`,
Expand Down