Skip to content

Commit 8d741f4

Browse files
armano2bradzacher
authored andcommitted
test(eslint-plugin): add missing tests for no-type-alias and no-parameter-properties (typescript-eslint#274)
* test(eslint-plugin): add test for no-type-alias * test(eslint-plugin): add test cases no-parameter-properties * test(eslint-plugin): fix test case Co-Authored-By: armano2 <[email protected]>
1 parent bf46f8c commit 8d741f4

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

packages/eslint-plugin/tests/rules/no-parameter-properties.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ class Foo {
1313
}
1414
`,
1515
`
16+
class Foo {
17+
constructor(...name: string[]) {}
18+
}
19+
`,
20+
`
1621
class Foo {
1722
constructor(name: string, age: number) {}
1823
}
@@ -94,7 +99,19 @@ class Foo {
9499
}
95100
`,
96101
options: [{ allows: ['public readonly', 'private'] }]
97-
}
102+
},
103+
// Semantically invalid test case
104+
`
105+
class Foo {
106+
constructor(private ...name: string[]) {}
107+
}
108+
`,
109+
// Semantically invalid test case
110+
`
111+
class Foo {
112+
constructor(private [test]: [string]) {}
113+
}
114+
`
98115
],
99116
invalid: [
100117
{

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2888,6 +2888,20 @@ type Foo<T> = {
28882888
column: 5
28892889
}
28902890
]
2891+
},
2892+
{
2893+
// https://github.com/typescript-eslint/typescript-eslint/issues/270
2894+
code: `export type ButtonProps = JSX.IntrinsicElements['button'];`,
2895+
errors: [
2896+
{
2897+
messageId: 'noTypeAlias',
2898+
data: {
2899+
alias: 'aliases'
2900+
},
2901+
line: 1,
2902+
column: 27
2903+
}
2904+
]
28912905
}
28922906
]
28932907
});

0 commit comments

Comments
 (0)