]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-constructor-return.js
2 * @fileoverview Rule to disallow returning value from constructor.
3 * @author Pig Fang <https://github.com/g-plane>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 /** @type {import('../shared/types').Rule} */
18 description
: "disallow returning value from constructor",
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"