Skip to content
Permalink
Browse files
Fix: no-useless-constructor crash on bodyless constructor (fixes #13830
…) (#13842)
  • Loading branch information
AriPerkkio committed Nov 18, 2020
1 parent eda0aa1 commit d2239a1fdec452e24ede04e990d16d42516fa538
Showing with 431 additions and 1 deletion.
  1. +8 −0 lib/rules/no-useless-constructor.js
  2. +418 −0 tests/fixtures/parsers/typescript-parsers/declare-class.js
  3. +5 −1 tests/lib/rules/no-useless-constructor.js
@@ -162,6 +162,14 @@ module.exports = {
return;
}

/*
* Prevent crashing on parsers which do not require class constructor
* to have a body, e.g. typescript and flow
*/
if (!node.value.body) {
return;
}

const body = node.value.body.body;
const ctorParams = node.value.params;
const superClass = node.parent.parent.superClass;
Loading

0 comments on commit d2239a1

Please sign in to comment.