Skip to content

Commit

Permalink
fix(eslint-plugin): [no-untyped-pub-sig] ignore set return (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-tarasyuk authored and bradzacher committed Nov 26, 2019
1 parent 835378e commit 6daff10
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
Expand Up @@ -108,6 +108,7 @@ export default util.createRule<Options, MessageIds>({

if (
node.kind !== 'constructor' &&
node.kind !== 'set' &&
!isReturnTyped(node.value.returnType)
) {
context.report({
Expand Down
Expand Up @@ -99,6 +99,34 @@ class Foo {
`
class Foo {
abstract constructor(c: string) {}
}
`,

// https://github.com/typescript-eslint/typescript-eslint/issues/1263
`
class Foo {
private _x: string;
public get x(): string {
return this._x;
}
public set x(x: string) {
this._x = x;
}
}
`,
`
class Foo {
private _x: string;
get x(): string {
return this._x;
}
set x(x: string) {
this._x = x;
}
}
`,
],
Expand Down Expand Up @@ -240,6 +268,40 @@ class Foo {
code: `
class Foo {
abstract constructor(c) {}
}
`,
errors: [{ messageId: 'untypedParameter' }],
},

// https://github.com/typescript-eslint/typescript-eslint/issues/1263
{
code: `
class Foo {
private _x: string;
public get x(): string {
return this._x;
}
public set x(x) {
this._x = x;
}
}
`,
errors: [{ messageId: 'untypedParameter' }],
},
{
code: `
class Foo {
private _x: string;
get x(): string {
return this._x;
}
set x(x) {
this._x = x;
}
}
`,
errors: [{ messageId: 'untypedParameter' }],
Expand Down

0 comments on commit 6daff10

Please sign in to comment.