Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
fix(eslint-plugin): [consistent-type-definitions] don't leave trailing parens when fixing type to interface#10235
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -96,6 +96,18 @@ export type W<T> = { | ||
options: ['interface'], | ||
output: `interface T { x: number; }`, | ||
}, | ||
{ | ||
code: noFormat`type T /* comment */={ x: number; };`, | ||
errors: [ | ||
{ | ||
column: 6, | ||
line: 1, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
options: ['interface'], | ||
output: `interface T /* comment */ { x: number; }`, | ||
}, | ||
{ | ||
code: ` | ||
export type W<T> = { | ||
@@ -350,5 +362,104 @@ export declare type Test = { | ||
} | ||
`, | ||
}, | ||
{ | ||
code: noFormat` | ||
type Foo = ({ | ||
a: string; | ||
}); | ||
`, | ||
errors: [ | ||
{ | ||
line: 2, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
output: ` | ||
interface Foo { | ||
a: string; | ||
} | ||
`, | ||
}, | ||
{ | ||
code: noFormat` | ||
type Foo = ((((((((({ | ||
a: string; | ||
}))))))))); | ||
`, | ||
Comment on lines +384 to +388 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Could you add a test case like typeFoo=((({a:string;})))// next statement has a semiconstbar=1; To ensure we are handling the no-semi case? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. sure! added 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Note that the risk of messing up a semi/no-semi issue is also lessened now that the fixer isn't querying for it; it's just deleting up to | ||
errors: [ | ||
{ | ||
line: 2, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
output: ` | ||
interface Foo { | ||
a: string; | ||
} | ||
`, | ||
}, | ||
{ | ||
// no closing semicolon | ||
code: noFormat` | ||
type Foo = { | ||
a: string; | ||
} | ||
`, | ||
errors: [ | ||
{ | ||
line: 2, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
output: ` | ||
interface Foo { | ||
a: string; | ||
} | ||
`, | ||
}, | ||
{ | ||
// no closing semicolon; ensure we don't erase subsequent code. | ||
code: noFormat` | ||
type Foo = { | ||
a: string; | ||
} | ||
type Bar = string; | ||
`, | ||
errors: [ | ||
{ | ||
line: 2, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
output: ` | ||
interface Foo { | ||
a: string; | ||
} | ||
type Bar = string; | ||
`, | ||
}, | ||
{ | ||
// no closing semicolon; ensure we don't erase subsequent code. | ||
code: noFormat` | ||
type Foo = ((({ | ||
a: string; | ||
}))) | ||
const bar = 1; | ||
`, | ||
errors: [ | ||
{ | ||
line: 2, | ||
messageId: 'interfaceOverType', | ||
}, | ||
], | ||
output: ` | ||
interface Foo { | ||
a: string; | ||
} | ||
const bar = 1; | ||
`, | ||
}, | ||
], | ||
}); |
Uh oh!
There was an error while loading.Please reload this page.