Skip to content

Commit

Permalink
fix(eslint-plugin): [no-useless-constructor] handle bodyless construc…
Browse files Browse the repository at this point in the history
…tor (#685)
  • Loading branch information
bradzacher authored and JamesHenry committed Jul 25, 2019
1 parent 92e98de commit 55e788c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/rules/no-useless-constructor.ts
Expand Up @@ -63,6 +63,7 @@ export default util.createRule<Options, MessageIds>({
if (
node.value &&
node.value.type === AST_NODE_TYPES.FunctionExpression &&
node.value.body &&
checkAccessibility(node) &&
checkParams(node)
) {
Expand Down
Expand Up @@ -50,6 +50,8 @@ ruleTester.run('no-useless-constructor', rule, {
'class A extends B { private constructor(foo, bar) { super(bar); } }',
'class A extends B { public constructor(foo){ super(foo); } }',
'class A extends B { public constructor(foo){} }',
// type definition / overload
'class A { constructor(foo); }',
],
invalid: [
{
Expand Down

0 comments on commit 55e788c

Please sign in to comment.