Skip to content
Permalink
Browse files

fix(eslint-plugin): [explicit-function-return-type] Fix obj setter prop

Fixes #525
  • Loading branch information...
bradzacher committed May 13, 2019
1 parent 1a0e60b commit 8c8497ce2f1cf0dd5c9df91fe29415181c0d8096
@@ -65,7 +65,8 @@ export default util.createRule<Options, MessageIds>({
function isSetter(node: TSESTree.Node | undefined): boolean {
return (
!!node &&
node.type === AST_NODE_TYPES.MethodDefinition &&
(node.type === AST_NODE_TYPES.MethodDefinition ||
node.type === AST_NODE_TYPES.Property) &&
node.kind === 'set'
);
}
@@ -169,6 +169,17 @@ class App {
`,
options: [{ allowTypedFunctionExpressions: true }],
},
// https://github.com/typescript-eslint/typescript-eslint/issues/525
{
filename: 'test.ts',
code: `
const myObj = {
set myProp(val) {
this.myProp = val;
},
};
`,
},
],
invalid: [
{
@@ -895,7 +895,7 @@ export interface Property extends BaseNode {
computed: boolean;
method: boolean;
shorthand: boolean;
kind: 'init';
kind: 'init' | 'get' | 'set';
}

export interface RestElement extends BaseNode {

0 comments on commit 8c8497c

Please sign in to comment.
You can’t perform that action at this time.