Skip to content

Commit

Permalink
✅ Add test cases for nested type declarations & multiline type annota…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
coyotte508 committed Dec 15, 2022
1 parent b12c530 commit 62a96ba
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions packages/eslint-plugin/tests/rules/key-spacing.test.ts
Expand Up @@ -52,6 +52,19 @@ ruleTester.run('key-spacing', rule, {
code: 'type X = {\n a : number;\n abc: string\n};',
options: [{ align: 'value', mode: 'minimum' }],
},
{
code: `
interface X {
a: number;
prop: {
abc: number;
a: number;
},
abc: string
}
`,
options: [{ align: 'value' }],
},
// align: colon
{
code: 'interface X {\n a : number;\n abc: string\n};',
Expand Down Expand Up @@ -141,6 +154,48 @@ ruleTester.run('key-spacing', rule, {
options: [{ align: 'value' }],
errors: [{ messageId: 'extraValue' }],
},
{
code: `
interface X {
a: number;
prop: {
abc: number;
a: number;
},
abc: string
}
`,
options: [{ align: 'value' }],
errors: [{ messageId: 'missingValue' }],
},
{
code: `
interface X {
a: number;
prop: {
abc: number;
a: number;
},
abc: string
}
`,
options: [{ align: 'value' }],
errors: [{ messageId: 'missingValue' }],
},
{
code: `
interface X {
a: number;
prop: {
abc: number;
a: number;
},
abc: string
}
`,
options: [{ align: 'value' }],
errors: [{ messageId: 'extraValue' }],
},
// align: colon
{
code: 'interface X {\n a : number;\n abc: string\n};',
Expand Down

0 comments on commit 62a96ba

Please sign in to comment.