Skip to content

Commit 0d70d62

Browse files
chore: add missing rule test suggestions
1 parent a846ffe commit 0d70d62

File tree

2 files changed

+73
-3
lines changed

2 files changed

+73
-3
lines changed

packages/eslint-plugin/tests/rules/no-empty-object-type.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,18 @@ let value: unknown;
546546
endColumn: 15,
547547
endLine: 1,
548548
messageId: 'noEmptyObject',
549+
suggestions: [
550+
{
551+
data: { replacement: 'object' },
552+
messageId: 'replaceEmptyObjectType',
553+
output: 'type Base = object | null;',
554+
},
555+
{
556+
data: { replacement: 'unknown' },
557+
messageId: 'replaceEmptyObjectType',
558+
output: 'type Base = unknown | null;',
559+
},
560+
],
549561
},
550562
],
551563
options: [{ allowWithName: 'Base' }],
@@ -559,6 +571,18 @@ let value: unknown;
559571
endColumn: 15,
560572
endLine: 1,
561573
messageId: 'noEmptyObject',
574+
suggestions: [
575+
{
576+
data: { replacement: 'object' },
577+
messageId: 'replaceEmptyObjectType',
578+
output: 'type Base = object;',
579+
},
580+
{
581+
data: { replacement: 'unknown' },
582+
messageId: 'replaceEmptyObjectType',
583+
output: 'type Base = unknown;',
584+
},
585+
],
562586
},
563587
],
564588
options: [{ allowWithName: 'Mismatch' }],

packages/eslint-plugin/tests/rules/no-floating-promises.test.ts

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,7 +3747,23 @@ void myTag\`abc\`;
37473747
37483748
unsafe('...', () => {});
37493749
`,
3750-
errors: [{ line: 4, messageId: 'floatingVoid' }],
3750+
errors: [
3751+
{
3752+
line: 4,
3753+
messageId: 'floatingVoid',
3754+
3755+
suggestions: [
3756+
{
3757+
messageId: 'floatingFixVoid',
3758+
output: `
3759+
declare function unsafe(...args: unknown[]): Promise<void>;
3760+
3761+
void unsafe('...', () => {});
3762+
`,
3763+
},
3764+
],
3765+
},
3766+
],
37513767
options: [
37523768
{
37533769
allowForKnownSafeCalls: [
@@ -3769,7 +3785,22 @@ void myTag\`abc\`;
37693785
37703786
it('...', () => {}).then(() => {});
37713787
`,
3772-
errors: [{ line: 4, messageId: 'floatingVoid' }],
3788+
errors: [
3789+
{
3790+
line: 4,
3791+
messageId: 'floatingVoid',
3792+
suggestions: [
3793+
{
3794+
messageId: 'floatingFixVoid',
3795+
output: `
3796+
declare function it(...args: unknown[]): Promise<void>;
3797+
3798+
void it('...', () => {}).then(() => {});
3799+
`,
3800+
},
3801+
],
3802+
},
3803+
],
37733804
options: [
37743805
{
37753806
allowForKnownSafeCalls: [
@@ -3791,7 +3822,22 @@ void myTag\`abc\`;
37913822
37923823
it('...', () => {}).finally(() => {});
37933824
`,
3794-
errors: [{ line: 4, messageId: 'floatingVoid' }],
3825+
errors: [
3826+
{
3827+
line: 4,
3828+
messageId: 'floatingVoid',
3829+
suggestions: [
3830+
{
3831+
messageId: 'floatingFixVoid',
3832+
output: `
3833+
declare function it(...args: unknown[]): Promise<void>;
3834+
3835+
void it('...', () => {}).finally(() => {});
3836+
`,
3837+
},
3838+
],
3839+
},
3840+
],
37953841
options: [
37963842
{
37973843
allowForKnownSafeCalls: [

0 commit comments

Comments
 (0)