2 * @fileoverview Rule to disallow returning value from constructor.
3 * @author Pig Fang <https://github.com/g-plane>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
17 description: "disallow returning value from constructor",
18 category: "Best Practices",
20 url: "https://eslint.org/docs/rules/no-constructor-return"
28 unexpected: "Unexpected return statement in constructor."
36 onCodePathStart(_, node) {
42 ReturnStatement(node) {
43 const last = stack[stack.length - 1];
50 last.parent.type === "MethodDefinition" &&
51 last.parent.kind === "constructor" &&
52 (node.parent.parent === last || node.argument)
56 messageId: "unexpected"